Add climate setup type hints [m-z] (#63279)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2022-01-03 13:09:43 +01:00 committed by GitHub
parent 39df04495d
commit 6f4b25950c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 223 additions and 32 deletions

View file

@ -28,6 +28,9 @@ from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import DATA_KEY from . import DATA_KEY
@ -50,7 +53,12 @@ MAX_TEMPERATURE = 30.0
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
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:
"""Iterate through all MAX! Devices and add thermostats.""" """Iterate through all MAX! Devices and add thermostats."""
devices = [] devices = []
for handler in hass.data[DATA_KEY].values(): for handler in hass.data[DATA_KEY].values():

View file

@ -1,4 +1,6 @@
"""Support for Melissa Climate A/C.""" """Support for Melissa Climate A/C."""
from __future__ import annotations
import logging import logging
from homeassistant.components.climate import ClimateEntity from homeassistant.components.climate import ClimateEntity
@ -17,6 +19,9 @@ from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_WHOLE, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, PRECISION_WHOLE, TEMP_CELSIUS
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import DATA_MELISSA from . import DATA_MELISSA
@ -35,7 +40,12 @@ OP_MODES = [
FAN_MODES = [FAN_AUTO, FAN_HIGH, FAN_MEDIUM, FAN_LOW] FAN_MODES = [FAN_AUTO, FAN_HIGH, FAN_MEDIUM, FAN_LOW]
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:
"""Iterate through and add all Melissa devices.""" """Iterate through and add all Melissa devices."""
api = hass.data[DATA_MELISSA] api = hass.data[DATA_MELISSA]
devices = (await api.async_fetch_devices()).values() devices = (await api.async_fetch_devices()).values()

View file

@ -12,6 +12,7 @@ from homeassistant.components.climate.const import (
SUPPORT_FAN_MODE, SUPPORT_FAN_MODE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ( from homeassistant.const import (
ATTR_TEMPERATURE, ATTR_TEMPERATURE,
CONF_IP_ADDRESS, CONF_IP_ADDRESS,
@ -19,10 +20,11 @@ from homeassistant.const import (
PRECISION_WHOLE, PRECISION_WHOLE,
TEMP_CELSIUS, TEMP_CELSIUS,
) )
from homeassistant.core import ServiceCall, callback from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
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 ( from .const import (
@ -50,7 +52,9 @@ SET_ROOM_TEMP_SCHEMA = vol.Schema(
) )
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 Mill climate.""" """Set up the Mill climate."""
if entry.data.get(CONNECTION_TYPE) == LOCAL: if entry.data.get(CONNECTION_TYPE) == LOCAL:
mill_data_coordinator = hass.data[DOMAIN][LOCAL][entry.data[CONF_IP_ADDRESS]] mill_data_coordinator = hass.data[DOMAIN][LOCAL][entry.data[CONF_IP_ADDRESS]]

View file

@ -38,10 +38,13 @@ from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_RANGE, SUPPORT_TARGET_TEMPERATURE_RANGE,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_platform from homeassistant.helpers import entity_platform
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.dispatcher import dispatcher_send from homeassistant.helpers.dispatcher import dispatcher_send
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import ( from .const import (
ATTR_AIRCLEANER_MODE, ATTR_AIRCLEANER_MODE,
@ -106,7 +109,11 @@ NEXIA_TO_HA_HVAC_MODE_MAP = {
} }
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 climate for a Nexia device.""" """Set up climate for a Nexia device."""
coordinator: NexiaDataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id] coordinator: NexiaDataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]
nexia_home = coordinator.nexia_home nexia_home = coordinator.nexia_home

View file

@ -21,10 +21,12 @@ from homeassistant.components.climate.const import (
SUPPORT_PRESET_MODE, SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import event as event_helper from homeassistant.helpers import event as event_helper
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 ( from .const import (
@ -64,7 +66,11 @@ SCHEDULE_MODE_TO_PRESET_MODE_MAP = {
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
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 NuHeat thermostat(s).""" """Set up the NuHeat thermostat(s)."""
thermostat, coordinator = hass.data[DOMAIN][config_entry.entry_id] thermostat, coordinator = hass.data[DOMAIN][config_entry.entry_id]

View file

@ -15,6 +15,7 @@ from homeassistant.components.climate.const import (
SUPPORT_PRESET_MODE, SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ( from homeassistant.const import (
ATTR_TEMPERATURE, ATTR_TEMPERATURE,
CONF_ID, CONF_ID,
@ -23,9 +24,10 @@ from homeassistant.const import (
PRECISION_WHOLE, PRECISION_WHOLE,
TEMP_CELSIUS, TEMP_CELSIUS,
) )
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, async_generate_entity_id from homeassistant.helpers.entity import DeviceInfo, async_generate_entity_id
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import DOMAIN from . import DOMAIN
from .const import ( from .const import (
@ -44,7 +46,11 @@ DEFAULT_FLOOR_TEMP = False
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
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 an OpenTherm Gateway climate entity.""" """Set up an OpenTherm Gateway climate entity."""
ents = [] ents = []
ents.append( ents.append(

View file

@ -26,9 +26,11 @@ from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_RANGE, SUPPORT_TARGET_TEMPERATURE_RANGE,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DATA_UNSUBSCRIBE, DOMAIN from .const import DATA_UNSUBSCRIBE, DOMAIN
from .entity import ZWaveDeviceEntity from .entity import ZWaveDeviceEntity
@ -140,7 +142,11 @@ HVAC_MODE_ZW_MAPPINGS = {
} }
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 Climate from Config Entry.""" """Set up Z-Wave Climate from Config Entry."""
@callback @callback

View file

@ -1,5 +1,4 @@
"""Plugwise Climate component for Home Assistant.""" """Plugwise Climate component for Home Assistant."""
import logging import logging
from plugwise.exceptions import PlugwiseException from plugwise.exceptions import PlugwiseException
@ -15,8 +14,10 @@ from homeassistant.components.climate.const import (
SUPPORT_PRESET_MODE, SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import ( from .const import (
COORDINATOR, COORDINATOR,
@ -36,7 +37,11 @@ SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
_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 Thermostats from a config entry.""" """Set up the Smile Thermostats 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]

View file

@ -1,4 +1,6 @@
"""Support for Proliphix NT10e Thermostats.""" """Support for Proliphix NT10e Thermostats."""
from __future__ import annotations
import proliphix import proliphix
import voluptuous as vol import voluptuous as vol
@ -21,7 +23,10 @@ from homeassistant.const import (
PRECISION_TENTHS, PRECISION_TENTHS,
TEMP_FAHRENHEIT, TEMP_FAHRENHEIT,
) )
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
ATTR_FAN = "fan" ATTR_FAN = "fan"
@ -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:
"""Set up the Proliphix thermostats.""" """Set up the Proliphix thermostats."""
username = config.get(CONF_USERNAME) username = config.get(CONF_USERNAME)
password = config.get(CONF_PASSWORD) password = config.get(CONF_PASSWORD)

View file

@ -1,4 +1,6 @@
"""Support for Radio Thermostat wifi-enabled home thermostats.""" """Support for Radio Thermostat wifi-enabled home thermostats."""
from __future__ import annotations
import logging import logging
from socket import timeout from socket import timeout
@ -29,7 +31,10 @@ from homeassistant.const import (
STATE_ON, STATE_ON,
TEMP_FAHRENHEIT, TEMP_FAHRENHEIT,
) )
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 homeassistant.util import dt as dt_util from homeassistant.util import dt as dt_util
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -103,7 +108,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE | SUPPORT_PRESET_MODE SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE | SUPPORT_PRESET_MODE
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 Radio Thermostat.""" """Set up the Radio Thermostat."""
hosts = [] hosts = []
if CONF_HOST in config: if CONF_HOST in config:

View file

@ -1,4 +1,6 @@
"""Support for Schluter thermostats.""" """Support for Schluter thermostats."""
from __future__ import annotations
import logging import logging
from requests import RequestException from requests import RequestException
@ -17,6 +19,9 @@ from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.const import ATTR_TEMPERATURE, CONF_SCAN_INTERVAL from homeassistant.const import ATTR_TEMPERATURE, CONF_SCAN_INTERVAL
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 ( from homeassistant.helpers.update_coordinator import (
CoordinatorEntity, CoordinatorEntity,
DataUpdateCoordinator, DataUpdateCoordinator,
@ -31,7 +36,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 Schluter thermostats.""" """Set up the Schluter thermostats."""
if discovery_info is None: if discovery_info is None:
return return

View file

@ -14,8 +14,11 @@ from homeassistant.components.climate.const import (
SUPPORT_PRESET_MODE, SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.restore_state import RestoreEntity from homeassistant.helpers.restore_state import RestoreEntity
from . import ScreenlogicEntity from . import ScreenlogicEntity
@ -34,7 +37,11 @@ SUPPORTED_PRESETS = [
] ]
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."""
entities = [] entities = []
coordinator = hass.data[DOMAIN][config_entry.entry_id] coordinator = hass.data[DOMAIN][config_entry.entry_id]

View file

@ -27,7 +27,10 @@ from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_RANGE, SUPPORT_TARGET_TEMPERATURE_RANGE,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import SmartThingsEntity from . import SmartThingsEntity
from .const import DATA_BROKERS, DOMAIN from .const import DATA_BROKERS, DOMAIN
@ -82,7 +85,11 @@ UNIT_MAP = {"C": TEMP_CELSIUS, "F": TEMP_FAHRENHEIT}
_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:
"""Add climate entities for a config entry.""" """Add climate entities for a config entry."""
ac_capabilities = [ ac_capabilities = [
Capability.air_conditioner_mode, Capability.air_conditioner_mode,

View file

@ -11,7 +11,10 @@ from homeassistant.components.climate.const import (
SUPPORT_PRESET_MODE, SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.util.temperature import convert as convert_temperature from homeassistant.util.temperature import convert as convert_temperature
from .const import DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP, DOMAIN, SMARTTUB_CONTROLLER from .const import DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP, DOMAIN, SMARTTUB_CONTROLLER
@ -33,7 +36,9 @@ HVAC_ACTIONS = {
} }
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 climate entity for the thermostat in the tub.""" """Set up climate entity for the thermostat in the tub."""
controller = hass.data[DOMAIN][entry.entry_id][SMARTTUB_CONTROLLER] controller = hass.data[DOMAIN][entry.entry_id][SMARTTUB_CONTROLLER]

View file

@ -21,7 +21,10 @@ from homeassistant.components.climate.const import (
SUPPORT_PRESET_MODE, SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import COORDINATOR, DOMAIN from .const import COORDINATOR, DOMAIN
from .entity import SomfyEntity from .entity import SomfyEntity
@ -45,7 +48,11 @@ REVERSE_PRESET_MAPPING = {v: k for k, v in PRESETS_MAPPING.items()}
HVAC_MODES_MAPPING = {HvacState.COOL: HVAC_MODE_COOL, HvacState.HEAT: HVAC_MODE_HEAT} HVAC_MODES_MAPPING = {HvacState.COOL: HVAC_MODE_COOL, HvacState.HEAT: HVAC_MODE_HEAT}
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 Somfy climate platform.""" """Set up the Somfy climate platform."""
domain_data = hass.data[DOMAIN] domain_data = hass.data[DOMAIN]
coordinator = domain_data[COORDINATOR] coordinator = domain_data[COORDINATOR]

View file

@ -7,8 +7,11 @@ from homeassistant.components.climate.const import (
SUPPORT_FAN_MODE, SUPPORT_FAN_MODE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
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 .const import DOMAIN from .const import DOMAIN
@ -21,7 +24,9 @@ HA_STATE_TO_SPIDER = {
SPIDER_STATE_TO_HA = {value: key for key, value in HA_STATE_TO_SPIDER.items()} SPIDER_STATE_TO_HA = {value: key for key, value in HA_STATE_TO_SPIDER.items()}
async def async_setup_entry(hass, config, async_add_entities): async def async_setup_entry(
hass: HomeAssistant, config: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
"""Initialize a Spider thermostat.""" """Initialize a Spider thermostat."""
api = hass.data[DOMAIN][config.entry_id] api = hass.data[DOMAIN][config.entry_id]

View file

@ -1,4 +1,6 @@
"""Support for stiebel_eltron climate platform.""" """Support for stiebel_eltron climate platform."""
from __future__ import annotations
import logging import logging
from homeassistant.components.climate import ClimateEntity from homeassistant.components.climate import ClimateEntity
@ -11,6 +13,9 @@ from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import DOMAIN as STE_DOMAIN from . import DOMAIN as STE_DOMAIN
@ -53,7 +58,12 @@ HA_TO_STE_HVAC = {
HA_TO_STE_PRESET = {k: i for i, k in STE_TO_HA_PRESET.items()} HA_TO_STE_PRESET = {k: i for i, k in STE_TO_HA_PRESET.items()}
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 StiebelEltron platform.""" """Set up the StiebelEltron platform."""
name = hass.data[STE_DOMAIN]["name"] name = hass.data[STE_DOMAIN]["name"]
ste_data = hass.data[STE_DOMAIN]["ste_data"] ste_data = hass.data[STE_DOMAIN]["ste_data"]

View file

@ -1,4 +1,6 @@
"""Climate platform that offers a climate device for the TFIAC protocol.""" """Climate platform that offers a climate device for the TFIAC protocol."""
from __future__ import annotations
from concurrent import futures from concurrent import futures
from datetime import timedelta from datetime import timedelta
import logging import logging
@ -27,7 +29,10 @@ from homeassistant.components.climate.const import (
SWING_VERTICAL, SWING_VERTICAL,
) )
from homeassistant.const import ATTR_TEMPERATURE, CONF_HOST, TEMP_FAHRENHEIT from homeassistant.const import ATTR_TEMPERATURE, CONF_HOST, TEMP_FAHRENHEIT
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
SCAN_INTERVAL = timedelta(seconds=60) SCAN_INTERVAL = timedelta(seconds=60)
@ -62,7 +67,12 @@ SWING_MODE = "swing_mode"
ON_MODE = "is_on" ON_MODE = "is_on"
async def async_setup_platform(hass, config, async_add_devices, discovery_info=None): async def async_setup_platform(
hass: HomeAssistant,
config: ConfigType,
async_add_devices: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up the TFIAC climate device.""" """Set up the TFIAC climate device."""
tfiac_client = Tfiac(config[CONF_HOST]) tfiac_client = Tfiac(config[CONF_HOST])
try: try:

View file

@ -1,4 +1,6 @@
"""Platform for Roth Touchline floor heating controller.""" """Platform for Roth Touchline floor heating controller."""
from __future__ import annotations
from typing import NamedTuple from typing import NamedTuple
from pytouchline import PyTouchline from pytouchline import PyTouchline
@ -11,7 +13,10 @@ from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.const import ATTR_TEMPERATURE, CONF_HOST, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, CONF_HOST, TEMP_CELSIUS
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
class PresetMode(NamedTuple): class PresetMode(NamedTuple):
@ -40,7 +45,12 @@ SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_HOST): cv.string}) PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_HOST): cv.string})
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 Touchline devices.""" """Set up the Touchline devices."""
host = config[CONF_HOST] host = config[CONF_HOST]

View file

@ -1,4 +1,6 @@
"""Support for Venstar WiFi Thermostats.""" """Support for Venstar WiFi Thermostats."""
from __future__ import annotations
import voluptuous as vol import voluptuous as vol
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity
@ -41,6 +43,7 @@ from homeassistant.const import (
from homeassistant.core import HomeAssistant 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.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import VenstarDataUpdateCoordinator, VenstarEntity from . import VenstarDataUpdateCoordinator, VenstarEntity
from .const import ( from .const import (
@ -87,7 +90,12 @@ async def async_setup_entry(
) )
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 the Venstar thermostat platform. """Set up the Venstar thermostat platform.
Venstar uses config flow for configuration now. If an entry exists in Venstar uses config flow for configuration now. If an entry exists in

View file

@ -22,14 +22,17 @@ from homeassistant.components.climate.const import (
SUPPORT_PRESET_MODE, SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
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 import entity_platform from homeassistant.helpers import entity_platform
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import ( from .const import (
CONF_HEATING_TYPE, CONF_HEATING_TYPE,
@ -103,7 +106,11 @@ def _build_entity(name, vicare_api, circuit, device_config, heating_type):
return ViCareClimate(name, vicare_api, device_config, circuit, heating_type) return ViCareClimate(name, vicare_api, device_config, circuit, 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]

View file

@ -23,7 +23,10 @@ from homeassistant.components.climate.const import (
SWING_HORIZONTAL, SWING_HORIZONTAL,
SWING_OFF, SWING_OFF,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import AUTH_INSTANCE_KEY, DOMAIN from .const import AUTH_INSTANCE_KEY, DOMAIN
@ -61,7 +64,11 @@ SUPPORTED_SWING_MODES = [SWING_HORIZONTAL, SWING_OFF]
SUPPORTED_TARGET_TEMPERATURE_STEP = 1 SUPPORTED_TARGET_TEMPERATURE_STEP = 1
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."""
auth: Auth = hass.data[DOMAIN][config_entry.entry_id][AUTH_INSTANCE_KEY] auth: Auth = hass.data[DOMAIN][config_entry.entry_id][AUTH_INSTANCE_KEY]
if not (said_list := auth.get_said_list()): if not (said_list := auth.get_said_list()):

View file

@ -1,4 +1,6 @@
"""Support for XS1 climate devices.""" """Support for XS1 climate devices."""
from __future__ import annotations
from xs1_api_client.api_constants import ActuatorType from xs1_api_client.api_constants import ActuatorType
from homeassistant.components.climate import ClimateEntity from homeassistant.components.climate import ClimateEntity
@ -7,6 +9,9 @@ from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.const import ATTR_TEMPERATURE from homeassistant.const import ATTR_TEMPERATURE
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import ACTUATORS, DOMAIN as COMPONENT_DOMAIN, SENSORS, XS1DeviceEntity from . import ACTUATORS, DOMAIN as COMPONENT_DOMAIN, SENSORS, XS1DeviceEntity
@ -16,7 +21,12 @@ MAX_TEMP = 25
SUPPORT_HVAC = [HVAC_MODE_HEAT] SUPPORT_HVAC = [HVAC_MODE_HEAT]
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 XS1 thermostat platform.""" """Set up the XS1 thermostat platform."""
actuators = hass.data[COMPONENT_DOMAIN][ACTUATORS] actuators = hass.data[COMPONENT_DOMAIN][ACTUATORS]
sensors = hass.data[COMPONENT_DOMAIN][SENSORS] sensors = hass.data[COMPONENT_DOMAIN][SENSORS]

View file

@ -1,4 +1,6 @@
"""Support for ZhongHong HVAC Controller.""" """Support for ZhongHong HVAC Controller."""
from __future__ import annotations
import logging import logging
import voluptuous as vol import voluptuous as vol
@ -23,11 +25,14 @@ from homeassistant.const import (
EVENT_HOMEASSISTANT_STOP, EVENT_HOMEASSISTANT_STOP,
TEMP_CELSIUS, TEMP_CELSIUS,
) )
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.dispatcher import ( from homeassistant.helpers.dispatcher import (
async_dispatcher_connect, async_dispatcher_connect,
async_dispatcher_send, async_dispatcher_send,
) )
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -71,7 +76,12 @@ MODE_TO_STATE = {
} }
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 ZhongHong HVAC platform.""" """Set up the ZhongHong HVAC platform."""
host = config.get(CONF_HOST) host = config.get(CONF_HOST)

View file

@ -31,9 +31,11 @@ from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_RANGE, SUPPORT_TARGET_TEMPERATURE_RANGE,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import ZWaveDeviceEntity, const from . import ZWaveDeviceEntity, const
@ -129,7 +131,11 @@ DEFAULT_HVAC_MODES = [
] ]
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 Climate device from Config Entry.""" """Set up Z-Wave Climate device from Config Entry."""
@callback @callback