Issues with editing YAML

I’m sorry. I use Google translate. Perhaps the translation does not always correctly reflect my thoughts. In any case, no one owes me anything. If you or someone else is ready to help me create a workable YAML for money, then I will be glad.

Maybe this

      - name: "light1"
        address: 0
        write_type: coil
        scan_interval: 10
        command_on: 65280
        command_off: 0

maybe this

      - name: "light1"
        address: 0
        write_type: coil
        scan_interval: 10
        command_on: 255
        command_off: 0

EDIT: After reading the docs, it has to be 1 of these 2 configurations. I would lean towards the first.

Keep in mind that modbus polls devices. Your polling frequency is 10 seconds. Meaning it could take upwards of 10 seconds for home assistant to respond to you manually turning on or off the light.

Unfortunately both options didn’t work. After changing the code, the “light1” switch becomes inactive :disappointed_relieved:

A second light was most likely created. Look in your system for the other light.

I added the line “slave: 3” to the first option and the switch became active. The relay switches. But polling the status every 10 seconds still doesn’t work. The new system object named “light or light1” did not appear.

- name: "light1"
        slave: 3
        address: 0
        write_type: coil
        scan_interval: 10
        command_on: 65280
        command_off: 0

Hello! I received a new module (4 digital inputs and 4 outputs). There is complete documentation for using Modbus. I was able to configure the control of the relay outputs without any problems. But there is a problem with reading the state of the inputs. The module documentation says that to read the input registers, you must use function 10 of the Modbus protocol. But in the description of Modbus from HA, I did not find examples with such functions. Is it even possible to read inputs with HA Modbus?

Resolved: Inputs are now readable. With the help of Google I found a working solution. But in the description of Modbus XA there are no examples of how this can be done…

binary_sensors:
      - name: DI_1
        slave: 0
        address: 0
        input_type: discrete_input  
        scan_interval: 1
      - name: DI_2
        slave: 0
        address: 1
        input_type: discrete_input  
        scan_interval: 1
      - name: DI_3
        slave: 0
        address: 2
        input_type: discrete_input  
        scan_interval: 1
      - name: DI_4
        slave: 0
        address: 3
        input_type: discrete_input  
        scan_interval: 1