1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00

Add binary_sensor setup type hints [h-n] (#63269)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2022-01-03 11:32:26 +01:00 committed by GitHub
parent 24fc0df4b0
commit 33e4251606
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 207 additions and 30 deletions

View File

@ -5,7 +5,10 @@ from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass, BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import HiveEntity from . import HiveEntity
from .const import ATTR_MODE, DOMAIN from .const import ATTR_MODE, DOMAIN
@ -22,7 +25,9 @@ PARALLEL_UPDATES = 0
SCAN_INTERVAL = timedelta(seconds=15) SCAN_INTERVAL = timedelta(seconds=15)
async def async_setup_entry(hass, entry, async_add_entities): async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
"""Set up Hive thermostat based on a config entry.""" """Set up Hive thermostat based on a config entry."""
hive = hass.data[DOMAIN][entry.entry_id] hive = hass.data[DOMAIN][entry.entry_id]

View File

@ -2,7 +2,10 @@
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ENTITIES from homeassistant.const import CONF_ENTITIES
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import ( from .const import (
ATTR_VALUE, ATTR_VALUE,
@ -19,7 +22,11 @@ from .entity import HomeConnectEntity
_LOGGER = logging.getLogger(__name__) _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 Home Connect binary sensor.""" """Set up the Home Connect binary sensor."""
def get_entities(): def get_entities():

View File

@ -10,8 +10,11 @@ from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass, BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_ATTRIBUTION from homeassistant.const import ATTR_ATTRIBUTION
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import ( from homeassistant.helpers.update_coordinator import (
CoordinatorEntity, CoordinatorEntity,
DataUpdateCoordinator, DataUpdateCoordinator,
@ -23,7 +26,9 @@ from .const import ATTRIBUTION, CONF_STATION, DOMAIN, MANUFACTURER
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass, entry, async_add_entities): async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
"""Set up the binary_sensor platform.""" """Set up the binary_sensor platform."""
hub = hass.data[DOMAIN][entry.entry_id] hub = hass.data[DOMAIN][entry.entry_id]
station_name = entry.data[CONF_STATION]["name"] station_name = entry.data[CONF_STATION]["name"]

View File

@ -12,7 +12,10 @@ from homeassistant.components.binary_sensor import (
BinarySensorEntityDescription, BinarySensorEntityDescription,
) )
from homeassistant.const import CONF_MONITORED_CONDITIONS from homeassistant.const import CONF_MONITORED_CONDITIONS
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import DATA_HYDRAWISE, HydrawiseEntity from . import DATA_HYDRAWISE, HydrawiseEntity
@ -45,7 +48,12 @@ 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 a sensor for a Hydrawise device.""" """Set up a sensor for a Hydrawise device."""
hydrawise = hass.data[DATA_HYDRAWISE].data hydrawise = hass.data[DATA_HYDRAWISE].data
monitored_conditions = config[CONF_MONITORED_CONDITIONS] monitored_conditions = config[CONF_MONITORED_CONDITIONS]

View File

@ -1,13 +1,23 @@
"""Support for IHC binary sensors.""" """Support for IHC binary sensors."""
from __future__ import annotations
from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import CONF_TYPE from homeassistant.const import CONF_TYPE
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import IHC_CONTROLLER, IHC_INFO from . import IHC_CONTROLLER, IHC_INFO
from .const import CONF_INVERTING from .const import CONF_INVERTING
from .ihcdevice import IHCDevice from .ihcdevice import IHCDevice
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 IHC binary sensor platform.""" """Set up the IHC binary sensor platform."""
if discovery_info is None: if discovery_info is None:
return return

View File

@ -7,11 +7,19 @@ from homeassistant.components.binary_sensor import (
DOMAIN as BINARY_SENSOR_DOMAIN, DOMAIN as BINARY_SENSOR_DOMAIN,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import DOMAIN, IncomfortChild from . import DOMAIN, IncomfortChild
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): async def async_setup_platform(
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up an InComfort/InTouch binary_sensor device.""" """Set up an InComfort/InTouch binary_sensor device."""
if discovery_info is None: if discovery_info is None:
return return

View File

@ -18,8 +18,10 @@ from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass, BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.core import callback from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import SIGNAL_ADD_ENTITIES from .const import SIGNAL_ADD_ENTITIES
from .insteon_entity import InsteonEntity from .insteon_entity import InsteonEntity
@ -40,7 +42,11 @@ SENSOR_TYPES = {
} }
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 Insteon binary sensors from a config entry.""" """Set up the Insteon binary sensors from a config entry."""
@callback @callback

View File

@ -1,13 +1,23 @@
"""Support for KEBA charging station binary sensors.""" """Support for KEBA charging station binary sensors."""
from __future__ import annotations
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass, BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import DOMAIN from . import DOMAIN
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): async def async_setup_platform(
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up the KEBA charging station platform.""" """Set up the KEBA charging station platform."""
if discovery_info is None: if discovery_info is None:
return return

View File

@ -1,5 +1,6 @@
"""Support for wired binary sensors attached to a Konnected device.""" """Support for wired binary sensors attached to a Konnected device."""
from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_ENTITY_ID,
ATTR_STATE, ATTR_STATE,
@ -8,14 +9,19 @@ from homeassistant.const import (
CONF_NAME, CONF_NAME,
CONF_TYPE, CONF_TYPE,
) )
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DOMAIN as KONNECTED_DOMAIN from .const import DOMAIN as KONNECTED_DOMAIN
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 binary sensors attached to a Konnected device from a config entry.""" """Set up binary sensors attached to a Konnected device from a config entry."""
data = hass.data[KONNECTED_DOMAIN] data = hass.data[KONNECTED_DOMAIN]
device_id = config_entry.data["id"] device_id = config_entry.data["id"]

View File

@ -1,17 +1,27 @@
"""Support for Lupusec Security System binary sensors.""" """Support for Lupusec Security System binary sensors."""
from __future__ import annotations
# pylint: disable=import-error # pylint: disable=import-error
from datetime import timedelta from datetime import timedelta
import lupupy.constants as CONST import lupupy.constants as CONST
from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import DOMAIN as LUPUSEC_DOMAIN, LupusecDevice from . import DOMAIN as LUPUSEC_DOMAIN, LupusecDevice
SCAN_INTERVAL = timedelta(seconds=2) SCAN_INTERVAL = timedelta(seconds=2)
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 a sensor for an Lupusec device.""" """Set up a sensor for an Lupusec device."""
if discovery_info is None: if discovery_info is None:
return return

View File

@ -1,15 +1,25 @@
"""Support for Lutron Powr Savr occupancy sensors.""" """Support for Lutron Powr Savr occupancy sensors."""
from __future__ import annotations
from pylutron import OccupancyGroup from pylutron import OccupancyGroup
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass, BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice
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 Lutron occupancy sensors.""" """Set up the Lutron occupancy sensors."""
if discovery_info is None: if discovery_info is None:
return return

View File

@ -5,12 +5,19 @@ from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass, BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import DOMAIN as CASETA_DOMAIN, LutronCasetaDevice from . import DOMAIN as CASETA_DOMAIN, LutronCasetaDevice
from .const import BRIDGE_DEVICE, BRIDGE_LEAP from .const import BRIDGE_DEVICE, BRIDGE_LEAP
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 Lutron Caseta binary_sensor platform. """Set up the Lutron Caseta binary_sensor platform.
Adds occupancy groups from the Caseta bridge associated with the Adds occupancy groups from the Caseta bridge associated with the

View File

@ -1,4 +1,6 @@
"""Support for binary sensor using I2C MCP23017 chip.""" """Support for binary sensor using I2C MCP23017 chip."""
from __future__ import annotations
import logging import logging
from adafruit_mcp230xx.mcp23017 import MCP23017 from adafruit_mcp230xx.mcp23017 import MCP23017
@ -9,7 +11,10 @@ import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import DEVICE_DEFAULT_NAME from homeassistant.const import DEVICE_DEFAULT_NAME
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
CONF_INVERT_LOGIC = "invert_logic" CONF_INVERT_LOGIC = "invert_logic"
CONF_I2C_ADDRESS = "i2c_address" CONF_I2C_ADDRESS = "i2c_address"
@ -39,7 +44,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(
hass: HomeAssistant,
config: ConfigType,
add_devices: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up the MCP23017 binary sensors.""" """Set up the MCP23017 binary sensors."""
_LOGGER.warning( _LOGGER.warning(
"The MCP23017 I/O Expander integration is deprecated and will be removed " "The MCP23017 I/O Expander integration is deprecated and will be removed "

View File

@ -1,4 +1,6 @@
"""Binary Sensor for MeteoAlarm.eu.""" """Binary Sensor for MeteoAlarm.eu."""
from __future__ import annotations
from datetime import timedelta from datetime import timedelta
import logging import logging
@ -11,7 +13,10 @@ from homeassistant.components.binary_sensor import (
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.const import CONF_NAME from homeassistant.const import CONF_NAME
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -36,7 +41,12 @@ 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 MeteoAlarm binary sensor platform.""" """Set up the MeteoAlarm binary sensor platform."""
country = config[CONF_COUNTRY] country = config[CONF_COUNTRY]

View File

@ -1,9 +1,11 @@
"""Binary sensor platform for mobile_app.""" """Binary sensor platform for mobile_app."""
from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME, CONF_UNIQUE_ID, CONF_WEBHOOK_ID, STATE_ON from homeassistant.const import CONF_NAME, CONF_UNIQUE_ID, CONF_WEBHOOK_ID, STATE_ON
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import entity_registry as er from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import ( from .const import (
ATTR_DEVICE_NAME, ATTR_DEVICE_NAME,
@ -22,7 +24,11 @@ from .const import (
from .entity import MobileAppEntity, unique_id from .entity import MobileAppEntity, unique_id
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 mobile app binary sensor from a config entry.""" """Set up mobile app binary sensor from a config entry."""
entities = [] entities = []

View File

@ -3,7 +3,10 @@ from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass, BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_DEVICE_CLASS, CONF_ID, CONF_NAME from homeassistant.const import CONF_DEVICE_CLASS, CONF_ID, CONF_NAME
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import DOMAIN from .const import DOMAIN
@ -17,7 +20,11 @@ BINARY_SENSORS = (
) )
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:
"""Defer sensor setup to the shared sensor module.""" """Defer sensor setup to the shared sensor module."""
coordinator = hass.data[DOMAIN] coordinator = hass.data[DOMAIN]

View File

@ -1,8 +1,11 @@
"""mütesync binary sensor entities.""" """mütesync binary sensor entities."""
from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers import update_coordinator from homeassistant.helpers import update_coordinator
from homeassistant.helpers.device_registry import DeviceEntryType from homeassistant.helpers.device_registry import DeviceEntryType
from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DOMAIN from .const import DOMAIN
@ -12,7 +15,11 @@ SENSORS = {
} }
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 mütesync button.""" """Set up the mütesync button."""
coordinator = hass.data[DOMAIN][config_entry.entry_id] coordinator = hass.data[DOMAIN][config_entry.entry_id]
async_add_entities( async_add_entities(

View File

@ -3,13 +3,20 @@ from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass, BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import MyQEntity from . import MyQEntity
from .const import DOMAIN, MYQ_COORDINATOR, MYQ_GATEWAY from .const import DOMAIN, MYQ_COORDINATOR, MYQ_GATEWAY
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 mysq covers.""" """Set up mysq covers."""
data = hass.data[DOMAIN][config_entry.entry_id] data = hass.data[DOMAIN][config_entry.entry_id]
myq = data[MYQ_GATEWAY] myq = data[MYQ_GATEWAY]

View File

@ -1,7 +1,11 @@
"""Support for Ness D8X/D16X zone states - represented as binary sensors.""" """Support for Ness D8X/D16X zone states - represented as binary sensors."""
from __future__ import annotations
from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import ( from . import (
CONF_ZONE_ID, CONF_ZONE_ID,
@ -13,7 +17,12 @@ from . import (
) )
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): async def async_setup_platform(
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up the Ness Alarm binary sensor devices.""" """Set up the Ness Alarm binary sensor devices."""
if not discovery_info: if not discovery_info:
return return

View File

@ -1,13 +1,19 @@
"""Support for Nexia / Trane XL Thermostats.""" """Support for Nexia / Trane XL Thermostats."""
from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DOMAIN from .const import DOMAIN
from .coordinator import NexiaDataUpdateCoordinator from .coordinator import NexiaDataUpdateCoordinator
from .entity import NexiaThermostatEntity from .entity import NexiaThermostatEntity
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 sensors for a Nexia device.""" """Set up sensors for a Nexia device."""
coordinator: NexiaDataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id] coordinator: NexiaDataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]
nexia_home = coordinator.nexia_home nexia_home = coordinator.nexia_home

View File

@ -1,10 +1,20 @@
"""Summary binary data from Nextcoud.""" """Summary binary data from Nextcoud."""
from __future__ import annotations
from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import BINARY_SENSORS, DOMAIN from . import BINARY_SENSORS, DOMAIN
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 Nextcloud sensors.""" """Set up the Nextcloud sensors."""
if discovery_info is None: if discovery_info is None:
return return

View File

@ -1,17 +1,21 @@
"""Doorsensor Support for the Nuki Lock.""" """Doorsensor Support for the Nuki Lock."""
from pynuki import STATE_DOORSENSOR_OPENED from pynuki import STATE_DOORSENSOR_OPENED
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass, BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import NukiEntity from . import NukiEntity
from .const import ATTR_NUKI_ID, DATA_COORDINATOR, DATA_LOCKS, DOMAIN as NUKI_DOMAIN from .const import ATTR_NUKI_ID, DATA_COORDINATOR, DATA_LOCKS, DOMAIN as NUKI_DOMAIN
async def async_setup_entry(hass, entry, async_add_entities): async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
"""Set up the Nuki lock binary sensor.""" """Set up the Nuki lock binary sensor."""
data = hass.data[NUKI_DOMAIN][entry.entry_id] data = hass.data[NUKI_DOMAIN][entry.entry_id]
coordinator = data[DATA_COORDINATOR] coordinator = data[DATA_COORDINATOR]

View File

@ -1,4 +1,6 @@
"""Binary sensor platform integration for Numato USB GPIO expanders.""" """Binary sensor platform integration for Numato USB GPIO expanders."""
from __future__ import annotations
from functools import partial from functools import partial
import logging import logging
@ -6,8 +8,10 @@ from numato_gpio import NumatoGpioError
from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import DEVICE_DEFAULT_NAME from homeassistant.const import DEVICE_DEFAULT_NAME
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import ( from . import (
CONF_BINARY_SENSORS, CONF_BINARY_SENSORS,
@ -24,7 +28,12 @@ _LOGGER = logging.getLogger(__name__)
NUMATO_SIGNAL = "numato_signal_{}_{}" NUMATO_SIGNAL = "numato_signal_{}_{}"
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 configured Numato USB GPIO binary sensor ports.""" """Set up the configured Numato USB GPIO binary sensor ports."""
if discovery_info is None: if discovery_info is None:
return return