Modbus command bits wrong place

Can’t find this,

I have this configuration for modbus switch

modbus:

  • name: modbus_hub
    type: serial
    port: /dev/ttyUSB2
    baudrate: 9600
    bytesize: 8
    method: rtu
    parity: N
    stopbits: 1

    delay: 0
    message_wait_milliseconds: 30
    timeout: 5

    switches:

    • name: Switch1
      slave: 1
      address: 5
      command_on: 1
      command_off: 2

In logs I find this traffic : send: 0x1 0x6 0x0 0x5 0x0 0x2 0x18 0xa

But this should be : send: 0x1 0x6 0x0 0x5 0x2 0x0 0x18 0xa

The command (here off = 2) is the 6th bit, but it should be the 5th bit.

Searched a lot, but did not find a sollution.

Someone can help ?

1 Like

Use 512 and 256

1 Like

Perfect !
Thanks a lot !

1 Like