Hello,
My project is for a door ring.
During the sleep of my baby, i have to move a switch in home assistant for desactivate the ring.
Probably easy for you but not for me ^^.
I don’t know how can i write actual state of button directly on led(relay for ring in futur).
In other word, if i puch during 10 secondes on button, led light during 10 secondes.
here is my code:
esphome:
name: sonnette
esp8266:
board: d1_mini
restore_from_flash : true
# Enable logging
logger:
# Enable Home Assistant API
api:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Sonnette Fallback Hotspot"
password: "g15cP1XmEPvO"
captive_portal:
binary_sensor:
- platform: gpio
pin: D8
name: "Button Led"
id: button_led
device_class: window
filters:
- delayed_on: 100ms
on_press:
then:
- if:
condition:
- switch.is_on : template_switch
then:
- light.turn_on: light_led
else:
- light.turn_off: light_led
switch:
- platform: template
name: "Template Switch"
id: template_switch
optimistic: true
light:
- platform: binary
id: light_led
name: "Led"
output: light_output
output:
- id: light_output
platform: gpio
pin: D6
Thank you for your help,
Sébastien