Avoid repeated automations based on conditions based on numerics

So with your help I managed to create an automation to send me notifications if humidity gets higher than 58%.

Problem is, I’m getting a notification if RH gets to 58.1%, then another at 58.3%, then 58.5%, and so on and so on.

I just want to receive a notification when that happens the first time (RH hitting >= 58%). Basically it’s like saying I want only release a notification, if atual RH >= 58%, and previous RH < 58%.

Is it possible?

alias: Controlo RH Guitarra
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.humidity_158d0001e4c4f5
    above: '58'
  - platform: numeric_state
    entity_id: sensor.humidity_158d0001e4c4f5
    below: '47'
condition: []
action:
  - device_id: e218275eaee44161976ae4a6baed6744
    domain: mobile_app
    type: notify
    message: 'Humidade Guitarra é {{trigger.to_state.state}}%'
    title: ''
mode: single

Your automation does exactly that, so I’m thinking there’s something you aren’t telling us

Ie how are you testing ?

I added this clarification:
Basically it’s like saying I want only release a notification, if atual RH >= 58%, and previous RH < 58%.*

Right now I releasing notification at all changes above 58%.

Yes,

And I Re-iterate. How are you testing ?

@Mutt Not testing manually,

The humidity is naturally increasing on that sensor so I’m getting notifications every 5 minutes. (58.5, 58.8, 58.9, etc)

That’s very interesting because, like Mutt said, the Numeric State Trigger doesn’t work like that. It is designed to trigger only when the temperature crosses the threshold of 58 and does not continue triggering as the temperature continues to rise above 58. However, you are saying that it does continue to trigger … which is not the way it’s supposed to work.

In order to re-trigger, it would have to first decrease below 58 then rise above it (or restart Home Assistant or execute Reload Automation). For example, this pattern produces three triggers:

57.4
57.5
58.2 <-- trigger
58.6
58.1
57.9
58.3 <-- trigger
58.8
58.4
58.1
57.5
57.7
58.1 <-- trigger
58.9

Are you restarting between triggers ?

Or is the sensor flakey and becomes unavailable regularly ?

That’s indeed the behaviour I want.

I clean up a little bit a restart the server and see if it goes back to the supposed behaviour.