Modbus Binary Sensor


The modbus binary sensor allows you to gather data from Modbus coils.

Configuration

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

# Example configuration.yaml entry
binary_sensor:
  - platform: modbus
    inputs:
      - name: Sensor1
        hub: hub1
        slave: 1
        address: 100
      - name: Sensor2
        hub: hub1
        slave: 1
        address: 110
        input_type: discrete_input

Configuration Variables

inputs

(map | list)(Required)

The array contains a list of coils and discrete inputs to read from.

name

(string)(Required)

Name of the sensor.

hub

(string)(Optional)

The name of the hub.

Default value:

default

slave

(integer)(Required)

The number of the slave (Optional for TCP and UDP Modbus).

address

(integer)(Required)

Coil or discrete input Modbus address.

input_type

(string)(Optional)

Modbus input type (coil, discrete_input), default coil.

device_class

(device_class)(Optional)

The type/class of the binary sensor to set the icon in the frontend.

Default value:

None

It’s possible to change the default 30 seconds scan interval for the sensor updates as shown in the Platform options documentation.

Full example

Example a sensor with a 10 seconds scan interval:

binary_sensor:
  - platform: modbus
    scan_interval: 10
    coils:
      - name: Sensor1
        hub: hub1
        slave: 1
        coil: 100
      - name: Sensor2
        hub: hub1
        slave: 1
        coil: 110