How to keep wall switches working if HA is down

Hi, I’m a total newbie in this field so and I need some guidance.

Currently I have created a binary sensor as my wall switch and a switch as my relay. Everything is working fine but I was wondering if there is some way to keep the manual wall switch working even if the Home Assistant(Raspberry Pi) is down for some reason.

This is my current yaml code:

switch:
  - platform: gpio
    pin: GPIO5
    name: "Rele 2"
    id: rele_2    

binary_sensor:
  - platform: gpio
    id: wall_switch
    pin: 
      number: GPIO4
      mode: INPUT_PULLUP
      inverted: true
    name: "Wall Switch"
    filters: 
      - delayed_on: 10ms
      - delayed_off: 10ms
    on_press:
      then:
        - homeassistant.service:
            service: switch.toggle
            data:
              entity_id: switch.rele_2

Thank you in advance for every reply!

There is, just trigger your switch locally (on the esphome node) without the ha service call :warning:

  - platform: gpio
    pin: GPIO5
    name: "Rele 2"
    id: rele_2    

binary_sensor:
  - platform: gpio
    id: wall_switch
    pin: 
      number: GPIO4
      mode: INPUT_PULLUP
      inverted: true
    name: "Wall Switch"
    filters: 
      - delayed_on: 10ms
      - delayed_off: 10ms
    on_press:
      then:
        - switch.toggle: switch.rele_2

Your control from HA will work exactly like before :rocket:

Perfect it’s working, thank you very much!

1 Like