New modbus switch. (#17516)

This commit is contained in:
jan iversen 2021-05-04 09:19:22 +02:00 committed by GitHub
parent c58ce45323
commit 9736614db8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: