Skip to content

Commit

Permalink
feat(zone): expose signal_strength property and add alarm state (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
peroo authored Nov 19, 2024
1 parent 527c129 commit aa0d8e1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pytouchlinesl/zone.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,21 @@ def algorithm(self) -> Literal["heating", "cooling"]:
"""Return the zone's current algorithm, either `heating` or `cooling`."""
return self._raw_data.zone.flags.algorithm

@property
def signal_strength(self) -> int | None:
"""Return the signal strength of the zone."""
return self._raw_data.zone.signal_strength

@property
def alarm(self) -> Literal["sensor_damaged", "no_communication"] | None:
"""Return the alarm state of the zone."""
state = self._raw_data.zone.zone_state
if state == "sensorDamaged":
return "sensor_damaged"
elif state == "noCommunication":
return "no_communication"
return None

async def set_temperature(self, temperature: float):
"""Set a constant target temperature for the zone."""
await self._client.set_zone_temperature(
Expand Down
2 changes: 2 additions & 0 deletions tests/test_zone.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
("enabled", True),
("relay_on", True),
("algorithm", "heating"),
("signal_strength", 53),
("alarm", None),
]


Expand Down

0 comments on commit aa0d8e1

Please sign in to comment.