(Solved) Entity description

I’m experimenting with the Companion app (iPhone and Apple Watch) and I’m trying to create one automation that will trigger on certain actions and then chooses what to do based on that action. For some reason the verlichting_aan will trigger, but verlichting_uit does not. The thing I try to prevent is the need to create an automation for every trigger.

configuration.yaml

ios:
  actions:
    - name: verlichting_aan
      label:
        text: "Verlichting aan"
      icon:
        icon: ceiling-light

    - name: verlichting_uit
      label:
        text: "Verlichting uit"
      icon:
        icon: ceiling-light

automation:

alias: iOS - automatiseringen uitvoeren
description: ''
trigger:
  - platform: event
    event_type: ios.action_fired
    event_data:
      actionName: verlichting_aan
  - platform: event
    event_type: ios.action_fired
    event_data:
      actionName: verlichting_uit
condition: []
action:
  - choose:
      - conditions: []
        sequence:
          - wait_for_trigger:
              - platform: event
                event_type: ios.action_fired
                event_data:
                  actionName: verlichting_aan
          - service: script.verlichting_beneden_aan
      - conditions: []
        sequence:
          - wait_for_trigger:
              - platform: event
                event_type: ios.action_fired
                event_data:
                  actionName: verlichting_uit
          - service: script.verlichting_uit
    default: []
mode: single

I would utilize trigger ids and use those for the choose condition instead of using wait for trigger.

alias: iOS - automatiseringen uitvoeren
description: ''
trigger:
  - id: aan
    platform: event
    event_type: ios.action_fired
    event_data:
      actionName: verlichting_aan
  - id: uit
    platform: event
    event_type: ios.action_fired
    event_data:
      actionName: verlichting_uit
condition: []
action:
  - choose:
      - conditions: 
          - condition: trigger
            id: 'aan'
        sequence:
          - service: script.verlichting_beneden_aan
      - conditions: 
          - condition: trigger
            id: 'uit'
        sequence:
          - service: script.verlichting_uit
    default: []
mode: single

You’re a saint :slight_smile: Thanks

1 Like