Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(zone): expose signal_strength property and add alarm state #9

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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