Quantcast
Channel: ESPHome - Home Assistant Community
Viewing all articles
Browse latest Browse all 1486

ESP32 - Performe only one measurement and go deep sleep

$
0
0

I am in the process of automating our mailbox.
The idea is to wake up the ESP32 with a reed contact, wait 10 seconds and then measure the distance in the box with the ultrasonic sensor HC-SR04. This value is then sent via mqqt.
Then go into deep sleep.

Now I have created a sensor, but it will now measure 10 seconds and send the values. But I want this behaviour:

  • Reed COntakt wakes up
  • ESP32 waits 10 seconds
  • makes only one measurement and send this value to MQTT.
  • goes deep sleep
sensor:
  - platform: ultrasonic
    id: postbox_distance
    echo_pin: GPIO4
    trigger_pin: GPIO5
# update_interval: 1s
    timeout: 4.0m
    name: "MailBox Distance
    unit_of_measurement: "cm
    filters:
      - multiply: 100
# on_value:
# if:
# condition:
# wifi.connected:
# then:
# - deep_sleep.enter: deep_sleep_cmd
deep_sleep:
  id: deep_sleep_cmd
  run_duration: 10s
# sleep_duration: 2min
  wakeup_pin: 33

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 1486

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>