Mirroring the state of a GPIO to another (including changes)

I’ve got this Olimex board with an extension for RS485 (ESP32-POE-ISO-EA-IND, MOD-RS485).

ESPHome, as far as I found out, expects one flow control pin to be defined, but this extension board needs two - GPIO5 and 14, if I’m not mistaken.

I’m totally new to ESPHome: is there an easy, YAML based, way to mirror the state of a pin, or do I have to solder a jumper wire?

Since your board has double headers, most simple way is to place jumper wire on the “side headers”.
It’s likely easier than trying to configure it on sw (afaik direction control comes from uart peripheral).

You mean, solder a pin header to the board and then use the jumper wire to bridge the GPIOs?

Probably easier, but I’m always curious about solutions (and also I’m down with a nasty flu and the soldering iron is literally too many miles away right now).

If you don’t have headers soldered, it’s up to you if you want to solder jumper directly.

What esphome component are you using here for communication over RS485?

I prefer soldering a pin header (even if just for the two). I was just asking to be sure, because English is not my native language and with hardware I sometimes lack the correct words.

I’m trying to use translate the Samsung NASA protocol. The component seems to be able to do flow control in software, but only for one pin.

I’m pretty sure Espome has no YAML option to make a second GPIO follow those internal writes.
If you are familiar with C++, likely doable, but I believe it’s quicker to get soldering iron even from miles away.

Can’t you do something along the lines of this

switch:
  - platform: gpio
    id: rs485_dir_1
    pin: GPIO5
    internal: true

  - platform: gpio
    id: rs485_dir_2
    pin: GPIO14
    internal: true

  - platform: template
    name: "RS485 Direction"
    turn_on_action:
      - switch.turn_on: rs485_dir_1
      - switch.turn_on: rs485_dir_2
    turn_off_action:
      - switch.turn_off: rs485_dir_1
      - switch.turn_off: rs485_dir_2

Or this:


binary_sensor:
  - platform: gpio
    id: rs485_direction
    pin:
      number: GPIO5
      mode:
        input: true
    internal: true
    on_press:
      - switch.turn_on: rs485_mirror
    on_release:
      - switch.turn_off: rs485_mirror

switch:
  - platform: gpio
    id: rs485_mirror
    pin: GPIO14
    internal: true

Or is that too dodgy for the application or am I otherwise missing something?

Might need allow_other_uses?

Or use Copy Component.
- platform: copy

Anyway, flow control pin is likely driven by UART peripheral and my knowledge is not enough to “clone” that in esphome YAML. I’m not even sure if it’s accessible.
I think it would be easier to modify library files, but I might be wrong as well.