diff --git a/doorbell.yaml b/doorbell.yaml index 549ae0f..2b1b7a3 100644 --- a/doorbell.yaml +++ b/doorbell.yaml @@ -1,6 +1,6 @@ esphome: - name: swablab-doorbell - friendly_name: Swablab Doorbell + name: doorbell + friendly_name: Doorbell name_add_mac_suffix: True esp32: @@ -18,16 +18,52 @@ 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: restart + name: Restart + - 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: bell_button + id: push_button pin: number: GPIO15 mode: input: True pulldown: True filters: - - delayed_on: 10ms + - delayed_on: 50ms - delayed_off: 8s on_press: then: @@ -37,12 +73,18 @@ binary_sensor: green: 1 blue: 0.7 effect: pulse - - button.press: chime_button + - if: + condition: + - switch.is_on: chime_active + then: + - button.press: chime_button on_release: then: - light.turn_off: id: ring transition_length: 1s + - platform: status + name: Status button: - platform: template @@ -51,9 +93,9 @@ button: icon: mdi:bell on_press: then: - - switch.turn_on: relay_chime + - switch.turn_on: relay - delay: 0.3s - - switch.turn_off: relay_chime + - switch.turn_off: relay output: - platform: ledc @@ -66,12 +108,6 @@ output: pin: GPIO16 id: led_blue -switch: - - platform: gpio - name: Relay Chime - id: relay_chime - pin: GPIO12 - light: - platform: rgb name: Ring @@ -81,12 +117,12 @@ light: red: led_red effects: - pulse: - transition_length: 600ms - update_interval: 600ms - min_brightness: 40% + transition_length: 500ms + update_interval: 500ms + min_brightness: 30% max_brightness: 100% - random: - transition_length: 3s + transition_length: 1s update_interval: 1s default_transition_length: milliseconds: 200