Skip to content

Instantly share code, notes, and snippets.

@joshco
Created September 13, 2023 17:46
Show Gist options
  • Save joshco/db957be3ddf14e9bd8553f832f9c80c1 to your computer and use it in GitHub Desktop.
Save joshco/db957be3ddf14e9bd8553f832f9c80c1 to your computer and use it in GitHub Desktop.
ESPHome DIY Scene Selector
esphome:
name: esphome-web-c9e248
friendly_name: widget2
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "XXX"
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-Web-XXX"
password: "XXX"
captive_portal:
light:
- platform: binary
name: "SLED"
id: button_led
output: light_output
output:
- id: light_output
platform: gpio
pin: GPIO4
text_sensor:
- platform: template
id: run_scene
name: "Run Scene"
lambda: |-
return { "Released"};
binary_sensor:
- platform: gpio
pin: GPIO5
id: button_scene
name: "bs"
filters:
delayed_on: 50ms
on_click:
- min_length: 100ms
max_length: 1000ms
then:
- text_sensor.template.publish:
id: run_scene
state: "red"
- delay: 2s
- text_sensor.template.publish:
id: run_scene
state: "Released"
- min_length: 2000ms
max_length: 4000ms
then:
- text_sensor.template.publish:
id: run_scene
state: "dark"
- delay: 2s
- text_sensor.template.publish:
id: run_scene
state: "Released"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment