Add setup type hints [x-z] (#63485)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
a4fdaffb14
commit
d20851812e
4 changed files with 56 additions and 19 deletions
|
@ -1,4 +1,6 @@
|
|||
"""Support for XBee Zigbee sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from binascii import hexlify
|
||||
import logging
|
||||
|
||||
|
@ -7,6 +9,9 @@ from xbee_helper.exceptions import ZigBeeException, ZigBeeTxFailure
|
|||
|
||||
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||
from homeassistant.const import CONF_TYPE, TEMP_CELSIUS
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import DOMAIN, PLATFORM_SCHEMA, XBeeAnalogIn, XBeeAnalogInConfig, XBeeConfig
|
||||
|
||||
|
@ -25,14 +30,19 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||
)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the XBee Zigbee platform.
|
||||
|
||||
Uses the 'type' config value to work out which type of Zigbee sensor we're
|
||||
dealing with and instantiates the relevant classes to handle it.
|
||||
"""
|
||||
zigbee_device = hass.data[DOMAIN]
|
||||
typ = config.get(CONF_TYPE)
|
||||
typ = config[CONF_TYPE]
|
||||
|
||||
try:
|
||||
sensor_class, config_class = TYPE_CLASSES[typ]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue