Synchronise and restore status at boot for two switches

Hi all,

I’m becoming very frustrated after two days of trials and mostly errors.

I have a Kincony F8 relay board. I’m trying to do the following:

  • two switches should be based on the same gpio pin
  • their status should be synchronised - when one is turned on, the other is too, etc.
  • their status is restored after reboot

I read all the ESPHome doc for switches, outputs, templates. I tried all the tricks I could think of. I asked ChatGPT and Claude. Every time, either the synchronisation is broken, or the state is not restored at boot, or both.

Anyone has a working example of code to share?

Thanks

Why you need two switches for same gpio?
Did you try Copy Switch?

switch:
  - platform: copy
    source_id: source_switch
    name: "Copy of source_switch"
1 Like

Thanks a lot, it did the trick! I never came across this during my search. I was actually looking for a list of all the platforms available for a switch and never found this.

Answering your question regarding the need, I want my devices to be available as ‘high-level’ objects, for instance covers or lights, but also as regular switches, without any intelligence (no interlock, no timeout, etc.) in case I need to intervene manually.

Thanks again.

You’re welcome.

1 Like