mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Add setup type hints to select, vacuum and water_heater (#63300)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
9b5939a7a5
commit
3fe527422d
@ -5,7 +5,10 @@ from homeassistant.components.water_heater import (
|
|||||||
STATE_PERFORMANCE,
|
STATE_PERFORMANCE,
|
||||||
WaterHeaterEntity,
|
WaterHeaterEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import STATE_OFF, TEMP_CELSIUS, Platform
|
from homeassistant.const import STATE_OFF, TEMP_CELSIUS, Platform
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import DOMAIN, AtagEntity
|
from . import DOMAIN, AtagEntity
|
||||||
|
|
||||||
@ -13,7 +16,11 @@ SUPPORT_FLAGS_HEATER = 0
|
|||||||
OPERATION_LIST = [STATE_OFF, STATE_ECO, STATE_PERFORMANCE]
|
OPERATION_LIST = [STATE_OFF, STATE_ECO, STATE_PERFORMANCE]
|
||||||
|
|
||||||
|
|
||||||
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:
|
||||||
"""Initialize DHW device from config entry."""
|
"""Initialize DHW device from config entry."""
|
||||||
coordinator = hass.data[DOMAIN][config_entry.entry_id]
|
coordinator = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
async_add_entities([AtagWaterHeater(coordinator, Platform.WATER_HEATER)])
|
async_add_entities([AtagWaterHeater(coordinator, Platform.WATER_HEATER)])
|
||||||
|
@ -18,7 +18,9 @@ from homeassistant.components.water_heater import (
|
|||||||
SUPPORT_TARGET_TEMPERATURE,
|
SUPPORT_TARGET_TEMPERATURE,
|
||||||
WaterHeaterEntity,
|
WaterHeaterEntity,
|
||||||
)
|
)
|
||||||
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 EcoNetEntity
|
from . import EcoNetEntity
|
||||||
from .const import DOMAIN, EQUIPMENT
|
from .const import DOMAIN, EQUIPMENT
|
||||||
@ -39,7 +41,9 @@ HA_STATE_TO_ECONET = {value: key for key, value in ECONET_STATE_TO_HA.items()}
|
|||||||
SUPPORT_FLAGS_HEATER = SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE
|
SUPPORT_FLAGS_HEATER = SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE
|
||||||
|
|
||||||
|
|
||||||
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 EcoNet water heater based on a config entry."""
|
"""Set up EcoNet water heater based on a config entry."""
|
||||||
equipment = hass.data[DOMAIN][EQUIPMENT][entry.entry_id]
|
equipment = hass.data[DOMAIN][EQUIPMENT][entry.entry_id]
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
"""Support for Ecovacs Ecovacs Vaccums."""
|
"""Support for Ecovacs Ecovacs Vaccums."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import sucks
|
import sucks
|
||||||
@ -16,7 +18,10 @@ from homeassistant.components.vacuum import (
|
|||||||
SUPPORT_TURN_ON,
|
SUPPORT_TURN_ON,
|
||||||
VacuumEntity,
|
VacuumEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.icon import icon_for_battery_level
|
from homeassistant.helpers.icon import icon_for_battery_level
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import ECOVACS_DEVICES
|
from . import ECOVACS_DEVICES
|
||||||
|
|
||||||
@ -39,7 +44,12 @@ ATTR_ERROR = "error"
|
|||||||
ATTR_COMPONENT_PREFIX = "component_"
|
ATTR_COMPONENT_PREFIX = "component_"
|
||||||
|
|
||||||
|
|
||||||
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 Ecovacs vacuums."""
|
"""Set up the Ecovacs vacuums."""
|
||||||
vacuums = []
|
vacuums = []
|
||||||
for device in hass.data[ECOVACS_DEVICES]:
|
for device in hass.data[ECOVACS_DEVICES]:
|
||||||
|
@ -4,8 +4,10 @@ from __future__ import annotations
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.select import SelectEntity
|
from homeassistant.components.select import SelectEntity
|
||||||
|
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 ACTIVITY_POWER_OFF, DOMAIN, HARMONY_DATA
|
from .const import ACTIVITY_POWER_OFF, DOMAIN, HARMONY_DATA
|
||||||
from .data import HarmonyData
|
from .data import HarmonyData
|
||||||
@ -15,7 +17,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 activities select."""
|
"""Set up harmony activities select."""
|
||||||
data = hass.data[DOMAIN][entry.entry_id][HARMONY_DATA]
|
data = hass.data[DOMAIN][entry.entry_id][HARMONY_DATA]
|
||||||
_LOGGER.debug("creating select for %s hub activities", entry.data[CONF_NAME])
|
_LOGGER.debug("creating select for %s hub activities", entry.data[CONF_NAME])
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Support for hive water heaters."""
|
"""Support for hive water heaters."""
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -11,9 +10,12 @@ from homeassistant.components.water_heater import (
|
|||||||
SUPPORT_OPERATION_MODE,
|
SUPPORT_OPERATION_MODE,
|
||||||
WaterHeaterEntity,
|
WaterHeaterEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import TEMP_CELSIUS
|
from homeassistant.const import TEMP_CELSIUS
|
||||||
|
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 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 (
|
from .const import (
|
||||||
@ -43,7 +45,9 @@ HASS_TO_HIVE_STATE = {
|
|||||||
SUPPORT_WATER_HEATER = [STATE_ECO, STATE_ON, STATE_OFF]
|
SUPPORT_WATER_HEATER = [STATE_ECO, STATE_ON, STATE_OFF]
|
||||||
|
|
||||||
|
|
||||||
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]
|
||||||
|
@ -12,7 +12,10 @@ from homeassistant.components.water_heater import (
|
|||||||
WaterHeaterEntity,
|
WaterHeaterEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import TEMP_CELSIUS
|
from homeassistant.const import TEMP_CELSIUS
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import DOMAIN, IncomfortEntity
|
from . import DOMAIN, IncomfortEntity
|
||||||
|
|
||||||
@ -21,7 +24,12 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
HEATER_ATTRS = ["display_code", "display_text", "is_burning"]
|
HEATER_ATTRS = ["display_code", "display_text", "is_burning"]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
async def async_setup_platform(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
async_add_entities: AddEntitiesCallback,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> None:
|
||||||
"""Set up an InComfort/Intouch water_heater device."""
|
"""Set up an InComfort/Intouch water_heater device."""
|
||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
|
@ -23,7 +23,10 @@ from homeassistant.components.vacuum import (
|
|||||||
SUPPORT_STOP,
|
SUPPORT_STOP,
|
||||||
StateVacuumEntity,
|
StateVacuumEntity,
|
||||||
)
|
)
|
||||||
|
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 homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from .const import DOMAIN, SHARK
|
from .const import DOMAIN, SHARK
|
||||||
@ -67,7 +70,11 @@ ATTR_RECHARGE_RESUME = "recharge_and_resume"
|
|||||||
ATTR_RSSI = "rssi"
|
ATTR_RSSI = "rssi"
|
||||||
|
|
||||||
|
|
||||||
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 Shark IQ vacuum cleaner."""
|
"""Set up the Shark IQ vacuum cleaner."""
|
||||||
coordinator: SharkIqUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]
|
coordinator: SharkIqUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
devices: Iterable[SharkIqVacuum] = coordinator.shark_vacs.values()
|
devices: Iterable[SharkIqVacuum] = coordinator.shark_vacs.values()
|
||||||
|
@ -13,12 +13,15 @@ from homeassistant.components.water_heater import (
|
|||||||
SUPPORT_TARGET_TEMPERATURE,
|
SUPPORT_TARGET_TEMPERATURE,
|
||||||
WaterHeaterEntity,
|
WaterHeaterEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_TEMPERATURE,
|
ATTR_TEMPERATURE,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
PRECISION_WHOLE,
|
PRECISION_WHOLE,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_HEATING_TYPE,
|
CONF_HEATING_TYPE,
|
||||||
@ -70,7 +73,11 @@ def _build_entity(name, vicare_api, circuit, device_config, heating_type):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config_entry, async_add_devices):
|
async def async_setup_entry(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config_entry: ConfigEntry,
|
||||||
|
async_add_devices: AddEntitiesCallback,
|
||||||
|
) -> None:
|
||||||
"""Set up the ViCare climate platform."""
|
"""Set up the ViCare climate platform."""
|
||||||
name = config_entry.data[CONF_NAME]
|
name = config_entry.data[CONF_NAME]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user