My ventilation system doesn’t have a very accurate clock, but the time can be set using MODBUS. I’m trying to figure out how I can send the hour and minute in the following format:
My current script looks like this:
alias: Komfovent set current time
sequence:
- service: modbus.write_register
data:
address: 28
hub: komfovent
unit: 1
value: "{{ now().timestamp() | timestamp_custom('%H%M') }}"
But this number, e.g. 1215
, gets converted to hex as a whole, so the result becomes: 4BF
, but the correct value should be 0C0F
(0C = 12 and 0F = 15)
How can I do this with a template?