Add switch setup type hints [g-m] (#63303)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
eb7911f951
commit
f39531dcfc
20 changed files with 174 additions and 26 deletions
|
@ -2,14 +2,20 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
|
from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
|
||||||
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 COORDINATORS, DISPATCH_DEVICE_DISCOVERED, DISPATCHERS, DOMAIN
|
from .const import COORDINATORS, DISPATCH_DEVICE_DISCOVERED, DISPATCHERS, DOMAIN
|
||||||
from .entity import GreeEntity
|
from .entity import GreeEntity
|
||||||
|
|
||||||
|
|
||||||
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 Gree HVAC device from a config entry."""
|
"""Set up the Gree HVAC device from a config entry."""
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import DOMAIN, HARMONY_DATA
|
from .const import DOMAIN, HARMONY_DATA
|
||||||
from .data import HarmonyData
|
from .data import HarmonyData
|
||||||
|
@ -13,7 +15,9 @@ from .subscriber import HarmonyCallback
|
||||||
_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 harmony activity switches."""
|
"""Set up harmony activity switches."""
|
||||||
data = hass.data[DOMAIN][entry.entry_id][HARMONY_DATA]
|
data = hass.data[DOMAIN][entry.entry_id][HARMONY_DATA]
|
||||||
activities = data.activities
|
activities = data.activities
|
||||||
|
|
|
@ -4,7 +4,10 @@ from __future__ import annotations
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
|
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, refresh_system
|
from . import HiveEntity, refresh_system
|
||||||
from .const import ATTR_MODE, DOMAIN
|
from .const import ATTR_MODE, DOMAIN
|
||||||
|
@ -13,7 +16,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]
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
"""Support for HLK-SW16 switches."""
|
"""Support for HLK-SW16 switches."""
|
||||||
from homeassistant.components.switch import ToggleEntity
|
from homeassistant.components.switch import ToggleEntity
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import DATA_DEVICE_REGISTER, SW16Device
|
from . import DATA_DEVICE_REGISTER, SW16Device
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
@ -18,7 +21,9 @@ def devices_from_entities(hass, entry):
|
||||||
return devices
|
return devices
|
||||||
|
|
||||||
|
|
||||||
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 HLK-SW16 platform."""
|
"""Set up the HLK-SW16 platform."""
|
||||||
async_add_entities(devices_from_entities(hass, entry))
|
async_add_entities(devices_from_entities(hass, entry))
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,10 @@ import logging
|
||||||
from homeconnect.api import HomeConnectError
|
from homeconnect.api import HomeConnectError
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_DEVICE, CONF_ENTITIES
|
from homeassistant.const import CONF_DEVICE, 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 switch."""
|
"""Set up the Home Connect switch."""
|
||||||
|
|
||||||
def get_entities():
|
def get_entities():
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
|
from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
|
||||||
from homeassistant.core import callback
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import dispatcher
|
from homeassistant.helpers import dispatcher
|
||||||
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 CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from .const import DISPATCHER_REMOVERS, DOMAIN, HW_TYPE, SIGNAL_ADD_ENTITIES
|
from .const import DISPATCHER_REMOVERS, DOMAIN, HW_TYPE, SIGNAL_ADD_ENTITIES
|
||||||
|
@ -26,7 +28,11 @@ def add_switch_entities(new_unique_ids, coordinator, add_entities):
|
||||||
add_entities(new_entities)
|
add_entities(new_entities)
|
||||||
|
|
||||||
|
|
||||||
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 Legrand Home+ Control Switch platform in HomeAssistant.
|
"""Set up the Legrand Home+ Control Switch platform in HomeAssistant.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|
|
@ -1,11 +1,21 @@
|
||||||
"""Support for HomeMatic switches."""
|
"""Support for HomeMatic switches."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from .const import ATTR_DISCOVER_DEVICES
|
from .const import ATTR_DISCOVER_DEVICES
|
||||||
from .entity import HMDevice
|
from .entity import HMDevice
|
||||||
|
|
||||||
|
|
||||||
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 HomeMatic switch platform."""
|
"""Set up the HomeMatic switch platform."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
|
|
|
@ -12,7 +12,10 @@ from homeassistant.components.switch import (
|
||||||
SwitchEntityDescription,
|
SwitchEntityDescription,
|
||||||
)
|
)
|
||||||
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 (
|
from . import (
|
||||||
ALLOWED_WATERING_TIME,
|
ALLOWED_WATERING_TIME,
|
||||||
|
@ -51,7 +54,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]
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
"""Support for IHC switches."""
|
"""Support for IHC switches."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
|
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_OFF_ID, CONF_ON_ID
|
from .const import CONF_OFF_ID, CONF_ON_ID
|
||||||
|
@ -7,7 +12,12 @@ from .ihcdevice import IHCDevice
|
||||||
from .util import async_pulse, async_set_bool
|
from .util import async_pulse, async_set_bool
|
||||||
|
|
||||||
|
|
||||||
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 switch platform."""
|
"""Set up the IHC switch platform."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,14 +1,20 @@
|
||||||
"""Support for INSTEON dimmers via PowerLinc Modem."""
|
"""Support for INSTEON dimmers via PowerLinc Modem."""
|
||||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN, SwitchEntity
|
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN, SwitchEntity
|
||||||
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
|
||||||
from .utils import async_add_insteon_entities
|
from .utils import async_add_insteon_entities
|
||||||
|
|
||||||
|
|
||||||
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 switches from a config entry."""
|
"""Set up the Insteon switches from a config entry."""
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
"""Support for monitoring juicenet/juicepoint/juicebox based EVSE switches."""
|
"""Support for monitoring juicenet/juicepoint/juicebox based EVSE switches."""
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import DOMAIN, JUICENET_API, JUICENET_COORDINATOR
|
from .const import DOMAIN, JUICENET_API, JUICENET_COORDINATOR
|
||||||
from .entity import JuiceNetDevice
|
from .entity import JuiceNetDevice
|
||||||
|
|
||||||
|
|
||||||
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 JuiceNet switches."""
|
"""Set up the JuiceNet switches."""
|
||||||
entities = []
|
entities = []
|
||||||
juicenet_data = hass.data[DOMAIN][config_entry.entry_id]
|
juicenet_data = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""Support for customised Kankun SP3 Wifi switch."""
|
"""Support for customised Kankun SP3 Wifi switch."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
@ -14,7 +16,10 @@ from homeassistant.const import (
|
||||||
CONF_SWITCHES,
|
CONF_SWITCHES,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
)
|
)
|
||||||
|
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
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -37,7 +42,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities_callback, discovery_info=None):
|
def setup_platform(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
add_entities_callback: AddEntitiesCallback,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> None:
|
||||||
"""Set up Kankun Wifi switches."""
|
"""Set up Kankun Wifi switches."""
|
||||||
switches = config.get("switches", {})
|
switches = config.get("switches", {})
|
||||||
devices = []
|
devices = []
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
"""KMtronic Switch integration."""
|
"""KMtronic Switch integration."""
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
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 CONF_REVERSE, DATA_COORDINATOR, DATA_HUB, DOMAIN
|
from .const import CONF_REVERSE, DATA_COORDINATOR, DATA_HUB, 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:
|
||||||
"""Config entry example."""
|
"""Config entry example."""
|
||||||
coordinator = hass.data[DOMAIN][entry.entry_id][DATA_COORDINATOR]
|
coordinator = hass.data[DOMAIN][entry.entry_id][DATA_COORDINATOR]
|
||||||
hub = hass.data[DOMAIN][entry.entry_id][DATA_HUB]
|
hub = hass.data[DOMAIN][entry.entry_id][DATA_HUB]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Support for wired switches attached to a Konnected device."""
|
"""Support for wired switches attached to a Konnected device."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_STATE,
|
ATTR_STATE,
|
||||||
CONF_DEVICES,
|
CONF_DEVICES,
|
||||||
|
@ -9,9 +10,10 @@ from homeassistant.const import (
|
||||||
CONF_SWITCHES,
|
CONF_SWITCHES,
|
||||||
CONF_ZONE,
|
CONF_ZONE,
|
||||||
)
|
)
|
||||||
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, ToggleEntity
|
from homeassistant.helpers.entity import DeviceInfo, ToggleEntity
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_ACTIVATION,
|
CONF_ACTIVATION,
|
||||||
|
@ -25,7 +27,11 @@ from .const 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 switches attached to a Konnected device from a config entry."""
|
"""Set up switches 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"]
|
||||||
|
|
|
@ -1,11 +1,21 @@
|
||||||
"""Support for LightwaveRF switches."""
|
"""Support for LightwaveRF switches."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import LIGHTWAVE_LINK
|
from . import LIGHTWAVE_LINK
|
||||||
|
|
||||||
|
|
||||||
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:
|
||||||
"""Find and return LightWave switches."""
|
"""Find and return LightWave switches."""
|
||||||
if not discovery_info:
|
if not discovery_info:
|
||||||
return
|
return
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
|
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
|
||||||
|
|
||||||
|
@ -10,7 +13,11 @@ ATTR_NUMBER = "number"
|
||||||
_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 entry."""
|
"""Set up entry."""
|
||||||
|
|
||||||
system = hass.data[DOMAIN]
|
system = hass.data[DOMAIN]
|
||||||
|
|
|
@ -1,17 +1,27 @@
|
||||||
"""Support for Lupusec Security System switches."""
|
"""Support for Lupusec Security System switches."""
|
||||||
|
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.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
|
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 Lupusec switch devices."""
|
"""Set up Lupusec switch devices."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,10 +1,20 @@
|
||||||
"""Support for Lutron switches."""
|
"""Support for Lutron switches."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
|
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 switches."""
|
"""Set up the Lutron switches."""
|
||||||
devs = []
|
devs = []
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.switch import DOMAIN, SwitchEntity
|
from homeassistant.components.switch import DOMAIN, SwitchEntity
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import LutronCasetaDevice
|
from . import LutronCasetaDevice
|
||||||
from .const import BRIDGE_DEVICE, BRIDGE_LEAP, DOMAIN as CASETA_DOMAIN
|
from .const import BRIDGE_DEVICE, BRIDGE_LEAP, DOMAIN as CASETA_DOMAIN
|
||||||
|
@ -9,7 +12,11 @@ from .const import BRIDGE_DEVICE, BRIDGE_LEAP, DOMAIN as CASETA_DOMAIN
|
||||||
_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 Lutron Caseta switch platform.
|
"""Set up the Lutron Caseta switch platform.
|
||||||
|
|
||||||
Adds switches from the Caseta bridge associated with the config_entry as
|
Adds switches from the Caseta bridge associated with the config_entry as
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""Support for myStrom switches/plugs."""
|
"""Support for myStrom switches/plugs."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pymystrom.exceptions import MyStromConnectionError
|
from pymystrom.exceptions import MyStromConnectionError
|
||||||
|
@ -7,8 +9,11 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME
|
from homeassistant.const import CONF_HOST, CONF_NAME
|
||||||
|
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
|
||||||
|
|
||||||
DEFAULT_NAME = "myStrom Switch"
|
DEFAULT_NAME = "myStrom Switch"
|
||||||
|
|
||||||
|
@ -22,7 +27,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 myStrom switch/plug integration."""
|
"""Set up the myStrom switch/plug integration."""
|
||||||
name = config.get(CONF_NAME)
|
name = config.get(CONF_NAME)
|
||||||
host = config.get(CONF_HOST)
|
host = config.get(CONF_HOST)
|
||||||
|
|
Loading…
Add table
Reference in a new issue