Hi all,
I’m looking for a config that let me collecting data every one hour from battery powered ESPHome devices without using MQTT, with deep sleep enabled.
This config works:
esphome:
name: lol32-test
platform: ESP32
board: lolin32_lite
on_boot:
then:
- script.execute: consider_deep_sleep
substitutions:
ssid: !secret ssid
password: !secret password
wifi:
ssid: "xxx"
password: "yyy"
power_save_mode: none
manual_ip:
static_ip: 192.168.201.252
gateway: 192.168.201.253
subnet: 255.255.255.0
mdns:
disabled: true
captive_portal:
# Enable logging
logger:
level: DEBUG
# Enable Home Assistant API
api:
password: !secret esphome_secret
ota:
password: !secret esphome_secret
web_server:
port: 80
http_request:
useragent: esphome/influxsensors
timeout: 10s
sensor:
- platform: wifi_signal
name: "WiFi Signal Sensor"
id: testwifisignal
update_interval: 1s
on_value:
then:
- homeassistant.service:
service: input_number.set_value
data_template:
entity_id: input_number.huz32garage_cm
value: "{{ set_point }}"
variables:
set_point: 'return id(testwifisignal).state;'
- platform: uptime
name: Uptime Sensor
id: testuptimesensor
update_interval: 1s
button:
- platform: restart
name: "Test Restart"
deep_sleep:
id: deep_sleep_control
sleep_duration: 60min
binary_sensor:
- platform: homeassistant
id: prevent_deep_sleep_test
name: Prevent Deep Sleep
entity_id: input_boolean.prevent_deep_sleep_test
script:
- id: consider_deep_sleep
mode: queued
then:
- delay: 60s
- if:
condition:
binary_sensor.is_on: prevent_deep_sleep_test
then:
- logger.log: 'Skipping sleep, per prevent_deep_sleep'
else:
- deep_sleep.enter: deep_sleep_control
- script.execute: consider_deep_sleep
60 seconds delay is enough to guarantee communications between devices and HA, based on my tests. With lower times like 30secs, sometimes values are not updated.
Is there any way to force values update from ESPHome to HA, reducing current 60secs delay so saving battery energy?
Thanks,
-f