Issue with "threshold"-trigger

Hi all,

I’m trying to build a blueprint to get a nice shading for all my blinds.
But I’m a little bit confused as I’m trying to use a kind of threshold without creating any additional sensors.

So a stub of my code is more or less like this:

trigger:
  - platform: numeric_state
    entity_id: sensor.gw2000a_v2_2_0_solar_lux
    below: 60000
    id: trigger1
  - platform: numeric_state
    entity_id: sensor.gw2000a_v2_2_0_solar_lux
    above: 66000
    id: trigger2

condition: []

action: []

It’s trigging above 66000 and below 60000, so far so good.
But if it’s falling below 66000 and NOT also below 60000 the automation is “re-arming” the second trigger and as soon as it is again above 66000 trigger2 is fired again. And if I check something like this in the action part:

          conditions:
            - condition: trigger
              id: trigger2

it is true again. But I don’t like this :slight_smile: I just want to “re-arm” the trigger after it’s below 60000.

Any idea how to prevent this without creating any additional sensor?

Thank you in advance!

Adding a for value for each of the triggers can help some with bouncing issues. Another option would be to use the condition of the blinds as part of your conditions:

trigger:
  - platform: numeric_state
    entity_id: sensor.gw2000a_v2_2_0_solar_lux
    below: 60000
    id: trigger1
    for: "00:02:00"
  - platform: numeric_state
    entity_id: sensor.gw2000a_v2_2_0_solar_lux
    above: 66000
    id: trigger2
    for: "00:02:00"
condition:
  - or:
    - and:
        - condition: trigger
          id: trigger1
        - condition: state
          entity_id: cover.blinds
          state: closed
    - and:
        - condition: trigger
          id: trigger2
        - condition: state
          entity_id: cover.blinds
          state: open
action: []
1 Like