ESPHome UART forwarding

Take a look at ssieb’s “Man In the Middle”.

You can forward and inject UART.

I’ve also had some success without using a custom component using something similar to @mulcmu 's UART read approach.

uart:
  - id: uart_p #pendant side
    rx_pin: GPIO16  #Green wire | Transmits commands from pendant to robot via mitm uart_p. Wire confusingly (?) labelled RX on pendant!!!! 
    # tx_pin: GPIO17  #Yellow wire | Fowards messages from the robot to the pendant. Note: not used. Bypass used.
    baud_rate: 9600
    data_bits: 8
    stop_bits: 2
    parity: NONE
    rx_buffer_size: 256
    debug:
      direction: BOTH
      dummy_receiver: true
      after:
        timeout: 1ms
        # delimiter: "N"
      sequence:  
         #Used.
        - uart.write: #Write rx to tx.
            id: uart_r
            data: !lambda return bytes ;
        - lambda: 
            UARTDebug::log_string(direction , bytes);

  - id: uart_r #robot_side
    rx_pin: GPIO18 #Yellow wire tranmits data from robot to mitm rx uart_r
    tx_pin: GPIO19 #Green wire transmits/forwards commands from the pendant and mitm to the robot
    baud_rate: 9600
    data_bits: 8
    stop_bits: 2
    parity: NONE
    rx_buffer_size: 256
    debug:
      direction: BOTH
      dummy_receiver: true
      after:
        timeout: 1ms
      sequence:
        #Not Used.
        # - uart.write:
            # #Write rx to tx.
            # id: uart_p
            # data: !lambda return bytes ;
        - lambda: UARTDebug::log_string(direction, bytes);

1 Like