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:

Screenshot from C6 Modbus manual
Modbus addressing in Home Assistant starts at 0, but the document starts at 1. So you need to subtract 1 from all addresses: 1 –> 0, 10 –> 9, etc.

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.

Komfovent in Home Assistant series
All posts in Komfovent in Home Assistant series
  1. Interfacing Komfovent C6 in Home Assistant
  2. Wi-Fi relays for controlling ventilation — WeMos D1, MQTT, and Home Assistant
  3. A few more ventilation automations in Home Assistant
  4. (Re)set the time on our Komfovent ventilation system