Skip to content

Commit 92a4a76

Browse files
committed
Handle None-cases
1 parent e8b1f0c commit 92a4a76

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

plugwise/helper.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ def _control_state(self, data: GwEntityData) -> str | bool:
798798
Note: heating or cooling can still be active when the setpoint has been reached.
799799
"""
800800

801-
if (ctrl_state := data["thermostat"]["control_state"]) is not None:
801+
if (ctrl_state := data["thermostat"].get("control_state")) is not None:
802802
data["thermostat"].pop("control_state")
803803
return ctrl_state
804804

@@ -839,9 +839,10 @@ def _regulation_control(self, data: GwEntityData) -> None:
839839
840840
Adam: collect the thermostat regulation_mode of a location.
841841
"""
842-
data["regulation_control_modes"] = ["active", "passive", "off"]
843-
data["select_regulation_control"] = data["thermostat"]["regulation_control"]
844-
data["thermostat"].pop("regulation_control")
842+
if (reg_control := data["thermostat"].get("regulation_control")) is not None:
843+
data["select_regulation_control"] = reg_control
844+
data["regulation_control_modes"] = ["active", "passive", "off"]
845+
data["thermostat"].pop("regulation_control")
845846

846847
def _preset(self, loc_id: str) -> str | None:
847848
"""Helper-function for smile.py: device_data_climate().

0 commit comments

Comments
 (0)