Modbus Switch


The modbus switch platform allows you to control Modbus coils or registers.

Configuration

To use your Modbus switches in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
switch:
  platform: modbus
  slave: 1
  coils:
    - name: Switch1
      hub: hub1
      slave: 1
      coil: 13
    - name: Switch2
      slave: 2
      coil: 14
  registers:
    - name: Register1
      hub: hub1
      slave: 1
      register: 11
      command_on: 1
      command_off: 0

Configuration Variables

coils

(map)(Optional)

A list of relevant coils to read from/write to.

hub

(string)(Optional)

The name of the hub.

Default value:

default

slave

(integer)(Required)

The number of the slave (can be omitted for tcp and udp Modbus).

name

(string)(Required)

Name of the switch.

coil

(integer)(Required)

Coil number.

register

(map)(Optional)

A list of relevant registers to read from/write to.

hub_name

(string)(Optional)

The hub to use.

Default value:

default

slave

(integer)(Required)

The number of the slave (can be omitted for tcp and udp Modbus).

name

(string)(Required)

Name of the switch.

register

(integer)(Required)

Register number.

command_on

(integer)(Required)

Value to write to turn on the switch.

command_off

(integer)(Required)

Value to write to turn off the switch.

verify_state

(boolean)(Optional)

Define if is possible to readback the status of the switch.

Default value:

true

verify_register

(string)(Optional)

Register to readback.

Default value:

same as register

register_type

(string)(Optional)

Modbus register types are holding or input.

Default value:

holding

state_on

(integer)(Optional)

Register value when switch is on.

Default value:

same as command_on

state_off

(integer)(Optional)

Register value when switch is off.

Default value:

same as command_off