#How would I determine whether the wait

1 messages · Page 1 of 1 (latest)

empty citrus
brisk pelican
#

Thankyou

brisk pelican
#

Hmm

#

Double click gets previous track, Single click gets nothing

#
id: '1706182946129'
alias: Wiimprevious
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: ad7c41666949b0c7cce5407345b8f200
    type: action
    subtype: brightness_move_to_level
    discovery_id: 0x84ba20fffe34c508 action_brightness_move_to_level
    id: trigger1
condition: []
action:
  - wait_for_trigger:
      - platform: device
        domain: mqtt
        device_id: ad7c41666949b0c7cce5407345b8f200
        type: action
        subtype: brightness_move_to_level
        discovery_id: 0x84ba20fffe34c508 action_brightness_move_to_level
    timeout:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
    continue_on_timeout: false
  - if:
      - condition: template
        value_template: '"{{ wait.completed }}"'
    then:
      - service: media_player.media_next_track
        data: {}
        target:
          entity_id: media_player.willsoffice
    else:
      - service: media_player.media_previous_track
        data: {}
        target:
          entity_id: media_player.willsoffice
mode: single
peak nexusBOT
#

To test an automation there's three stages you can follow. Testing the action, the condition and action, and the whole automation:

  1. Use Configuration -> Automations to find the automation and then select Run in the three dots menu. If this fails your problem is in the action: section, and details should be found in your log file
  2. Use Developer tools -> Services and call automation.trigger on the automation with skip_condition: false. If the first passes but this fails then the problem is in your condition: block
  3. Use Developer tools -> States to find the trigger entity, click the name, then change the state (at the top) to something that'll trigger the automation before pushing Set State. If this fails then the problem is with your trigger: section, or the automation is turned off (you can check that in Automations, automations that are turned off will show Disabled)

You can also see this section in the docs about testing and automation traces.

slow mural
#

So try changing continue_on_timeout: false to true so the automation does not stop on time out.

brisk pelican
#
condition: []
action:
  - wait_for_trigger:
      - platform: device
        domain: mqtt
        device_id: ad7c41666949b0c7cce5407345b8f200
        type: action
        subtype: brightness_move_to_level
        discovery_id: 0x84ba20fffe34c508 action_brightness_move_to_level
    timeout:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
    continue_on_timeout: true
  - if:
      - condition: template
        value_template: '"{{ wait.trigger == none}}"'
    then:
      - service: media_player.media_next_track
        data: {}
        target:
          entity_id: media_player.willsoffice
    else:
      - service: media_player.media_previous_track
        data: {}
        target:
          entity_id: media_player.willsoffice
mode: single
#

Still not working - should there be a choose condition in here?

#

Thankyou so much

empty citrus
#

That template...

#

That evaluates to "true" or "false", which isn't true or false...

brisk pelican
#

so the template is very very wrong

empty citrus
#

Well, broken because you included quotes

#

Remove " and try again

#

The docs sugggest

- if:
    - "{{ not wait.completed }}"
``` as your test though
brisk pelican
#

hmm. It still isn't differentiating betweem the single and double click

#

it jumps forward on both of them.

#

changing not wait completed to wait completed makes it execute the previous track command.

empty citrus
#

Check the trace

#

Also share the latest version of what you wrote

brisk pelican
#
id: '1706182946129'
alias: Wiimprevious
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: ad7c41666949b0c7cce5407345b8f200
    type: action
    subtype: brightness_move_to_level
    discovery_id: 0x84ba20fffe34c508 action_brightness_move_to_level
    id: trigger1
condition: []
action:
  - wait_for_trigger:
      - platform: device
        domain: mqtt
        device_id: ad7c41666949b0c7cce5407345b8f200
        type: action
        subtype: brightness_move_to_level
        discovery_id: 0x84ba20fffe34c508 action_brightness_move_to_level
    timeout:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
    continue_on_timeout: true
  - if:
      - condition: template
        value_template: '{{ wait.completed }}'
    then:
      - service: media_player.media_next_track
        data: {}
        target:
          entity_id: media_player.willsoffice
    else:
      - service: media_player.media_previous_track
        data: {}
        target:
          entity_id: media_player.willsoffice
mode: single
empty citrus
#

What does the trace show?

brisk pelican
#

Stopped because only a single execution is allowed at 25 January 2024 at 16:13:29

#

single click shows a path

#

double click results in a problem

empty citrus
#

Check the trace for a double click, and look at the previous run

brisk pelican
#

the 'wait for trigger' node was not executed and no further information i available

empty citrus
#

Not the one that had the stopped message, the one before that

brisk pelican
#

Triggered by the mqtt topic zigbee2mqtt/Kitchen/Living Room Music Remote/action at 25 January 2024 at 16:17:58

#

Hmm, is the mode wrong?

empty citrus
#

No

brisk pelican
#

I'm going to play around in the Jinga template tool