I’m new to ESPHome after using ESP Easy and MQTT for the last year. My first project is to try and make a battery powered button with a D1 mini.
I have the code below which seems to work for putting the unit into deep sleep the I can press the rest button to wake it and right now it comes online for 5 seconds and then back to sleep.
What I can’t figure out is how to make a “fake” binary sensor that I can control in the YAML. As in it can wake, some yaml code changes the binary sensor value to 1, code waits a second or two, changes it back to 0 then goes back to sleep. Then I can use this sensor value in my automations. I have spent an hour going thru the docs and can’t find anything that relates to this.
esphome:
name: esphome-web-7ab100
on_boot:
priority: -100.0
then:
# - something here to set binary sensor to on?
- delay: 5s
# - something here to set binary sensor to off?
- deep_sleep.enter
deep_sleep:
esp8266:
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
sensor:
- platform: adc
pin: VCC
name: "VCC Voltage"