Wait for trigger not working in scripts/automations

In a more pedantic implementation there would be a closing state before a closed state for this exact purpose.

but before you throw in the towel, one thing you might try is to go to full open then to full close( maximize the amount of time closing) then look in the Dev tools states to see if there are any intermediary states you can key off of while it is traveling…

That state should be coming from zwave only. Now I would not be surprised if the device sends a closed right after the command. Then sends a closing. I’ve seen similar behavior with a fan switch which in the early days of zwavejs was causing issues, but they sorted it out. Turn on debug logging for zwavejsui, run the test and we should be able to see the sequence.

If you want to force a value read, use zwave_js.refresh_value. This call does not block until the refresh, so a delay of 200ms after may be neccesary. But this may give you a more accurate view of the value before going into the wait template.

I’m assuming the whole point of the automation is to get notified when the cover fails to close as instructed?

thank you. yes i already figured that. it never gets any other state than open or closed. even attributes like current_position are changed immediately after a service call and then adjusted as the cover travels.

1 Like

Thanks i will give that a shot. In the meantime i found a way (some ppl recommended this here in the forum) that works as expected by using a wait_for_trigger like this:

alias: testcover
sequence:
  - service: cover.close_cover
    metadata: {}
    data: {}
    target:
      entity_id: cover.ez_raff01
  - wait_for_trigger:
      - platform: device
        device_id: d75cba3cd07d400f5e12996a40a3e728
        domain: zwave_js
        type: zwave_js.value_updated.value
        property: currentValue
        command_class: 38
        to: "0"
    continue_on_timeout: false
    timeout:
      hours: 0
      minutes: 2
      seconds: 0
      milliseconds: 0
  - service: notify.signal_tom
    metadata: {}
    data:
      message: action after trigger
mode: single

This works exactly as it should in any situation. But (big BUT) it uses the device platform which for various reasons is not what i want/should do (as pointed out further above). i am unsure how to translate (if even possible) this to the state or any other platform. But i am not giving up yet.

Yeah maybe i should have said from the beginning what i am aiming for. So, this script is actually just for testing (hence the alias). What i am trying to achieve is to move a Cover to a certain position (e.g. close it) and then tilt it by using cover.set_cover_tilt_position.

BR
Tom

Maybe more like this…as the docs state:

alias: testcover
sequence:
  - service: cover.close_cover
    metadata: {}
    data: {}
    target:
      entity_id: cover.ez_raff01
  - wait_for_trigger:
      - platform: zwave_js.value_updated
        entity_id: cover.ez_raff01
        property: currentValue
        command_class: 38
        to: "0"
    continue_on_timeout: false
    timeout:
      hours: 0
      minutes: 2
      seconds: 0
      milliseconds: 0
  - service: notify.signal_tom
    metadata: {}
    data:
      message: action after trigger
  - service: cover.set_cover_tilt_position
    metadata: {}
    data:
      tilt_position: 49
    target:
      entity_id: cover.ez_raff01
mode: single

This does exactly what i am after without using a device_id

3 Likes