I am reading the temperature, humidity and battery values with the MQTT protocol from ESP32 (ESPHome) and Xiaomi BT Temperature and Humidity sensor.
I use the IFTT service when the battery drops below a certain value. (ie. 10%)
However, sometimes the ESP32 cannot read the battery value and send NAN value. Therefore, automation is triggered incorrectly.
I use the FOR value for triggering setting in automation “if for 1 hour” to prevent NAN value.
But it doesn’t work as I expected. Incorrect information message caused by NAN comes “1 hour later”.
Here is the automation code:
- alias: Omer Oda Termostat Bataryası
trigger:
- platform: numeric_state
entity_id: sensor.omer_oda_batarya
above: 10
for:
hours: 1
minutes: 0
seconds: 0
action:
- service: ifttt.trigger
data: {"event":"HA-START", "value1":"Ömer Oda Termostat Bataryası Azalmış!"}
Am I using the FOR value incorrectly? How can I send the message “if the battery value drops below 10% for 1 hour”?
Thanks in advance.
Belek