This post is part of the Komfovent in Home Assistant series.
Our Komfovent balanced ventilation system is pretty bad at accurate timekeeping — the time drifts several minutes over the course of a few months. This is a bit annoying as the operator panel is prominently located on the second floor, and we use it to tell time.
Luckily; the time can be set using the Modbus interface.
Unsuccessful
Although it is possible to set the time, according to the C6 Modbus manual:
I haven’t able to get it to work — I’ve tried a bunch of different data values, both hex and decimal:
value:
- "{{ \"%02x\" | format( (now().timestamp()| timestamp_custom(\"%H\"))|int) }}"
- "{{ \"%02x\" | format( (now().timestamp()| timestamp_custom(\"%M\"))|int) }}"
value: >-
{{ "%02x" | format( (now().timestamp()| timestamp_custom("%H"))|int) | reverse
+ "%02x" | format( (now().timestamp()| timestamp_custom("%M"))|int) |
reverse}}
value: "{{ now().timestamp() | timestamp_custom('0%H0%M') }}"
There must be some conversion or format that I don’t understand between Home Assistant and the Komfovent C6 controller. I’m able to get it to work with just minutes, but as soon as I include the hour — the time set doesn’t match my values. I haven’t been able to make sense of it…
I got some good suggestions on the Home Assistant Community; but still no luck.
Solution
I realized that I don’t actually need to set the current time — I just need to set a specific time, at the right time 🙂
With the script below the time is set to 0:30, notice the 30
in data value:
alias: Komfovent reset time 0:30
sequence:
- data:
address: 28
hub: komfovent
unit: 1
value: 30
action: modbus.write_register
mode: single
description: ""
This scripts is triggered by an automation, every Monday at 0:30:
alias: Ventilation reset time
description: ""
triggers:
- at: "00:30:00"
trigger: time
conditions:
- condition: time
weekday:
- mon
enabled: true
actions:
- action: script.komfovent_reset_time_duplicate_duplicate
metadata: {}
data: {}
mode: single
It still bugs me a little that I’m unable to set the current time and date — maybe I’ll give this another go in the future. This solution does accomplish what I need; the clock is (re)set once a week and no longer drifts.
Please let me know if you know how this works, or have any suggestions 🖖
Last commit 2024-11-28, with message: Add note about Modbus address offset.
All posts in Komfovent in Home Assistant series
- Interfacing Komfovent C6 in Home Assistant
- Wi-Fi relays for controlling ventilation — WeMos D1, MQTT, and Home Assistant
- A few more ventilation automations in Home Assistant
- (Re)set the time on our Komfovent ventilation system