mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add switch setup type hints [n-r] (#63304)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
f39531dcfc
commit
e4a88e921f
@ -1,4 +1,6 @@
|
|||||||
"""Switch platform integration for Numato USB GPIO expanders."""
|
"""Switch platform integration for Numato USB GPIO expanders."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from numato_gpio import NumatoGpioError
|
from numato_gpio import NumatoGpioError
|
||||||
@ -9,14 +11,22 @@ from homeassistant.const import (
|
|||||||
CONF_SWITCHES,
|
CONF_SWITCHES,
|
||||||
DEVICE_DEFAULT_NAME,
|
DEVICE_DEFAULT_NAME,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import ToggleEntity
|
from homeassistant.helpers.entity import ToggleEntity
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import CONF_INVERT_LOGIC, CONF_PORTS, DATA_API, DOMAIN
|
from . import CONF_INVERT_LOGIC, CONF_PORTS, DATA_API, DOMAIN
|
||||||
|
|
||||||
_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 configured Numato USB GPIO switch ports."""
|
"""Set up the configured Numato USB GPIO switch ports."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
|
@ -5,7 +5,10 @@ from omnilogic import OmniLogicException
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
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 import config_validation as cv, entity_platform
|
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .common import OmniLogicEntity, OmniLogicUpdateCoordinator, check_guard
|
from .common import OmniLogicEntity, OmniLogicUpdateCoordinator, check_guard
|
||||||
from .const import COORDINATOR, DOMAIN, PUMP_TYPES
|
from .const import COORDINATOR, DOMAIN, PUMP_TYPES
|
||||||
@ -14,7 +17,9 @@ SERVICE_SET_SPEED = "set_pump_speed"
|
|||||||
OMNILOGIC_SWITCH_OFF = 7
|
OMNILOGIC_SWITCH_OFF = 7
|
||||||
|
|
||||||
|
|
||||||
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 light platform."""
|
"""Set up the light platform."""
|
||||||
|
|
||||||
coordinator = hass.data[DOMAIN][entry.entry_id][COORDINATOR]
|
coordinator = hass.data[DOMAIN][entry.entry_id][COORDINATOR]
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for Orvibo S20 Wifi Smart Switches."""
|
"""Support for Orvibo S20 Wifi Smart Switches."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from orvibo.s20 import S20, S20Exception, discover
|
from orvibo.s20 import S20, S20Exception, discover
|
||||||
@ -12,7 +14,10 @@ from homeassistant.const import (
|
|||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_SWITCHES,
|
CONF_SWITCHES,
|
||||||
)
|
)
|
||||||
|
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__)
|
||||||
|
|
||||||
@ -36,7 +41,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 S20 switches."""
|
"""Set up S20 switches."""
|
||||||
|
|
||||||
switch_data = {}
|
switch_data = {}
|
||||||
|
@ -1,13 +1,19 @@
|
|||||||
"""Representation of Z-Wave switches."""
|
"""Representation of Z-Wave switches."""
|
||||||
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 DATA_UNSUBSCRIBE, DOMAIN
|
from .const import DATA_UNSUBSCRIBE, DOMAIN
|
||||||
from .entity import ZWaveDeviceEntity
|
from .entity import ZWaveDeviceEntity
|
||||||
|
|
||||||
|
|
||||||
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 switch from config entry."""
|
"""Set up Z-Wave switch from config entry."""
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for switch sensor using I2C PCAL9535A chip."""
|
"""Support for switch 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.switch import PLATFORM_SCHEMA, SwitchEntity
|
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||||
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"
|
||||||
@ -41,7 +46,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 devices."""
|
"""Set up the PCAL9535A devices."""
|
||||||
_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 @@
|
|||||||
"""Pencom relay control."""
|
"""Pencom relay control."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pencompy.pencompy import Pencompy
|
from pencompy.pencompy import Pencompy
|
||||||
@ -6,8 +8,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, CONF_PORT
|
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT
|
||||||
|
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
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -34,7 +39,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:
|
||||||
"""Pencom relay platform (pencompy)."""
|
"""Pencom relay platform (pencompy)."""
|
||||||
|
|
||||||
# Assign configuration variables.
|
# Assign configuration variables.
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
"""Plugwise Switch component for HomeAssistant."""
|
"""Plugwise Switch component for HomeAssistant."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from plugwise.exceptions import PlugwiseException
|
from plugwise.exceptions import PlugwiseException
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
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 COORDINATOR, DOMAIN, SWITCH_ICON
|
from .const import COORDINATOR, DOMAIN, SWITCH_ICON
|
||||||
from .gateway import SmileGateway
|
from .gateway import SmileGateway
|
||||||
@ -13,7 +14,11 @@ from .gateway import SmileGateway
|
|||||||
_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 switches from a config entry."""
|
"""Set up the Smile switches from a config entry."""
|
||||||
# PLACEHOLDER USB entry setup
|
# PLACEHOLDER USB entry setup
|
||||||
return await async_setup_entry_gateway(hass, config_entry, async_add_entities)
|
return await async_setup_entry_gateway(hass, config_entry, async_add_entities)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Control switches."""
|
"""Control switches."""
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -7,6 +6,9 @@ from ProgettiHWSW.relay import Relay
|
|||||||
import async_timeout
|
import async_timeout
|
||||||
|
|
||||||
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 (
|
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 switches from a config entry."""
|
"""Set up the switches from a config entry."""
|
||||||
board_api = hass.data[DOMAIN][config_entry.entry_id]
|
board_api = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
relay_count = config_entry.data["relay_count"]
|
relay_count = config_entry.data["relay_count"]
|
||||||
|
@ -1,10 +1,20 @@
|
|||||||
"""Support for Qwikswitch relays."""
|
"""Support for Qwikswitch relays."""
|
||||||
|
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 DOMAIN as QWIKSWITCH, QSToggleEntity
|
from . import DOMAIN as QWIKSWITCH, QSToggleEntity
|
||||||
|
|
||||||
|
|
||||||
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 switches from the main Qwikswitch component."""
|
"""Add switches from the main Qwikswitch component."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
|
@ -7,11 +7,13 @@ import logging
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_ID
|
from homeassistant.const import ATTR_ENTITY_ID, ATTR_ID
|
||||||
from homeassistant.core import ServiceCall, callback
|
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||||
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.event import async_track_point_in_utc_time
|
from homeassistant.helpers.event import async_track_point_in_utc_time
|
||||||
from homeassistant.util.dt import as_timestamp, now, parse_datetime, utc_from_timestamp
|
from homeassistant.util.dt import as_timestamp, now, parse_datetime, utc_from_timestamp
|
||||||
|
|
||||||
@ -88,7 +90,11 @@ START_MULTIPLE_ZONES_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
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 switches."""
|
"""Set up the Rachio switches."""
|
||||||
zone_entities = []
|
zone_entities = []
|
||||||
has_flex_sched = False
|
has_flex_sched = False
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
"""Support for Rain Bird Irrigation system LNK WiFi Module."""
|
"""Support for Rain Bird Irrigation system LNK WiFi Module."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from pyrainbird import AvailableStations, RainbirdController
|
from pyrainbird import AvailableStations, RainbirdController
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
from homeassistant.const import ATTR_ENTITY_ID, CONF_FRIENDLY_NAME, CONF_TRIGGER_TIME
|
from homeassistant.const import ATTR_ENTITY_ID, CONF_FRIENDLY_NAME, CONF_TRIGGER_TIME
|
||||||
from homeassistant.core import ServiceCall
|
from homeassistant.core import HomeAssistant, ServiceCall
|
||||||
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.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import CONF_ZONES, DATA_RAINBIRD, DOMAIN, RAINBIRD_CONTROLLER
|
from . import CONF_ZONES, DATA_RAINBIRD, DOMAIN, RAINBIRD_CONTROLLER
|
||||||
|
|
||||||
@ -28,7 +32,12 @@ SERVICE_SCHEMA_RAIN_DELAY = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
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 Rain Bird switches over a Rain Bird controller."""
|
"""Set up Rain Bird switches over a Rain Bird controller."""
|
||||||
|
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for switches that can be controlled using the RaspyRFM rc module."""
|
"""Support for switches that can be controlled using the RaspyRFM rc module."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from raspyrfm_client import RaspyRFMClient
|
from raspyrfm_client import RaspyRFMClient
|
||||||
from raspyrfm_client.device_implementations.controlunit.actions import Action
|
from raspyrfm_client.device_implementations.controlunit.actions import Action
|
||||||
from raspyrfm_client.device_implementations.controlunit.controlunit_constants import (
|
from raspyrfm_client.device_implementations.controlunit.controlunit_constants import (
|
||||||
@ -18,7 +20,10 @@ from homeassistant.const import (
|
|||||||
CONF_SWITCHES,
|
CONF_SWITCHES,
|
||||||
DEVICE_DEFAULT_NAME,
|
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_GATEWAY_MANUFACTURER = "gateway_manufacturer"
|
CONF_GATEWAY_MANUFACTURER = "gateway_manufacturer"
|
||||||
CONF_GATEWAY_MODEL = "gateway_model"
|
CONF_GATEWAY_MODEL = "gateway_model"
|
||||||
@ -49,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 the RaspyRFM switch."""
|
"""Set up the RaspyRFM switch."""
|
||||||
|
|
||||||
gateway_manufacturer = config.get(
|
gateway_manufacturer = config.get(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
"""Support for Ankuoo RecSwitch MS6126 devices."""
|
"""Support for Ankuoo RecSwitch MS6126 devices."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -7,7 +8,10 @@ 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_MAC, CONF_NAME
|
from homeassistant.const import CONF_HOST, CONF_MAC, 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
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -24,7 +28,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 device."""
|
"""Set up the device."""
|
||||||
|
|
||||||
host = config[CONF_HOST]
|
host = config[CONF_HOST]
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
"""Allows to configure a switch using RPi GPIO."""
|
"""Allows to configure a switch using RPi GPIO."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import voluptuous as vol
|
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, DEVICE_DEFAULT_NAME
|
from homeassistant.const import CONF_HOST, 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
|
||||||
|
|
||||||
from . import CONF_INVERT_LOGIC, DEFAULT_INVERT_LOGIC
|
from . import CONF_INVERT_LOGIC, DEFAULT_INVERT_LOGIC
|
||||||
from .. import remote_rpi_gpio
|
from .. import remote_rpi_gpio
|
||||||
@ -21,7 +26,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 Remote Raspberry PI GPIO devices."""
|
"""Set up the Remote Raspberry PI GPIO devices."""
|
||||||
address = config[CONF_HOST]
|
address = config[CONF_HOST]
|
||||||
invert_logic = config[CONF_INVERT_LOGIC]
|
invert_logic = config[CONF_INVERT_LOGIC]
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
"""Support for Rflink switches."""
|
"""Support for Rflink switches."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import voluptuous as vol
|
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_DEVICES, CONF_NAME
|
from homeassistant.const import CONF_DEVICES, 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
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
CONF_ALIASES,
|
CONF_ALIASES,
|
||||||
@ -59,7 +64,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))
|
||||||
|
|
||||||
|
@ -5,7 +5,9 @@ import logging
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
from homeassistant.core import callback
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
from . import DOMAIN
|
from . import DOMAIN
|
||||||
@ -24,7 +26,11 @@ SIREN_ICON = "mdi:alarm-bell"
|
|||||||
SKIP_UPDATES_DELAY = timedelta(seconds=5)
|
SKIP_UPDATES_DELAY = timedelta(seconds=5)
|
||||||
|
|
||||||
|
|
||||||
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:
|
||||||
"""Create the switches for the Ring devices."""
|
"""Create the switches for the Ring devices."""
|
||||||
devices = hass.data[DOMAIN][config_entry.entry_id]["devices"]
|
devices = hass.data[DOMAIN][config_entry.entry_id]["devices"]
|
||||||
switches = []
|
switches = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user