Add setup type hints (part 3) (#63961)
* Drop return value from vesync * Add setup type hints to netgear_lte * Drop return value from hyperion * Add setup type hints to opentherm_gw Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
0d58887bc0
commit
ec1b45c922
7 changed files with 42 additions and 15 deletions
|
@ -85,7 +85,7 @@ async def async_setup_entry(
|
|||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> bool:
|
||||
) -> None:
|
||||
"""Set up a Hyperion platform from config entry."""
|
||||
|
||||
entry_data = hass.data[DOMAIN][config_entry.entry_id]
|
||||
|
@ -122,7 +122,6 @@ async def async_setup_entry(
|
|||
)
|
||||
|
||||
listen_for_instance_updates(hass, config_entry, instance_add, instance_remove)
|
||||
return True
|
||||
|
||||
|
||||
class HyperionBaseLight(LightEntity):
|
||||
|
|
|
@ -86,7 +86,7 @@ async def async_setup_entry(
|
|||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> bool:
|
||||
) -> None:
|
||||
"""Set up a Hyperion platform from config entry."""
|
||||
entry_data = hass.data[DOMAIN][config_entry.entry_id]
|
||||
server_id = config_entry.unique_id
|
||||
|
@ -121,7 +121,6 @@ async def async_setup_entry(
|
|||
)
|
||||
|
||||
listen_for_instance_updates(hass, config_entry, instance_add, instance_remove)
|
||||
return True
|
||||
|
||||
|
||||
class HyperionComponentSwitch(SwitchEntity):
|
||||
|
|
|
@ -1,12 +1,22 @@
|
|||
"""Support for Netgear LTE sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import CONF_MONITORED_CONDITIONS, CONF_SENSOR, DATA_KEY, LTEEntity
|
||||
from .sensor_types import SENSOR_SMS, SENSOR_SMS_TOTAL, SENSOR_UNITS, SENSOR_USAGE
|
||||
|
||||
|
||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info):
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up Netgear LTE sensor devices."""
|
||||
if discovery_info is None:
|
||||
return
|
||||
|
@ -19,7 +29,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info)
|
|||
sensor_conf = discovery_info[CONF_SENSOR]
|
||||
monitored_conditions = sensor_conf[CONF_MONITORED_CONDITIONS]
|
||||
|
||||
sensors = []
|
||||
sensors: list[SensorEntity] = []
|
||||
for sensor_type in monitored_conditions:
|
||||
if sensor_type == SENSOR_SMS:
|
||||
sensors.append(SMSUnreadSensor(modem_data, sensor_type))
|
||||
|
|
|
@ -3,10 +3,12 @@ import logging
|
|||
from pprint import pformat
|
||||
|
||||
from homeassistant.components.binary_sensor import ENTITY_ID_FORMAT, BinarySensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_ID
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import DeviceInfo, async_generate_entity_id
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.entity_registry import async_get_registry
|
||||
|
||||
from . import DOMAIN
|
||||
|
@ -21,7 +23,11 @@ from .const import (
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up the OpenTherm Gateway binary sensors."""
|
||||
sensors = []
|
||||
deprecated_sensors = []
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Constants for the opentherm_gw integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
import pyotgw.vars as gw_vars
|
||||
|
||||
from homeassistant.components.binary_sensor import BinarySensorDeviceClass
|
||||
|
@ -49,7 +51,7 @@ TRANSLATE_SOURCE = {
|
|||
UNIT_KW = "kW"
|
||||
UNIT_L_MIN = f"L/{TIME_MINUTES}"
|
||||
|
||||
BINARY_SENSOR_INFO = {
|
||||
BINARY_SENSOR_INFO: dict[str, list] = {
|
||||
# [device_class, friendly_name format, [status source, ...]]
|
||||
gw_vars.DATA_MASTER_CH_ENABLED: [
|
||||
None,
|
||||
|
@ -211,7 +213,7 @@ BINARY_SENSOR_INFO = {
|
|||
gw_vars.OTGW_OVRD_HB: [None, "Gateway Override High Byte {}", [gw_vars.OTGW]],
|
||||
}
|
||||
|
||||
SENSOR_INFO = {
|
||||
SENSOR_INFO: dict[str, list] = {
|
||||
# [device_class, unit, friendly_name, [status source, ...]]
|
||||
gw_vars.DATA_CONTROL_SETPOINT: [
|
||||
SensorDeviceClass.TEMPERATURE,
|
||||
|
|
|
@ -3,10 +3,12 @@ import logging
|
|||
from pprint import pformat
|
||||
|
||||
from homeassistant.components.sensor import ENTITY_ID_FORMAT, SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_ID
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import DeviceInfo, async_generate_entity_id
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.entity_registry import async_get_registry
|
||||
|
||||
from . import DOMAIN
|
||||
|
@ -21,7 +23,11 @@ from .const import (
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up the OpenTherm Gateway sensors."""
|
||||
sensors = []
|
||||
deprecated_sensors = []
|
||||
|
|
|
@ -6,10 +6,12 @@ from homeassistant.components.sensor import (
|
|||
SensorEntity,
|
||||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ENERGY_KILO_WATT_HOUR, POWER_WATT
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .common import VeSyncBaseEntity
|
||||
from .const import DOMAIN, VS_DISCOVERY, VS_DISPATCHERS, VS_SENSORS
|
||||
|
@ -18,7 +20,11 @@ from .switch import DEV_TYPE_TO_HA
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up switches."""
|
||||
|
||||
async def async_discover(devices):
|
||||
|
@ -31,7 +37,6 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
hass.data[DOMAIN][VS_DISPATCHERS].append(disp)
|
||||
|
||||
_async_setup_entities(hass.data[DOMAIN][VS_SENSORS], async_add_entities)
|
||||
return True
|
||||
|
||||
|
||||
@callback
|
||||
|
|
Loading…
Add table
Reference in a new issue