UART works in IDE via USB, but does not work via ESPHome

Hello,

I have a NodeMCU-32S board hooked up to an Arduino Mega via a Paladin Solar Diverter board. (see Solar Power Diverter & Controller - Paladin Solar Controller for more information.)
On the NodeMCU-32S board, I have connected the 2 boards as follows.
GPIO1 for TX0 to Arduino RX
GPIO3 for RX0 to Arduino TX

When I run the IDE (works with either Arduino IDE or vscode + platformio) serial monitor to (COM3) via USB cable direct to the NodeMCU-32S board, I can see the expected comma seperated value output being provided from the Arduino when I press A on the keyboard for example. This is all fine so far as working as expected.

VSCode + https://platformio.org/

Arduino IDE

Where I need help is, once I install Esphome onto the NodeMCU-32S board, I was expecting to see the same output of what I see in Serial Monitor in the ESPHome logs.
Is my expectation incorrect?

Here is my ESPHome YAML

logger:
  baud_rate: 0

uart:
  id: uart_bus
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 57600
  debug:
    direction: BOTH
    dummy_receiver: true

interval:
  - interval: 10s
    then:
      - uart.write: 'A'

and here is the ESPHome log output I get showing only A being sent in HEX with no reply.

[04:57:04][D][api.connection:1031]: Home Assistant 2023.10.1 (192.168.1.205): Connected successfully
[04:57:06][D][uart_debug:114]: >>> 41
[04:57:16][D][uart_debug:114]: >>> 41

Interestingly, when I reverse the connectors (U0TXD = GPIO3 and U0RXD = GPIO1),
I get a response in the ESPHome log,
however it is in HEX rather than CSV.

[05:06:18][D][uart_debug:114]: >>> 41
[05:06:18][D][uart_debug:114]: <<< 32:2E:39:36:2C:30:2E:30:30:2C:30:2E:30:30:2C:2D:31:32:37:2E:30:30:2C:2D:31:36:37:2E:30:30:2C:32:30:37:2C:37:33:2C:20:4E:41:4E:2C:32:2E:36:30:2C:30:2E:30:30:2C:20:4E:41:4E:2C:30:2E:30:30:2C:31:36:37:2C:30:2C:30:2C:30:2C:30:2C:30:2C:30:2C:39:32:39:0D:0A

It would seem that all of the debug is in HEX

Character Hex Decimal
A 41 65

Ok, finally fixed the issues.

Issue 1
I needed to convert the HEX to a string - done by adding this code:

    sequence:
      - lambda: |-
          UARTDebug::log_string(direction, bytes);

Issue 2
I reversed the polarity of the TX and RX pins in just the ESPHome config - now works fine.

  tx_pin: GPIO3
  rx_pin: GPIO1

Final config:

logger:
  baud_rate: 0

uart:
  id: uart_bus
  tx_pin: GPIO3
  rx_pin: GPIO1
  baud_rate: 57600
  debug:
    direction: BOTH
    dummy_receiver: true
    after:
      delimiter: "\r\n"
    sequence:
      - lambda: |-
          UARTDebug::log_string(direction, bytes);
          
interval:
  - interval: 10s
    then:
      - uart.write: 'A'

Now both:
COM3 via USB works in my IDE
and
ESPHome via Wifi show the same output in the logs.