Switches in ESPHome

Опубликовано: 19 Октябрь 2024
на канале: kian
33,882
421

#esphome #home_assistant #switch
Learn how to use pins of ESP8266 and ESP32 development boards as switches in Home Assistant. This is done with ESPHome add on.

Simple Switch:

switch:
platform: gpio
name: "Switch 1"
pin: xx
Define ID:

switch:
platform: gpio
name: "Switch 1"
pin: xx
id: relay

platform: gpio
name: "Switch 3"
pin: 5
restore_mode: RESTORE_default_ON

platform: gpio
name: "Switch 4"
pin: 12
inverted: true

platform: gpio
name: "Switch 6"
pin: 14
icon: "mdi:gate"
on_turn_on:
delay: 2000ms
switch.turn_off: relay

restore_mode (Optional): Control how the GPIO Switch attempts to restore state on bootup.

RESTORE_DEFAULT_OFF (Default) - Attempt to restore state and default to OFF if not possible to restore.

RESTORE_DEFAULT_ON - Attempt to restore state and default to ON.

RESTORE_INVERTED_OFF - Attempt to restore state inverted from the previous state and default to OFF.

RESTORE_INVERTED_ON - Attempt to restore state inverted from the previous state and default to ON.

ALWAYS_OFF - Always initialize the pin as OFF on bootup.

ALWAYS_ON - Always initialize the pin as ON on bootup.

Link of other tutorials:

Home Assistant integration with ESP32 flashed with ESPHome:
   • Home Assistant integration with ESP32...  

Setup ESPHome with Home Assistant:
   • Setup ESPHome with Home Assistant  

Buy Me A Coffee:
https://www.buymeacoffee.com/kian.sma...

#esp32 #esp8266 #nodemcu #development_board #esp #tasmota #wifi #tuya #inverted_switch #momentary_switch #icon #wled #automation #automations #blueprint #smart_home #home_automation #bms #iot #zwave #z_wave #zigbee #bluetooth #integration #add_on #peace #comfort #energy_saving #security #gpio #gpio_switch