esphome/doorbell.yaml
2025-06-14 13:34:11 +00:00

128 lines
2.3 KiB
YAML

esphome:
name: doorbell
friendly_name: Doorbell
name_add_mac_suffix: True
esp32:
board: esp32dev
# Enable Home Assistant API
api:
web_server:
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
sensor:
- platform: uptime
name: Uptime
- platform: wifi_signal
name: WiFi Signal
update_interval: 10s
globals:
- id: chime
type: bool
restore_value: True
initial_value: 'true'
switch:
- platform: gpio
name: Relay
id: relay
internal: True
pin: GPIO12
- platform: template
id: chime_active
name: Chime Active
restore_mode: RESTORE_DEFAULT_ON
lambda: |-
return id(chime);
turn_on_action:
- globals.set:
id: chime
value: 'true'
turn_off_action:
- globals.set:
id: chime
value: 'false'
binary_sensor:
- platform: gpio
id: push_button
pin:
number: GPIO15
mode:
input: True
pulldown: True
filters:
- delayed_on: 50ms
- delayed_off: 8s
on_press:
then:
- light.turn_on:
id: ring
red: 0
green: 1
blue: 0.7
effect: pulse
- button.press: chime_button
on_release:
then:
- light.turn_off:
id: ring
transition_length: 1s
- platform: status
name: Status
button:
- platform: template
id: chime_button
name: Ring
icon: mdi:bell
on_press:
then:
- if:
condition:
- switch.is_on: chime_active
then:
- switch.turn_on: relay
- delay: 0.3s
- switch.turn_off: relay
- platform: restart
name: Restart
output:
- platform: ledc
pin: GPIO2
id: led_red
- platform: ledc
pin: GPIO4
id: led_green
- platform: ledc
pin: GPIO16
id: led_blue
light:
- platform: rgb
name: Ring
id: ring
blue: led_blue
green: led_green
red: led_red
effects:
- pulse:
transition_length: 500ms
update_interval: 500ms
min_brightness: 30%
max_brightness: 100%
- random:
transition_length: 1s
update_interval: 1s
default_transition_length:
milliseconds: 200