#how to handle reoccuring event type states?

1 messages · Page 1 of 1 (latest)

silver berry
#

i have an automation which is using a entities event to trigger.
its a button and it shall trigger each time the button is pushed. Due to whatever reason it only has four states, three of them for long press, only one for short press. so if the second time in a row i am doing a short press, the event is not triggering anymore - what is the correct solution for something like this?

olive panther
#

You're using the event. entity, with a state trigger?

silver berry
#

yeah

#

alias: Dachfensteröffner
description: ""
triggers:

  • trigger: state
    entity_id:
    • event.hmipw_wrc6_0021e0c9a5d484_ch5
      attribute: event_type
      conditions: []
      actions:
  • if:
    • condition: numeric_state
      entity_id: cover.dachfensteroffner
      attribute: current_position
      below: 100
      then:
    • choose:
      • conditions:
        • condition: state
          entity_id: cover.dachfensteroffner
          state: open
          sequence:
        • action: cover.open_cover
          metadata: {}
          data: {}
          target:
          entity_id: cover.dachfensteroffner
      • conditions:
        • condition: state
          entity_id: cover.dachfensteroffner
          state: closing
          sequence:
        • action: cover.stop_cover
          metadata: {}
          data: {}
          target:
          entity_id: cover.dachfensteroffner
          mode: single
olive panther
#

Remove attribute: event_type from the trigger

silver berry
#

will do - for learning sake: why? 😄

olive panther
#

Because that is only triggering when attribute: event_type changes.

#

As you have identified, two button presses in a row do not cause a change in event type, and are so ignored.

silver berry
#

which wont be the case, its always state

#

right?

olive panther
#

If you don't specify attribute:, then it will trigger when the state changes

grim dew
#

you might want to add not_from: unavailable though

#

otherwise you will get false triggers when HA restarts and your event entity reverts to it's previous state

silver berry
#

❤️

#

thanks folks!