1818)
1919
2020from homeassistant .components .climate import (
21- ClimateEntity ,
22- ClimateEntityFeature ,
23- HVACAction ,
24- HVACMode ,
25- )
26- from homeassistant .components .climate .const import (
2721 DOMAIN ,
2822 PRESET_AWAY ,
2923 PRESET_COMFORT ,
3024 PRESET_HOME ,
3125 PRESET_NONE ,
3226 PRESET_SLEEP ,
27+ ClimateEntity ,
28+ ClimateEntityFeature ,
29+ HVACAction ,
30+ HVACMode ,
3331)
34- from homeassistant .const import ATTR_TEMPERATURE , TEMP_CELSIUS
32+ from homeassistant .config_entries import ConfigEntry
33+ from homeassistant .const import ATTR_TEMPERATURE , UnitOfTemperature
34+ from homeassistant .core import HomeAssistant
3535from homeassistant .helpers import entity_platform
36+ from homeassistant .helpers .entity import DeviceInfo
37+ from homeassistant .helpers .entity_platform import AddEntitiesCallback
3638
3739from . import SERVICES
3840from .const import (
6466}
6567
6668
67- async def async_setup_entry (hass , entry , async_add_entities ):
69+ async def async_setup_entry (
70+ hass : HomeAssistant , entry : ConfigEntry , async_add_entities : AddEntitiesCallback
71+ ) -> None :
6872 """Set up the multimatic climate platform."""
69- climates = []
73+ climates : list [ MultimaticClimate ] = []
7074 zones_coo = get_coordinator (hass , ZONES , entry .unique_id )
7175 rooms_coo = get_coordinator (hass , ROOMS , entry .unique_id )
7276 ventilation_coo = get_coordinator (hass , VENTILATION , entry .unique_id )
@@ -86,7 +90,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
8690 async_add_entities (climates )
8791
8892 if len (climates ) > 0 :
89- platform = entity_platform .current_platform . get ()
93+ platform = entity_platform .async_get_current_platform ()
9094 platform .async_register_entity_service (
9195 SERVICE_REMOVE_QUICK_VETO ,
9296 SERVICES [SERVICE_REMOVE_QUICK_VETO ]["schema" ],
@@ -98,8 +102,6 @@ async def async_setup_entry(hass, entry, async_add_entities):
98102 SERVICE_SET_QUICK_VETO ,
99103 )
100104
101- return True
102-
103105
104106class MultimaticClimate (MultimaticEntity , ClimateEntity , abc .ABC ):
105107 """Base class for climate."""
@@ -134,22 +136,22 @@ def component(self) -> Component:
134136 """Return the room or the zone."""
135137
136138 @property
137- def available (self ):
139+ def available (self ) -> bool :
138140 """Return True if entity is available."""
139141 return super ().available and self .component
140142
141143 @property
142- def temperature_unit (self ):
144+ def temperature_unit (self ) -> str :
143145 """Return the unit of measurement used by the platform."""
144- return TEMP_CELSIUS
146+ return UnitOfTemperature . CELSIUS
145147
146148 @property
147- def target_temperature (self ):
149+ def target_temperature (self ) -> float :
148150 """Return the temperature we try to reach."""
149151 return self .active_mode .target
150152
151153 @property
152- def current_temperature (self ):
154+ def current_temperature (self ) -> float :
153155 """Return the current temperature."""
154156 return self .component .temperature
155157
@@ -244,17 +246,17 @@ def __init__(
244246 self ._zone_coo = zone_coo
245247
246248 @property
247- def device_info (self ):
249+ def device_info (self ) -> DeviceInfo | None :
248250 """Return device specific attributes."""
249251 devices = self .component .devices
250252 if len (devices ) == 1 : # Can't link an entity to multiple devices
251- return {
252- " identifiers" : {(MULTIMATIC , devices [0 ].sgtin )},
253- " name" : devices [0 ].name ,
254- " manufacturer" : "Vaillant" ,
255- " model" : devices [0 ].device_type ,
256- }
257- return {}
253+ return DeviceInfo (
254+ identifiers = {(MULTIMATIC , devices [0 ].sgtin )},
255+ name = devices [0 ].name ,
256+ manufacturer = "Vaillant" ,
257+ model = devices [0 ].device_type ,
258+ )
259+ return None
258260
259261 @property
260262 def component (self ) -> Room :
@@ -280,19 +282,19 @@ def hvac_modes(self) -> list[HVACMode]:
280282 return self ._supported_hvac
281283
282284 @property
283- def supported_features (self ):
285+ def supported_features (self ) -> ClimateEntityFeature :
284286 """Return the list of supported features."""
285287 return (
286288 ClimateEntityFeature .TARGET_TEMPERATURE | ClimateEntityFeature .PRESET_MODE
287289 )
288290
289291 @property
290- def min_temp (self ):
292+ def min_temp (self ) -> float :
291293 """Return the minimum temperature."""
292294 return Room .MIN_TARGET_TEMP
293295
294296 @property
295- def max_temp (self ):
297+ def max_temp (self ) -> float :
296298 """Return the maximum temperature."""
297299 return Room .MAX_TARGET_TEMP
298300
@@ -305,10 +307,10 @@ def zone(self):
305307 )
306308 return None
307309
308- async def async_set_temperature (self , ** kwargs ) :
310+ async def async_set_temperature (self , ** kwargs : Any ) -> None :
309311 """Set new target temperature."""
310312 await self .coordinator .api .set_room_target_temperature (
311- self , float ( kwargs .get (ATTR_TEMPERATURE ) )
313+ self , kwargs .get (ATTR_TEMPERATURE )
312314 )
313315
314316 async def async_set_hvac_mode (self , hvac_mode : HVACMode ) -> None :
@@ -433,7 +435,7 @@ def component(self) -> Zone:
433435 return self .coordinator .find_component (self ._zone_id )
434436
435437 @property
436- def hvac_mode (self ):
438+ def hvac_mode (self ) -> HVACMode :
437439 """Get the hvac mode based on multimatic mode."""
438440 current_mode = self .active_mode .current
439441 hvac_mode = ZoneClimate ._MULTIMATIC_TO_HA [current_mode ][0 ]
@@ -462,28 +464,28 @@ def hvac_modes(self) -> list[HVACMode]:
462464 return self ._supported_hvac
463465
464466 @property
465- def supported_features (self ):
467+ def supported_features (self ) -> ClimateEntityFeature :
466468 """Return the list of supported features."""
467469 return (
468470 ClimateEntityFeature .TARGET_TEMPERATURE | ClimateEntityFeature .PRESET_MODE
469471 )
470472
471473 @property
472- def min_temp (self ):
474+ def min_temp (self ) -> float :
473475 """Return the minimum temperature."""
474476 return Zone .MIN_TARGET_HEATING_TEMP
475477
476478 @property
477- def max_temp (self ):
479+ def max_temp (self ) -> float :
478480 """Return the maximum temperature."""
479481 return Zone .MAX_TARGET_TEMP
480482
481483 @property
482- def target_temperature (self ):
484+ def target_temperature (self ) -> float :
483485 """Return the temperature we try to reach."""
484486 return self .active_mode .target
485487
486- async def async_set_temperature (self , ** kwargs ) :
488+ async def async_set_temperature (self , ** kwargs : Any ) -> None :
487489 """Set new target temperature."""
488490 temp = kwargs .get (ATTR_TEMPERATURE )
489491
@@ -493,7 +495,7 @@ async def async_set_temperature(self, **kwargs):
493495 else :
494496 _LOGGER .debug ("Nothing to do" )
495497
496- async def async_set_hvac_mode (self , hvac_mode ) :
498+ async def async_set_hvac_mode (self , hvac_mode : HVACMode ) -> None :
497499 """Set new target hvac mode."""
498500 mode = ZoneClimate ._HA_MODE_TO_MULTIMATIC [hvac_mode ]
499501 await self .coordinator .api .set_zone_operating_mode (self , mode )
0 commit comments