Skip to content

Commit

Permalink
Fix SetDemandControl
Browse files Browse the repository at this point in the history
Since there is no way to get the current value of demandcontrol, HA listens to the same topic where we send the command.
Thus when users set DemandControl to 20%, we send "81.2" via mqtt. HA
reads that value and tries to cast it to an int.

fix #252
  • Loading branch information
kamaradclimber committed Sep 19, 2024
1 parent 42d4e49 commit 7af92d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/aquarea/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,14 @@ def bit_to_bool(value: str) -> Optional[bool]:


def read_demandcontrol(value: str) -> Optional[int]:
i = int(value)
i = float(value)
if i >= 43 and i <= 234:
return int((i - 43) / (234 - 43) * 100)
return None


def write_demandcontrol(value: int) -> str:
return str(value / 100 * (234 - 43) + 43)
return str(int(value / 100 * (234 - 43) + 43))


def read_smart_grid_mode(value: str) -> str:
Expand Down

0 comments on commit 7af92d0

Please sign in to comment.