Needed some help to developed a smart mailbox using a d1 mini, esphome and home assistant. Got different examples on the internet, but none with esphome. I got the ground connected to RST with a switch to wake up the d1 mini from deep sleep, when the mailbox lid is open. But need to create a sensor that will turn on and off state for the mail box and send the info to home assistant.
Below is an example that I started creating, but template already doesn’t support the on_boot
### MQTT information mqtt: broker: XXX.XXX.X.XX discovery: true username: XXXXXXX password: XXXXXXX ### Mailbox open and close notification sensor: - platform: template icon: "mdi:mailbox" name: "Mailbox Lid" on_boot: - if: condition: wifi.connected: true then: - mqtt.publish: "ON" - delay: 700ms - mqtt.publish: "OFF" ### Battery Monitoring - platform: adc icon: "mdi:battery" pin: VCC filters: - multiply: 1.175 name: "Mailbox VBatt" unit_of_measurement: "V" update_interval: 15s ### Mailbox Wifi information - platform: wifi_signal name: "Mailbox WiFi Strength" update_interval: 15s - platform: uptime name: Mailbox ### DeepSleep deep_sleep: run_duration: 60s