File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -137,12 +137,12 @@ async def async_update(self) -> PlugwiseData:
137137 await self .full_update_device ()
138138 self .get_all_devices ()
139139 if "heater_id" in self .gw_data :
140- self . _heater_id = self .gw_data ["heater_id" ]
140+ heat_cooler = self .gw_devices [ self . gw_data ["heater_id" ] ]
141141 if (
142- "binary_sensors" in self . gw_devices [ self . _heater_id ]
143- and "cooling_enabled" in self . gw_devices [ self . _heater_id ] ["binary_sensors" ]
142+ "binary_sensors" in heat_cooler
143+ and "cooling_enabled" in heat_cooler ["binary_sensors" ]
144144 ):
145- self ._cooling_enabled = self . gw_devices [ self . _heater_id ] ["binary_sensors" ]["cooling_enabled" ]
145+ self ._cooling_enabled = heat_cooler ["binary_sensors" ]["cooling_enabled" ]
146146 except KeyError as err :
147147 raise DataMissingError ("No Plugwise data received" ) from err
148148
Original file line number Diff line number Diff line change @@ -574,12 +574,12 @@ async def device_test(
574574 self ._cooling_active = False
575575 self ._cooling_enabled = False
576576 if "heater_id" in data .gateway :
577- heater_id = data .gateway ["heater_id" ]
578- if "binary_sensors" in data . devices [ heater_id ] :
579- if "cooling_enabled" in data . devices [ heater_id ] ["binary_sensors" ]:
580- self ._cooling_enabled = data . devices [ heater_id ] ["binary_sensors" ]["cooling_enabled" ]
581- if "cooling_state" in data . devices [ heater_id ] ["binary_sensors" ]:
582- self ._cooling_active = data . devices [ heater_id ] ["binary_sensors" ]["cooling_state" ]
577+ heat_cooler = data .devices [ data . gateway ["heater_id" ] ]
578+ if "binary_sensors" in heat_cooler :
579+ if "cooling_enabled" in heat_cooler ["binary_sensors" ]:
580+ self ._cooling_enabled = heat_cooler ["binary_sensors" ]["cooling_enabled" ]
581+ if "cooling_state" in heat_cooler ["binary_sensors" ]:
582+ self ._cooling_active = heat_cooler ["binary_sensors" ]["cooling_state" ]
583583
584584 self ._write_json ("all_data" , {"gateway" : data .gateway , "devices" : data .devices })
585585
You can’t perform that action at this time.
0 commit comments