mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
Add binary_sensor setup type hints [o-r] (#63270)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
33e4251606
commit
545b10a711
@ -2,13 +2,19 @@
|
|||||||
from __future__ import annotations
|
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.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .base import ONVIFBaseEntity
|
from .base import ONVIFBaseEntity
|
||||||
from .const import DOMAIN
|
from .const import 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 a ONVIF binary sensor."""
|
"""Set up a ONVIF binary sensor."""
|
||||||
device = hass.data[DOMAIN][config_entry.unique_id]
|
device = hass.data[DOMAIN][config_entry.unique_id]
|
||||||
|
|
||||||
|
@ -7,7 +7,9 @@ from homeassistant.components.binary_sensor import (
|
|||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
BinarySensorEntityDescription,
|
BinarySensorEntityDescription,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
from .entity import OpenGarageEntity
|
from .entity import OpenGarageEntity
|
||||||
@ -22,7 +24,9 @@ SENSOR_TYPES: tuple[BinarySensorEntityDescription, ...] = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
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 OpenGarage binary sensors."""
|
"""Set up the OpenGarage binary sensors."""
|
||||||
open_garage_data_coordinator = hass.data[DOMAIN][entry.entry_id]
|
open_garage_data_coordinator = hass.data[DOMAIN][entry.entry_id]
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
"""Support for binary sensor using Orange Pi GPIO."""
|
"""Support for binary sensor using Orange Pi GPIO."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
|
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import edge_detect, read_input, setup_input, setup_mode
|
from . import edge_detect, read_input, setup_input, setup_mode
|
||||||
from .const import CONF_INVERT_LOGIC, CONF_PIN_MODE, CONF_PORTS, PORT_SCHEMA
|
from .const import CONF_INVERT_LOGIC, CONF_PIN_MODE, CONF_PORTS, PORT_SCHEMA
|
||||||
@ -8,7 +12,12 @@ from .const import CONF_INVERT_LOGIC, CONF_PIN_MODE, CONF_PORTS, PORT_SCHEMA
|
|||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(PORT_SCHEMA)
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(PORT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
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 Orange Pi GPIO platform."""
|
"""Set up the Orange Pi GPIO platform."""
|
||||||
binary_sensors = []
|
binary_sensors = []
|
||||||
invert_logic = config[CONF_INVERT_LOGIC]
|
invert_logic = config[CONF_INVERT_LOGIC]
|
||||||
|
@ -6,8 +6,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 DATA_UNSUBSCRIBE, DOMAIN
|
from .const import DATA_UNSUBSCRIBE, DOMAIN
|
||||||
from .entity import ZWaveDeviceEntity
|
from .entity import ZWaveDeviceEntity
|
||||||
@ -240,7 +242,11 @@ NOTIFICATION_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 Z-Wave binary_sensor from config entry."""
|
"""Set up Z-Wave binary_sensor from config entry."""
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for binary sensor using I2C PCAL9535A chip."""
|
"""Support for binary sensor using I2C PCAL9535A chip."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pcal9535a import PCAL9535A
|
from pcal9535a import PCAL9535A
|
||||||
@ -6,7 +8,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"
|
||||||
@ -40,7 +45,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
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 PCAL9535A binary sensors."""
|
"""Set up the PCAL9535A binary sensors."""
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"The PCAL9535A I/O Expander integration is deprecated and will be removed "
|
"The PCAL9535A I/O Expander integration is deprecated and will be removed "
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for binary sensor using RPi GPIO."""
|
"""Support for binary sensor using RPi GPIO."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pi4ioe5v9xxxx import pi4ioe5v9xxxx
|
from pi4ioe5v9xxxx import pi4ioe5v9xxxx
|
||||||
@ -6,7 +8,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_PINS = "pins"
|
CONF_PINS = "pins"
|
||||||
@ -35,7 +40,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
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 IO expander devices."""
|
"""Set up the IO expander devices."""
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"The pi4ioe5v9xxxx IO Expander integration is deprecated and will be removed "
|
"The pi4ioe5v9xxxx IO Expander integration is deprecated and will be removed "
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for Pilight binary sensors."""
|
"""Support for Pilight binary sensors."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -12,8 +14,11 @@ from homeassistant.const import (
|
|||||||
CONF_PAYLOAD_OFF,
|
CONF_PAYLOAD_OFF,
|
||||||
CONF_PAYLOAD_ON,
|
CONF_PAYLOAD_ON,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.event import track_point_in_time
|
from homeassistant.helpers.event import track_point_in_time
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
CONF_VARIABLE = "variable"
|
CONF_VARIABLE = "variable"
|
||||||
@ -37,7 +42,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 Pilight Binary Sensor."""
|
"""Set up Pilight Binary Sensor."""
|
||||||
if config.get(CONF_DISARM_AFTER_TRIGGER):
|
if config.get(CONF_DISARM_AFTER_TRIGGER):
|
||||||
add_entities(
|
add_entities(
|
||||||
|
@ -7,12 +7,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 .const import CONF_USE_WEBHOOK, COORDINATOR, DOMAIN
|
from .const import CONF_USE_WEBHOOK, COORDINATOR, DOMAIN
|
||||||
from .entity import PlaatoEntity
|
from .entity import PlaatoEntity
|
||||||
|
|
||||||
|
|
||||||
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 Plaato from a config entry."""
|
"""Set up Plaato from a config entry."""
|
||||||
|
|
||||||
if config_entry.data[CONF_USE_WEBHOOK]:
|
if config_entry.data[CONF_USE_WEBHOOK]:
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
"""Plugwise Binary Sensor component for Home Assistant."""
|
"""Plugwise Binary Sensor component for Home Assistant."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||||
from homeassistant.core import callback
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
COORDINATOR,
|
COORDINATOR,
|
||||||
@ -26,7 +27,11 @@ SEVERITIES = ["other", "info", "warning", "error"]
|
|||||||
_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 Smile binary_sensors from a config entry."""
|
"""Set up the Smile binary_sensors from a config entry."""
|
||||||
api = hass.data[DOMAIN][config_entry.entry_id]["api"]
|
api = hass.data[DOMAIN][config_entry.entry_id]["api"]
|
||||||
coordinator = hass.data[DOMAIN][config_entry.entry_id][COORDINATOR]
|
coordinator = hass.data[DOMAIN][config_entry.entry_id][COORDINATOR]
|
||||||
|
@ -8,8 +8,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 . import MinutPointEntity
|
from . import MinutPointEntity
|
||||||
from .const import DOMAIN as POINT_DOMAIN, POINT_DISCOVERY_NEW, SIGNAL_WEBHOOK
|
from .const import DOMAIN as POINT_DOMAIN, POINT_DISCOVERY_NEW, SIGNAL_WEBHOOK
|
||||||
@ -35,7 +37,11 @@ DEVICES = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 a Point's binary sensors based on a config entry."""
|
"""Set up a Point's binary sensors based on a config entry."""
|
||||||
|
|
||||||
async def async_discover_sensor(device_id):
|
async def async_discover_sensor(device_id):
|
||||||
|
@ -6,7 +6,10 @@ from homeassistant.components.binary_sensor import (
|
|||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
BinarySensorEntityDescription,
|
BinarySensorEntityDescription,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_EMAIL
|
from homeassistant.const import CONF_EMAIL
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import PoolSenseEntity
|
from . import PoolSenseEntity
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
@ -25,7 +28,11 @@ BINARY_SENSOR_TYPES: tuple[BinarySensorEntityDescription, ...] = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
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][config_entry.entry_id]
|
coordinator = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
|
|
||||||
|
@ -5,6 +5,9 @@ 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 .const import (
|
from .const import (
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
@ -21,7 +24,11 @@ from .const import (
|
|||||||
from .entity import PowerWallEntity
|
from .entity import PowerWallEntity
|
||||||
|
|
||||||
|
|
||||||
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 August sensors."""
|
"""Set up the August sensors."""
|
||||||
powerwall_data = hass.data[DOMAIN][config_entry.entry_id]
|
powerwall_data = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Control binary sensor instances."""
|
"""Control binary sensor instances."""
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -7,6 +6,9 @@ from ProgettiHWSW.input import Input
|
|||||||
import async_timeout
|
import async_timeout
|
||||||
|
|
||||||
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 homeassistant.helpers.update_coordinator import (
|
from homeassistant.helpers.update_coordinator import (
|
||||||
CoordinatorEntity,
|
CoordinatorEntity,
|
||||||
DataUpdateCoordinator,
|
DataUpdateCoordinator,
|
||||||
@ -18,7 +20,11 @@ from .const import DEFAULT_POLLING_INTERVAL_SEC, DOMAIN
|
|||||||
_LOGGER = logging.getLogger(DOMAIN)
|
_LOGGER = logging.getLogger(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 the binary sensors from a config entry."""
|
"""Set up the binary sensors from a config entry."""
|
||||||
board_api = hass.data[DOMAIN][config_entry.entry_id]
|
board_api = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
input_count = config_entry.data["input_count"]
|
input_count = config_entry.data["input_count"]
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
"""Binary sensor to read Proxmox VE data."""
|
"""Binary sensor to read Proxmox VE data."""
|
||||||
|
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 homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||||
|
|
||||||
from . import COORDINATORS, DOMAIN, PROXMOX_CLIENTS, ProxmoxEntity
|
from . import COORDINATORS, DOMAIN, PROXMOX_CLIENTS, ProxmoxEntity
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, add_entities, discovery_info=None):
|
async def async_setup_platform(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
add_entities: AddEntitiesCallback,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> None:
|
||||||
"""Set up binary sensors."""
|
"""Set up binary sensors."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
|
@ -1,17 +1,26 @@
|
|||||||
"""Support for Qwikswitch Binary Sensors."""
|
"""Support for Qwikswitch Binary Sensors."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pyqwikswitch.qwikswitch import SENSORS
|
from pyqwikswitch.qwikswitch import SENSORS
|
||||||
|
|
||||||
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.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import DOMAIN as QWIKSWITCH, QSEntity
|
from . import DOMAIN as QWIKSWITCH, QSEntity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, _, add_entities, discovery_info=None):
|
async def async_setup_platform(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
_: ConfigType,
|
||||||
|
add_entities: AddEntitiesCallback,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> None:
|
||||||
"""Add binary sensor from the main Qwikswitch component."""
|
"""Add binary sensor from the main Qwikswitch component."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
|
@ -6,8 +6,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 (
|
from .const import (
|
||||||
DOMAIN as DOMAIN_RACHIO,
|
DOMAIN as DOMAIN_RACHIO,
|
||||||
@ -31,7 +33,11 @@ from .webhooks import (
|
|||||||
_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 Rachio binary sensors."""
|
"""Set up the Rachio binary sensors."""
|
||||||
entities = await hass.async_add_executor_job(_create_entities, hass, config_entry)
|
entities = await hass.async_add_executor_job(_create_entities, hass, config_entry)
|
||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for Rain Bird Irrigation system LNK WiFi Module."""
|
"""Support for Rain Bird Irrigation system LNK WiFi Module."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pyrainbird import RainbirdController
|
from pyrainbird import RainbirdController
|
||||||
@ -7,6 +9,9 @@ from homeassistant.components.binary_sensor import (
|
|||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
BinarySensorEntityDescription,
|
BinarySensorEntityDescription,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
BINARY_SENSOR_TYPES,
|
BINARY_SENSOR_TYPES,
|
||||||
@ -19,7 +24,12 @@ from . import (
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
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 Rain Bird sensor."""
|
"""Set up a Rain Bird sensor."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for showing random states."""
|
"""Support for showing random states."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from random import getrandbits
|
from random import getrandbits
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -9,7 +11,10 @@ from homeassistant.components.binary_sensor import (
|
|||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME
|
from homeassistant.const import CONF_DEVICE_CLASS, 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
|
||||||
|
|
||||||
DEFAULT_NAME = "Random Binary Sensor"
|
DEFAULT_NAME = "Random Binary Sensor"
|
||||||
|
|
||||||
@ -21,7 +26,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
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 Random binary sensor."""
|
"""Set up the Random binary sensor."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
device_class = config.get(CONF_DEVICE_CLASS)
|
device_class = config.get(CONF_DEVICE_CLASS)
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
"""Support for binary sensor using RPi GPIO."""
|
"""Support for binary sensor using RPi GPIO."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import voluptuous as vol
|
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 CONF_HOST
|
from homeassistant.const import CONF_HOST
|
||||||
|
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 (
|
from . import (
|
||||||
CONF_BOUNCETIME,
|
CONF_BOUNCETIME,
|
||||||
@ -31,7 +36,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 Raspberry PI GPIO devices."""
|
"""Set up the Raspberry PI GPIO devices."""
|
||||||
address = config["host"]
|
address = config["host"]
|
||||||
invert_logic = config[CONF_INVERT_LOGIC]
|
invert_logic = config[CONF_INVERT_LOGIC]
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for RESTful binary sensors."""
|
"""Support for RESTful binary sensors."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
@ -14,8 +16,11 @@ from homeassistant.const import (
|
|||||||
CONF_RESOURCE_TEMPLATE,
|
CONF_RESOURCE_TEMPLATE,
|
||||||
CONF_VALUE_TEMPLATE,
|
CONF_VALUE_TEMPLATE,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
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 async_get_config_and_coordinator, create_rest_data_from_config
|
from . import async_get_config_and_coordinator, create_rest_data_from_config
|
||||||
from .entity import RestEntity
|
from .entity import RestEntity
|
||||||
@ -28,7 +33,12 @@ PLATFORM_SCHEMA = vol.All(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
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 REST binary sensor."""
|
"""Set up the REST binary sensor."""
|
||||||
# Must update the sensor now (including fetching the rest resource) to
|
# Must update the sensor now (including fetching the rest resource) to
|
||||||
# ensure it's updating its state.
|
# ensure it's updating its state.
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for Rflink binary sensors."""
|
"""Support for Rflink binary sensors."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
@ -12,9 +14,11 @@ from homeassistant.const import (
|
|||||||
CONF_FORCE_UPDATE,
|
CONF_FORCE_UPDATE,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
import homeassistant.helpers.event as evt
|
import homeassistant.helpers.event as evt
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import CONF_ALIASES, RflinkDevice
|
from . import CONF_ALIASES, RflinkDevice
|
||||||
|
|
||||||
@ -53,7 +57,12 @@ def devices_from_config(domain_config):
|
|||||||
return devices
|
return devices
|
||||||
|
|
||||||
|
|
||||||
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 Rflink platform."""
|
"""Set up the Rflink platform."""
|
||||||
async_add_entities(devices_from_config(config))
|
async_add_entities(devices_from_config(config))
|
||||||
|
|
||||||
|
@ -9,7 +9,9 @@ from homeassistant.components.binary_sensor import (
|
|||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
BinarySensorEntityDescription,
|
BinarySensorEntityDescription,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import DOMAIN
|
from . import DOMAIN
|
||||||
from .entity import RingEntityMixin
|
from .entity import RingEntityMixin
|
||||||
@ -45,7 +47,11 @@ BINARY_SENSOR_TYPES: tuple[RingBinarySensorEntityDescription, ...] = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
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 Ring binary sensors from a config entry."""
|
"""Set up the Ring binary sensors from a config entry."""
|
||||||
ring = hass.data[DOMAIN][config_entry.entry_id]["api"]
|
ring = hass.data[DOMAIN][config_entry.entry_id]["api"]
|
||||||
devices = hass.data[DOMAIN][config_entry.entry_id]["devices"]
|
devices = hass.data[DOMAIN][config_entry.entry_id]["devices"]
|
||||||
|
@ -3,8 +3,11 @@ from homeassistant.components.binary_sensor import (
|
|||||||
BinarySensorDeviceClass,
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_platform
|
from homeassistant.helpers import entity_platform
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import DATA_COORDINATOR, DOMAIN
|
from .const import DATA_COORDINATOR, DOMAIN
|
||||||
from .entity import RiscoEntity, binary_sensor_unique_id
|
from .entity import RiscoEntity, binary_sensor_unique_id
|
||||||
@ -13,7 +16,11 @@ SERVICE_BYPASS_ZONE = "bypass_zone"
|
|||||||
SERVICE_UNBYPASS_ZONE = "unbypass_zone"
|
SERVICE_UNBYPASS_ZONE = "unbypass_zone"
|
||||||
|
|
||||||
|
|
||||||
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 Risco alarm control panel."""
|
"""Set up the Risco alarm control panel."""
|
||||||
platform = entity_platform.async_get_current_platform()
|
platform = entity_platform.async_get_current_platform()
|
||||||
platform.async_register_entity_service(SERVICE_BYPASS_ZONE, {}, "async_bypass_zone")
|
platform.async_register_entity_service(SERVICE_BYPASS_ZONE, {}, "async_bypass_zone")
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
"""Roomba binary sensor entities."""
|
"""Roomba 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.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import roomba_reported_state
|
from . import roomba_reported_state
|
||||||
from .const import BLID, DOMAIN, ROOMBA_SESSION
|
from .const import BLID, DOMAIN, ROOMBA_SESSION
|
||||||
from .irobot_base import IRobotEntity
|
from .irobot_base import IRobotEntity
|
||||||
|
|
||||||
|
|
||||||
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 iRobot Roomba vacuum cleaner."""
|
"""Set up the iRobot Roomba vacuum cleaner."""
|
||||||
domain_data = hass.data[DOMAIN][config_entry.entry_id]
|
domain_data = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
roomba = domain_data[ROOMBA_SESSION]
|
roomba = domain_data[ROOMBA_SESSION]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user