1- """Support for Tech HVAC system ."""
1+ """The Tech Controllers Coordinator ."""
22
33import logging
44from typing import Any
55
6- from custom_components .tech import TechCoordinator
76from homeassistant .components .climate import ClimateEntity
87from homeassistant .components .climate .const import (
98 ClimateEntityFeature ,
2423 STATE_ON ,
2524 UnitOfTemperature ,
2625)
27- from homeassistant .core import callback
26+ from homeassistant .core import HomeAssistant , callback
27+ from homeassistant .helpers .device_registry import DeviceInfo
28+ from homeassistant .helpers .entity_platform import AddEntitiesCallback
2829from homeassistant .helpers .update_coordinator import CoordinatorEntity
2930
3031from .const import CONTROLLER , DOMAIN , INCLUDE_HUB_IN_NAME , MANUFACTURER , UDID , VER
32+ from .coordinator import TechCoordinator
3133
3234_LOGGER = logging .getLogger (__name__ )
3335
3638SUPPORT_HVAC = [HVACMode .HEAT , HVACMode .OFF ]
3739
3840
39- async def async_setup_entry (hass , config_entry , async_add_entities ):
41+ async def async_setup_entry (
42+ hass : HomeAssistant ,
43+ config_entry : ConfigEntry ,
44+ async_add_entities : AddEntitiesCallback ,
45+ ) -> None :
4046 """Set up entry."""
4147 udid = config_entry .data [CONTROLLER ][UDID ]
4248 coordinator = hass .data [DOMAIN ][config_entry .entry_id ]
@@ -55,9 +61,11 @@ class TechThermostat(ClimateEntity, CoordinatorEntity):
5561 _attr_has_entity_name = True
5662 _attr_name = None
5763
58- def __init__ (self , device , coordinator : TechCoordinator , config_entry : ConfigEntry ):
64+ def __init__ (
65+ self , device , coordinator : TechCoordinator , config_entry : ConfigEntry
66+ ) -> None :
5967 """Initialize the Tech device."""
60- _LOGGER .debug ("Init TechThermostat... " )
68+ _LOGGER .debug ("Init TechThermostat… " )
6169 super ().__init__ (coordinator )
6270 self ._config_entry = config_entry
6371 self ._udid = config_entry .data [CONTROLLER ][UDID ]
@@ -77,12 +85,13 @@ def __init__(self, device, coordinator: TechCoordinator, config_entry: ConfigEnt
7785 + config_entry .data [CONTROLLER ][VER ]
7886 )
7987 self ._temperature = None
88+ self ._target_temperature = None
8089 self .update_properties (device )
8190 # Remove the line below after HA 2025.1
8291 self ._enable_turn_on_off_backwards_compatibility = False
8392
8493 @property
85- def device_info (self ):
94+ def device_info (self ) -> DeviceInfo | None :
8695 """Returns device information in a dictionary format."""
8796 return {
8897 ATTR_IDENTIFIERS : {
@@ -163,7 +172,7 @@ def unique_id(self) -> str:
163172 return f"{ self ._unique_id } _zone_climate"
164173
165174 @property
166- def supported_features (self ):
175+ def supported_features (self ) -> ClimateEntityFeature :
167176 """Return the list of supported features."""
168177 return (
169178 ClimateEntityFeature .TARGET_TEMPERATURE
@@ -172,46 +181,46 @@ def supported_features(self):
172181 )
173182
174183 @property
175- def hvac_mode (self ):
184+ def hvac_mode (self ) -> HVACMode :
176185 """Return hvac operation ie. heat, cool mode.
177186
178187 Need to be one of HVAC_MODE_*.
179188 """
180189 return self ._mode
181190
182191 @property
183- def hvac_modes (self ):
192+ def hvac_modes (self ) -> list [ HVACMode ] :
184193 """Return the list of available hvac operation modes.
185194
186195 Need to be a subset of HVAC_MODES.
187196 """
188197 return SUPPORT_HVAC
189198
190199 @property
191- def hvac_action (self ) -> str | None :
200+ def hvac_action (self ) -> HVACAction | None :
192201 """Return the current running hvac operation if supported.
193202
194203 Need to be one of CURRENT_HVAC_*.
195204 """
196205 return self ._state
197206
198207 @property
199- def temperature_unit (self ):
208+ def temperature_unit (self ) -> str :
200209 """Return the unit of measurement."""
201210 return UnitOfTemperature .CELSIUS
202211
203212 @property
204- def target_temperature_step (self ):
213+ def target_temperature_step (self ) -> float | None :
205214 """Return the supported step of target temperature."""
206215 return 0.1
207216
208217 @property
209- def current_temperature (self ):
218+ def current_temperature (self ) -> float | None :
210219 """Return the current temperature."""
211220 return self ._temperature
212221
213222 @property
214- def current_humidity (self ):
223+ def current_humidity (self ) -> float | None :
215224 """Return current humidity."""
216225 return self ._humidity
217226
@@ -226,11 +235,11 @@ def max_temp(self) -> float:
226235 return DEFAULT_MAX_TEMP
227236
228237 @property
229- def target_temperature (self ):
238+ def target_temperature (self ) -> float | None :
230239 """Return the temperature we try to reach."""
231240 return self ._target_temperature
232241
233- async def async_set_temperature (self , ** kwargs ) :
242+ async def async_set_temperature (self , ** kwargs : Any ) -> None :
234243 """Set new target temperatures."""
235244 temperature = kwargs .get (ATTR_TEMPERATURE )
236245 if temperature :
@@ -244,7 +253,7 @@ async def async_set_temperature(self, **kwargs):
244253 self ._target_temperature = temperature
245254 await self .coordinator .async_request_refresh ()
246255
247- async def async_set_hvac_mode (self , hvac_mode ) :
256+ async def async_set_hvac_mode (self , hvac_mode : HVACMode ) -> None :
248257 """Set new target hvac mode."""
249258 _LOGGER .debug ("%s: Setting hvac mode to %s" , self .device_name , hvac_mode )
250259 if hvac_mode == HVACMode .OFF :
0 commit comments