Hey.
I’m working on setting up home assistant to interact with my heatpump/ventilation through modbus.
(usb dongle into the pi)
I got the inputs set up, no problem.
However, writing to a holding register provides a challenge.
For example, I’ve set up the main on/off as a switch:
- name: OnOff
slave: 30
address: 1001
device_class: switch
write_type: holding
verify:
This works fine for reading the register, but I can’t seem to write to that register, using this entity.
The documentation states that writing is done with “function call 16”, and looking through the HA documentation, it seems that I have to write an array then…
However, I’m don’t know how to do that for the entity card.
I did manage to use a button to call a service using this code:
type: button
tap_action:
action: call-service
service: modbus.write_register
service_data:
address: 1001
unit: 30
hub: Nilan
value:
- 1
target: {}
entity: switch.onoff
But this means I would have to use TWO buttons, instead of a switch…
Is there a way to make the switch entity send an array instead of a single value?