Hi,
I have made some progress with my Modbus controller. I can now read temperature value from it using Modbus TCP. Next step is to create a switch for turning on/off the heating. In my configuration.yaml I have:
modbus:
- name: "ouman_garage"
type: tcp
host: 192.168.1.60
port: 502
delay: 0
timeout: 5
sensors:
- name: "Garage heating ON/OFF"
address: 132
count: 1
input_type: holding
scan_interval: 5
slave: 1
switches:
- name: "Garage heating ON/OFF"
slave: 1
address: 132
Basically I have created a sensor and switch. Modbus register is 132. In the scripts.yaml file I have:
script:
description: "Garage heating"
sequence:
- service: modbus.write_register
data_template:
hub: ouman_garage
unit: 1
address: 130
value: 1
- delay:
milliseconds: 100
- service: modbus.write_register
data_template:
hub: ouman_garage
unit: 1
address: 132
command_on: 100
command_off: 0
Idea is to write first “1” to register 130 and after a short delay to write to register 132 either 0 (=off) or 100 (=on). My problem is that I donät understand how to pass the on/off information from the switch in the configuration.yaml to script.yaml. Any help would be appreciated. Thanks.