Skip to content

Commit

Permalink
Blocking climate change when challenge locked
Browse files Browse the repository at this point in the history
The new challenge lock option will prevent users from changing the
temperature of their climate entities when it's active. This is meant to
help users achieve their challenges.
  • Loading branch information
valleedelisle committed Jan 7, 2022
1 parent 27d9769 commit 0e2fc3c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions custom_components/hilo/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ def icon(self):

async def async_set_temperature(self, **kwargs):
if ATTR_TEMPERATURE in kwargs:
if self._hilo.challenge_lock:
challenge = self._hilo._hass.states.get("sensor.defi_hilo")
if challenge.state == "reduction":
LOG.warning(
f"{self._device._tag} Attempt to set temperature to {kwargs[ATTR_TEMPERATURE]} was blocked because challenge lock is active"
)
return
LOG.info(
f"{self._device._tag} Setting temperature to {kwargs[ATTR_TEMPERATURE]}"
)
Expand Down

0 comments on commit 0e2fc3c

Please sign in to comment.