10-14-2024, 10:34 AM
the switch yaml code you can add "restore_mode" for that.
fox example:
switch:
- platform: gpio
name: "Relay"
pin: GPIO12 # your relay GPIO
id: relay
restore_mode: RESTORE_DEFAULT_ON # or RESTORE_DEFAULT_OFF or ALWAYS_OFF/ALWAYS_ON
here is ESPHome about "restore_mode" setting details: https://esphome.io/components/switch/index.html
fox example:
switch:
- platform: gpio
name: "Relay"
pin: GPIO12 # your relay GPIO
id: relay
restore_mode: RESTORE_DEFAULT_ON # or RESTORE_DEFAULT_OFF or ALWAYS_OFF/ALWAYS_ON
here is ESPHome about "restore_mode" setting details: https://esphome.io/components/switch/index.html