@@ -207,7 +207,6 @@ def _device_data_climate(
207207 if presets := self ._presets (loc_id ):
208208 presets_list = list (presets )
209209 device_data ["preset_modes" ] = presets_list
210-
211210 device_data ["active_preset" ] = self ._preset (loc_id )
212211
213212 # Schedule
@@ -296,31 +295,30 @@ def _get_device_data(self, dev_id: str) -> DeviceData:
296295 device_data .pop ("thermostat" )
297296
298297 # Generic
299- if details ["dev_class" ] == "gateway" or dev_id == self .gateway_id :
300- if self .smile_type == "thermostat" :
301- # Adam & Anna: the Smile outdoor_temperature is present in DOMAIN_OBJECTS and LOCATIONS - under Home
302- # The outdoor_temperature present in APPLIANCES is a local sensor connected to the active device
303- outdoor_temperature = self ._object_value (
304- self ._home_location , "outdoor_temperature"
305- )
306- if outdoor_temperature is not None :
307- device_data ["outdoor_temperature" ] = outdoor_temperature
298+ if self .smile_type == "thermostat" and details ["dev_class" ] == "gateway" :
299+ # Adam & Anna: the Smile outdoor_temperature is present in DOMAIN_OBJECTS and LOCATIONS - under Home
300+ # The outdoor_temperature present in APPLIANCES is a local sensor connected to the active device
301+ outdoor_temperature = self ._object_value (
302+ self ._home_location , "outdoor_temperature"
303+ )
304+ if outdoor_temperature is not None :
305+ device_data ["outdoor_temperature" ] = outdoor_temperature
308306
309- # Show the allowed regulation modes
310- if self ._reg_allowed_modes :
311- device_data ["regulation_modes" ] = self ._reg_allowed_modes
307+ # Show the allowed regulation modes
308+ if self ._reg_allowed_modes :
309+ device_data ["regulation_modes" ] = self ._reg_allowed_modes
312310
313311 # Show the allowed dhw_modes
314- if details ["dev_class" ] == "heater_central" :
315- if self ._dhw_allowed_modes :
316- device_data ["dhw_modes" ] = self ._dhw_allowed_modes
312+ if details ["dev_class" ] == "heater_central" and self ._dhw_allowed_modes :
313+ device_data ["dhw_modes" ] = self ._dhw_allowed_modes
317314
318- if details ["dev_class" ] == "smartmeter" :
319- # Get P1 data from LOCATIONS
320- if (
321- power_data := self ._power_data_from_location (details ["location" ])
322- ) is not None :
323- device_data .update (power_data )
315+ # Get P1 data from LOCATIONS
316+ if (
317+ details ["dev_class" ] == "smartmeter"
318+ and (power_data := self ._power_data_from_location (details ["location" ]))
319+ is not None
320+ ):
321+ device_data .update (power_data )
324322
325323 # Check availability of non-legacy wired-connected devices
326324 if not self ._smile_legacy :
0 commit comments