Automation Trigger Problem

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”. :slight_smile:

Here is the automation code:

- alias: Omer Oda Termostat Bataryası
    - platform: numeric_state
      entity_id: sensor.omer_oda_batarya
      above: 10
        hours: 1
        minutes: 0
        seconds: 0
    - 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.

Maybe by using “below: 10” instead of “above: 10”???

OMG!!! Let me try…