Flashing firmware

Online flashing

<< use this button to install the default firmware ESPHome 2022.10.0

The YAML code

---
substitutions:
  device_name: doorbell
  
esphome:
  name: ${device_name}
  platform: ESP8266
  board: d1_mini
  project:
    name: zuidwijk.doorbell
    version: "2.0"
 
wifi:
  ap:
    ssid: ${device_name}
 
captive_portal:

# Enable logging
logger:
 
# Enable Home Assistant API
api:
 
ota:

dashboard_import:
  package_import_url: github://zuidwijk/esphome-doorbell/doorbell.yaml@main

time:
  - platform: homeassistant
    id: homeassistant_time
 
text_sensor:
  - platform: version
    name: Doorbell ESPHome Version
  - platform: wifi_info
    ip_address:
      name: Doorbell IP
    ssid:
      name: Doorbell SSID
    bssid:
      name: Doorbell BSSID
 
sensor:
  - platform: uptime
    name: Doorbell Uptime
  - platform: wifi_signal
    name: Doorbell WiFi Signal
    update_interval: 60s
 
globals:
  - id: chime
    type: bool
    restore_value: true
    initial_value: 'true'
 
switch:
  - platform: gpio
    pin:
      number: D1
      inverted: false
    name: "Doorbell Relay"
    id: relay
    internal: true
    icon: mdi:alarm-bell
  - platform: restart
    name: "Doorbell Restart"
  - platform: template
    name: Doorbell Chime Active
    id: chime_active
    restore_state: false
    turn_on_action:
      - globals.set:
          id: chime
          value: 'true'
    turn_off_action:
      - globals.set:
          id: chime
          value: 'false'
    lambda: |-
      return id(chime);
     
binary_sensor:
  - platform: gpio
    pin:
      number: D5
      mode: INPUT_PULLUP
      inverted: true
    name: "Doorbell"
    filters:
      # Small filter, to debounce the button press.
      - delayed_on: 25ms
      - delayed_off: 25ms
    on_press:
      # Only turn on the chime when it is active.
      then:
        if:
          condition:
            - switch.is_on: chime_active
          then:
            - switch.turn_on: relay
    on_release:
      # On release, turn of the chime.
      - switch.turn_off: relay        
 
  - platform: status
    name: "Status Doorbell"