diff --git a/homeassistant/components/homematic/climate.py b/homeassistant/components/homematic/climate.py index 6e16e16ba99..28943774b6c 100644 --- a/homeassistant/components/homematic/climate.py +++ b/homeassistant/components/homematic/climate.py @@ -63,6 +63,11 @@ class HMThermostat(HMDevice, ClimateEntity): | ClimateEntityFeature.TURN_ON ) _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_min_temp = 4.5 + _attr_max_temp = 30.5 + _attr_target_temperature_step = 0.5 + + _state: str @property def hvac_mode(self) -> HVACMode: @@ -93,7 +98,7 @@ class HMThermostat(HMDevice, ClimateEntity): return [HVACMode.HEAT, HVACMode.OFF] @property - def preset_mode(self): + def preset_mode(self) -> str: """Return the current preset mode, e.g., home, away, temp.""" if self._data.get("BOOST_MODE", False): return "boost" @@ -110,7 +115,7 @@ class HMThermostat(HMDevice, ClimateEntity): return mode @property - def preset_modes(self): + def preset_modes(self) -> list[str]: """Return a list of available preset modes.""" return [ HM_PRESET_MAP[mode] @@ -119,7 +124,7 @@ class HMThermostat(HMDevice, ClimateEntity): ] @property - def current_humidity(self): + def current_humidity(self) -> float | None: """Return the current humidity.""" for node in HM_HUMI_MAP: if node in self._data: @@ -127,7 +132,7 @@ class HMThermostat(HMDevice, ClimateEntity): return None @property - def current_temperature(self): + def current_temperature(self) -> float | None: """Return the current temperature.""" for node in HM_TEMP_MAP: if node in self._data: @@ -135,7 +140,7 @@ class HMThermostat(HMDevice, ClimateEntity): return None @property - def target_temperature(self): + def target_temperature(self) -> float | None: """Return the target temperature.""" return self._data.get(self._state) @@ -164,21 +169,6 @@ class HMThermostat(HMDevice, ClimateEntity): elif preset_mode == PRESET_ECO: self._hmdevice.MODE = self._hmdevice.LOWERING_MODE - @property - def min_temp(self): - """Return the minimum temperature.""" - return 4.5 - - @property - def max_temp(self): - """Return the maximum temperature.""" - return 30.5 - - @property - def target_temperature_step(self): - """Return the supported step of target temperature.""" - return 0.5 - @property def _hm_control_mode(self): """Return Control mode.""" diff --git a/homeassistant/components/homematic/const.py b/homeassistant/components/homematic/const.py index 91ef2e90242..484ab5ada2a 100644 --- a/homeassistant/components/homematic/const.py +++ b/homeassistant/components/homematic/const.py @@ -215,31 +215,31 @@ HM_IGNORE_DISCOVERY_NODE_EXCEPTIONS = { ] } -HM_ATTRIBUTE_SUPPORT = { - "LOWBAT": ["battery", {0: "High", 1: "Low"}], - "LOW_BAT": ["battery", {0: "High", 1: "Low"}], - "ERROR": ["error", {0: "No"}], - "ERROR_SABOTAGE": ["sabotage", {0: "No", 1: "Yes"}], - "SABOTAGE": ["sabotage", {0: "No", 1: "Yes"}], - "RSSI_PEER": ["rssi_peer", {}], - "RSSI_DEVICE": ["rssi_device", {}], - "VALVE_STATE": ["valve", {}], - "LEVEL": ["level", {}], - "BATTERY_STATE": ["battery", {}], - "CONTROL_MODE": [ +HM_ATTRIBUTE_SUPPORT: dict[str, tuple[str, dict[int, str]]] = { + "LOWBAT": ("battery", {0: "High", 1: "Low"}), + "LOW_BAT": ("battery", {0: "High", 1: "Low"}), + "ERROR": ("error", {0: "No"}), + "ERROR_SABOTAGE": ("sabotage", {0: "No", 1: "Yes"}), + "SABOTAGE": ("sabotage", {0: "No", 1: "Yes"}), + "RSSI_PEER": ("rssi_peer", {}), + "RSSI_DEVICE": ("rssi_device", {}), + "VALVE_STATE": ("valve", {}), + "LEVEL": ("level", {}), + "BATTERY_STATE": ("battery", {}), + "CONTROL_MODE": ( "mode", {0: "Auto", 1: "Manual", 2: "Away", 3: "Boost", 4: "Comfort", 5: "Lowering"}, - ], - "POWER": ["power", {}], - "CURRENT": ["current", {}], - "VOLTAGE": ["voltage", {}], - "OPERATING_VOLTAGE": ["voltage", {}], - "WORKING": ["working", {0: "No", 1: "Yes"}], - "STATE_UNCERTAIN": ["state_uncertain", {}], - "SENDERID": ["last_senderid", {}], - "SENDERADDRESS": ["last_senderaddress", {}], - "ERROR_ALARM_TEST": ["error_alarm_test", {0: "No", 1: "Yes"}], - "ERROR_SMOKE_CHAMBER": ["error_smoke_chamber", {0: "No", 1: "Yes"}], + ), + "POWER": ("power", {}), + "CURRENT": ("current", {}), + "VOLTAGE": ("voltage", {}), + "OPERATING_VOLTAGE": ("voltage", {}), + "WORKING": ("working", {0: "No", 1: "Yes"}), + "STATE_UNCERTAIN": ("state_uncertain", {}), + "SENDERID": ("last_senderid", {}), + "SENDERADDRESS": ("last_senderaddress", {}), + "ERROR_ALARM_TEST": ("error_alarm_test", {0: "No", 1: "Yes"}), + "ERROR_SMOKE_CHAMBER": ("error_smoke_chamber", {0: "No", 1: "Yes"}), } HM_PRESS_EVENTS = [ diff --git a/homeassistant/components/homematic/entity.py b/homeassistant/components/homematic/entity.py index bf029b2806d..3b5d2ebb509 100644 --- a/homeassistant/components/homematic/entity.py +++ b/homeassistant/components/homematic/entity.py @@ -5,6 +5,7 @@ from __future__ import annotations from abc import abstractmethod from datetime import timedelta import logging +from typing import Any from pyhomematic import HMConnection from pyhomematic.devicetypes.generic import HMGeneric @@ -50,7 +51,7 @@ class HMDevice(Entity): self._channel = config.get(ATTR_CHANNEL) self._state = config.get(ATTR_PARAM) self._unique_id = config.get(ATTR_UNIQUE_ID) - self._data: dict[str, str] = {} + self._data: dict[str, Any] = {} self._connected = False self._available = False self._channel_map: dict[str, str] = {}