Modbus Controller Binary Sensor =============================== .. seo:: :description: Instructions for setting up a modbus_controller device binary sensor. :image: modbus.png The ``modbus_controller`` binary sensor platform creates a binary sensor from a modbus_controller component and requires :doc:`/components/modbus_controller` to be configured. Configuration variables: ------------------------ - **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation. - **name** (**Required**, string): The name of the sensor. - **register_type** (**Required**): type of the modbus register. - ``coil``: Function 01 (01hex) Read Coils - Reads the ON/OFF status of discrete coils in the device. - ``discrete_input``: Function 02(02hex) - Reads the ON/OFF status of discrete inputs in the device. - ``holding``: Function 03 (03hex) Read Holding Registers - Read the binary contents of holding registers in the device. - ``read``: Function 04 (04hex) Read Input Registers - Read the binary contents of input registers in the device. - **address** (**Required**, int): start address of the first register in a range - **bitmask** (*Optional*, int): Some values are packed in a response. The bitmask is used to determined if the result is true or false - **skip_updates** (*Optional*, int): By default all sensors of a modbus_controller are updated together. For data points that don't change very frequently updates can be skipped. A value of 5 would only update this sensor range in every 5th update cycle - **response_size** (*Optional*, int): Size of the response for the register in bytes. Defaults to register_count*2. - **force_new_range** (*Optional*, boolean): If possible sensors with sequential addresses are grouped together and requested in one range. Setting ``force_new_range: true`` enforces the start of a new range at that address. - **custom_command** (*Optional*, list of bytes): raw bytes for modbus command. This allows using non-standard commands. If ``custom_command`` is used ``address`` and ``register_type`` can't be used. custom data must contain all required bytes including the modbus device address. The crc is automatically calculated and appended to the command. See :ref:`modbus_custom_command` how to use ``custom_command`` - **lambda** (*Optional*, :ref:`lambda `): Lambda to be evaluated every update interval to get the new value of the sensor Parameters - **x** (bool): The parsed float value of the modbus data - **data** (std::vector