3535 ActuatorData ,
3636 ApplianceData ,
3737 DeviceData ,
38- GatewayData ,
38+ PlugwiseData ,
3939 SmileBinarySensors ,
4040 SmileSensors ,
4141 SmileSwitches ,
5252class SmileData (SmileHelper ):
5353 """The Plugwise Smile main class."""
5454
55- def update_for_cooling (self , device : DeviceData ) -> None :
55+ def update_for_cooling (self , device : DeviceData ) -> DeviceData :
5656 """Helper-function for adding/updating various cooling-related values."""
57- # Add setpoint_low and setpoint_high when cooling is enabled
58- if device ["dev_class" ] not in ZONE_THERMOSTATS :
59- return
60-
6157 # For heating + cooling, replace setpoint with setpoint_high/_low
6258 if self ._cooling_present :
6359 thermostat = device ["thermostat" ]
@@ -85,6 +81,8 @@ def update_for_cooling(self, device: DeviceData) -> None:
8581 sensors ["setpoint_low" ] = temp_dict ["setpoint_low" ]
8682 sensors ["setpoint_high" ] = temp_dict ["setpoint_high" ]
8783
84+ return device
85+
8886 def _all_device_data (self ) -> None :
8987 """Helper-function for get_all_devices().
9088
@@ -100,7 +98,8 @@ def _all_device_data(self) -> None:
10098 )
10199
102100 # Update for cooling
103- self .update_for_cooling (self .gw_devices [device_id ])
101+ if self .gw_devices [device_id ]["dev_class" ] in ZONE_THERMOSTATS :
102+ self .update_for_cooling (self .gw_devices [device_id ])
104103
105104 self .gw_data .update (
106105 {"smile_name" : self .smile_name , "gateway_id" : self .gateway_id }
@@ -237,7 +236,7 @@ def _device_data_climate(
237236
238237 def _check_availability (
239238 self , details : ApplianceData , device_data : DeviceData
240- ) -> None :
239+ ) -> DeviceData :
241240 """Helper-function for _get_device_data().
242241
243242 Provide availability status for the wired-commected devices.
@@ -258,6 +257,8 @@ def _check_availability(
258257 if "P1 does not seem to be connected to a smart meter" in msg :
259258 device_data ["available" ] = False
260259
260+ return device_data
261+
261262 def _get_device_data (self , dev_id : str ) -> DeviceData :
262263 """Helper-function for _all_device_data() and async_update().
263264
@@ -452,7 +453,7 @@ async def _smile_detect(self, result: etree, dsmrmain: etree) -> None:
452453 )
453454 raise UnsupportedDeviceError
454455
455- ver = semver .VersionInfo .parse (self .smile_fw_version )
456+ ver = semver .version . Version .parse (self .smile_fw_version )
456457 target_smile = f"{ model } _v{ ver .major } "
457458 LOGGER .debug ("Plugwise identified as %s" , target_smile )
458459 if target_smile not in SMILES :
@@ -509,7 +510,7 @@ async def _update_domain_objects(self) -> None:
509510 f"{ self ._endpoint } { DOMAIN_OBJECTS } " ,
510511 )
511512
512- async def async_update (self ) -> tuple [ GatewayData , dict [ str , DeviceData ]] :
513+ async def async_update (self ) -> PlugwiseData :
513514 """Perform an incremental update for updating the various device states."""
514515 if self .smile_type != "power" :
515516 await self ._update_domain_objects ()
@@ -547,9 +548,10 @@ async def async_update(self) -> tuple[GatewayData, dict[str, DeviceData]]:
547548 )
548549
549550 # Update for cooling
550- self .update_for_cooling (dev_dict )
551+ if dev_dict ["dev_class" ] in ZONE_THERMOSTATS :
552+ self .update_for_cooling (dev_dict )
551553
552- return (self .gw_data , self .gw_devices )
554+ return PlugwiseData (self .gw_data , self .gw_devices )
553555
554556 async def _set_schedule_state_legacy (
555557 self , loc_id : str , name : str , status : str
0 commit comments