Skip to content

Commit

Permalink
πŸ› Correct pump duty running sensor
Browse files Browse the repository at this point in the history
Fix #95
  • Loading branch information
kamaradclimber committed Sep 2, 2023
1 parent 57f26dd commit 5fa6bf5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion custom_components/aquarea/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ class HeishaMonNumberEntityDescription(
# function to transform selected option in value sent via mqtt
state_to_mqtt: Optional[Callable] = None

def positive_to_bool(value: str) -> bool:
return int(value) > 0

def bit_to_bool(value: str) -> Optional[bool]:
if value == "1":
return True
Expand Down Expand Up @@ -616,7 +619,8 @@ def build_binary_sensors(
heishamon_topic_id="TOP93",
key=f"{mqtt_prefix}main/Pump_Duty",
name="Aquarea Pump Running",
state=bit_to_bool,
# TODO(kamaradclimber): it seems value is showing something more than just "on/off". Tests show value of 120 when running and slowly decreasing to 100
state=positive_to_bool,
device_class=BinarySensorDeviceClass.RUNNING,
),
HeishaMonBinarySensorEntityDescription(
Expand Down

0 comments on commit 5fa6bf5

Please sign in to comment.