Skip to content

Commit 031aa0e

Browse files
committed
Optimize device_data_climate()-function
1 parent ca8c745 commit 031aa0e

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

plugwise/__init__.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,7 @@ def _device_data_climate(
210210
device_data["active_preset"] = None
211211
self._count += 2
212212
if presets := self._presets(loc_id):
213-
presets_list = list(presets)
214-
device_data["preset_modes"] = presets_list
213+
device_data["preset_modes"] = list(presets)
215214
device_data["active_preset"] = self._preset(loc_id)
216215

217216
# Schedule
@@ -228,13 +227,17 @@ def _device_data_climate(
228227
device_data["mode"] = "heat"
229228
if self._cooling_present:
230229
device_data["mode"] = "heat_cool"
231-
if "regulation_modes" in gateway:
232-
if gateway["select_regulation_mode"] == "cooling":
233-
device_data["mode"] = "cool"
230+
if (
231+
"regulation_modes" in gateway
232+
and gateway["select_regulation_mode"] == "cooling"
233+
):
234+
device_data["mode"] = "cool"
234235

235-
if "regulation_modes" in gateway:
236-
if gateway["select_regulation_mode"] == "off":
237-
device_data["mode"] = "off"
236+
if (
237+
"regulation_modes" in gateway
238+
and gateway["select_regulation_mode"] == "off"
239+
):
240+
device_data["mode"] = "off"
238241

239242
if "None" not in avail_schedules:
240243
loc_schedule_states = {}

0 commit comments

Comments
 (0)