Skip to content

Commit

Permalink
Optimize device_data_climate()-function
Browse files Browse the repository at this point in the history
  • Loading branch information
bouwew committed Oct 17, 2023
1 parent 53ab938 commit 87a6757
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions plugwise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ def _device_data_climate(
device_data["active_preset"] = None
self._count += 2
if presets := self._presets(loc_id):
presets_list = list(presets)
device_data["preset_modes"] = presets_list
device_data["preset_modes"] = list(presets)
device_data["active_preset"] = self._preset(loc_id)

# Schedule
Expand All @@ -237,13 +236,17 @@ def _device_data_climate(
device_data["mode"] = "heat"
if self._cooling_present:
device_data["mode"] = "heat_cool"
if "regulation_modes" in gateway:
if gateway["select_regulation_mode"] == "cooling":
device_data["mode"] = "cool"
if (
"regulation_modes" in gateway
and gateway["select_regulation_mode"] == "cooling"
):
device_data["mode"] = "cool"

if "regulation_modes" in gateway:
if gateway["select_regulation_mode"] == "off":
device_data["mode"] = "off"
if (
"regulation_modes" in gateway
and gateway["select_regulation_mode"] == "off"
):
device_data["mode"] = "off"

if "None" not in avail_schedules:
loc_schedule_states = {}
Expand Down

0 comments on commit 87a6757

Please sign in to comment.