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

Add setpoint command to imitate manual control of the thermostat #1046

Merged
merged 7 commits into from
Sep 28, 2021
Merged
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
21 changes: 21 additions & 0 deletions zhaquirks/danfoss/thermostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
class DanfossThermostatCluster(CustomCluster, Thermostat):
"""Danfoss custom cluster."""

manufacturer_server_commands = {
0x40: ("setpoint_command", (t.enum8, t.int16s), False),
}

manufacturer_attributes = {
0x4000: ("etrv_open_windows_detection", t.enum8),
0x4003: ("external_open_windows_detected", t.Bool),
Expand All @@ -56,6 +60,23 @@ class DanfossThermostatCluster(CustomCluster, Thermostat):
0xFFFD: ("cluster_revision", t.uint16_t),
}

async def write_attributes(self, attributes, manufacturer=None):
"""Send SETPOINT_COMMAND after setpoint change."""

write_res = await super().write_attributes(
attributes, manufacturer=manufacturer
)

if "occupied_heating_setpoint" in attributes:
self.debug(
"sending setpoint command: %s", attributes["occupied_heating_setpoint"]
)
await self.setpoint_command(
0x01, attributes["occupied_heating_setpoint"], manufacturer=manufacturer
)

return write_res


class DanfossUserInterfaceCluster(CustomCluster, UserInterface):
"""Danfoss custom cluster."""
Expand Down