Esphome Uart.write

Hello

I’m testing with modbus devices but I can’t make it communication ok.
When I’m using uart.write it changes my hex adresses.
in Esphome code I use

  - platform: template
    name: test_uart
    id: test_uart
    on_press: 
      then:
        - uart.write: [0x00,0x01,0x00,0x00,0x00,0x01,0xFC,0x1B]

and in the log I see:

12:07:49 [D] [button:010] ‘test_uart’ Pressed.
12:07:49 [D] [uart_debug:158] >>> “\x00\x01\x00\x00\x00\x01\xFC\e”

why should 0x1B changes in e ?

0x1B is the ESC character, in backslash notation it is represented by \e, so it is correctly indicating your data.

1 Like