Adjust notify type hints in mysensors (#77647)

pull/77643/head
epenet 2022-09-01 10:11:09 +02:00 committed by GitHub
parent 8dda2389c8
commit 6f8b032a6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -1,11 +1,12 @@
"""MySensors notification service."""
from __future__ import annotations
from typing import Any
from typing import Any, cast
from homeassistant.components.notify import ATTR_TARGET, BaseNotificationService
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from .. import mysensors
from .const import DevId, DiscoveryInfo
@ -13,15 +14,18 @@ from .const import DevId, DiscoveryInfo
async def async_get_service(
hass: HomeAssistant,
config: dict[str, Any],
discovery_info: DiscoveryInfo | None = None,
config: ConfigType,
discovery_info: DiscoveryInfoType | None = None,
) -> BaseNotificationService | None:
"""Get the MySensors notification service."""
if not discovery_info:
return None
new_devices = mysensors.setup_mysensors_platform(
hass, Platform.NOTIFY, discovery_info, MySensorsNotificationDevice
hass,
Platform.NOTIFY,
cast(DiscoveryInfo, discovery_info),
MySensorsNotificationDevice,
)
if not new_devices:
return None