From 9736614db8e05f180fd15bb9014e7619d69f4b44 Mon Sep 17 00:00:00 2001 From: jan iversen Date: Tue, 4 May 2021 09:19:22 +0200 Subject: [PATCH] New modbus switch. (#17516) --- source/_integrations/modbus.markdown | 71 ++++++++++++++++------------ 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/source/_integrations/modbus.markdown b/source/_integrations/modbus.markdown index 552e44b397f..05ebbd5ceee 100644 --- a/source/_integrations/modbus.markdown +++ b/source/_integrations/modbus.markdown @@ -647,22 +647,27 @@ To use your Modbus switches in your installation, add the following to your `con ```yaml # Example configuration.yaml entry modbus: - - name: hub1 - type: tcp + - type: tcp host: IP_ADDRESS port: 502 switches: - name: Switch1 address: 13 - input_type: coil + write_type: coil - name: Switch2 slave: 2 address: 14 - input_type: coil + write_type: coil + verify: - name: Register1 address: 11 command_on: 1 command_off: 0 + verify: + input_type: holding + address: 127 + state_on: 25 + state_off: 1 ``` {% configuration %} @@ -677,14 +682,16 @@ switches: type: integer command_on: description: Value to write to turn on the switch. - required: true + required: false + default: 0x01 type: integer command_off: description: Value to write to turn off the switch. - required: true + required: false + default: 0x00 type: integer - input_type: - description: type of adddress (holding/input/coil) + write_type: + description: type of adddress (holding/coil) required: false default: holding type: string @@ -699,33 +706,39 @@ switches: default: 15 slave: description: The number of the slave (can be omitted for tcp and udp Modbus). - required: true + required: false type: integer - state_on: - description: Register value when switch is on. + default: 0 + verify: + description: read from modbus device to verify switch. required: false - default: same as command_on - type: integer - state_off: - description: Register value when switch is off. - required: false - default: same as command_off - type: integer - verify_register: - description: Register to readback. - required: false - default: same as register - type: string - verify_state: - description: Define if is possible to readback the status of the switch. - required: false - default: true - type: boolean + type: map + keys: + address: + description: address to read from. + required: false + default: write address + type: integer + input_type: + description: type of adddress (holding/coil/discrete/input) + required: false + default: write_type + type: integer + state_on: + description: value when switch is on. + required: false + default: same as command_on + type: integer + state_off: + description: value when switch is off. + required: false + default: same as command_off + type: integer {% endconfiguration %} #### Full example -Example switches, for which the state is polled from Modbus every 15 seconds (default). +Example switches, for which the state is not polled. ```yaml modbus: