Numeric_state automation suddenly fires constantly

Hi,

i’m a bit confused because this morning -without any changes to the config- one of my automations started firing every minute. It worked as intended (on change of the numeric value) for at least a year or so…

automation:
  - alias: "Benzinpreis niedrig"
    id: gasprice_notice
    trigger:
      - platform: numeric_state
        entity_id: sensor.gasprice_e10
        below: 1.70
    action:
      - service: notify.mobile_app_xxxxxx
        data:
          title: "Benzinpreis"
          message: "Benzinpreis ist bei {{ states('sensor.gasprice_e10') }}"

The sensor itself is a rest sensor which calls a file from my webserver. On webserver side nothing has been changed and the file is being generated every 30 mins there. Looks the same, timestamps are fine… so shouldn’t be the issue.

My impression was, that “numeric_change” triggers only fire when the numeric value changes… but now it fires constantly every minute… what am i overseeing?

Thanks
Peter

Share the history graph for this sensor during the time in question:

In your case the trigger fires when the value goes from above 1.7 to below 1.7.

If the value is constantly changing around this value it will constantly fire the automation.

Good idea, thanks. Actually that indeed looks a bit sketchy:


somehow the lines are dotted since 10 a.m. - which is the time where the constant notifications started.

Which should be fine, since thats exactly what i want - as soon as the price drops i get an notification. Thats how it worked all over the past months… so i will go and hunt for the cause of the line above being dotted… could be something on the network side. The automation should be fine.

Will update as soon as i found the root cause - thanks a lot for the hint :slight_smile:

Best
Peter

Oh yeah. It will also trigger from unknown (the gaps) to a value below 1.7.

You can filter these with a condition:

condition:
  - condition: template
    value_template: "{{ trigger.from_state.state not in ['unknown','unavailable'] }}"

Fixing the sensor would be best though.

1 Like

Shouldn’t that be to_state?
He says it started happening at 10, at that time it was above 1.7 so most likely the unavailable is converted to 0.

Another way would be to add a above also. below 1.7 and above 1.
I doubt the gas price will become that cheap.

No. The numeric sensor is triggering from unknown to a value below 1.7. Changing to unknown will not trigger it. Nothing is being converted, there are no float filters with (0) defaults here.

Why would it then start sending the messages at 10?
If you are correct then there shouldn’t have been a message before 11:52.
Since this post was created 11:18, we can assume a few messages has been sent prior to 11:52

Because the value at 10 is not below 1.7.

10:00, a time. Look at the graph

The value is not below 1.7 @ 10am so it will not trigger.

Only unknown to < 1.7 will trigger.

unknown to > 1.76 will not.

Focus…

Look at the graph. It shouldn’t have sent any notifications at that time. But it did.
So either something is fundamentally wrong with HA or it does trigger when unavailable

Did it really though?

Or did the messages start coming in at 11:25?

Done, makes sense :+1:

Yep, will investigate. In the meantime i tried to chill it via “timeout:60” and “ccan_interval:300”, so maybe thats fine until i find out the network issues:


Never had that before…

Thanks
Peter

Could be that i played around with the value during that time. I changed it from 1.75 to 1.70 to see if that makes a difference. Sorry for the confusion, i’m pretty sure it has something to do with the network side. Makes most sense since the automation was running fine and everything else also runs fine - so HA itself should be good…

Even if it did, that would be after this thread was created