Need help creating Blueprint trigger with optional inputs

So I want to build a blueprint with optional inputs.

input:
    person_entity_1:
      name: 'Person 1'
      selector:
        entity:
          domain: person
    
    person_entity_2:
      name: 'Person 2 (Optional)'
      default: []
      selector:
        entity:
          domain: person
          
    person_entity_3:
      name: 'Person 3 (Optional)'
      default: []
      selector:
        entity:
          domain: person

These are then held as variables

variables:
  person_entity_1: !input person_entity_1
  person_entity_2: !input person_entity_2
  person_entity_3: !input person_entity_3

I then wish to trigger when all the populated entities (i.e. not default value) are ‘away’. I thought this value template might achieve that but it never triggers. Any help?

trigger:
- platform: template
  value_template: >-
     {{ person_entity_1 != none and is_state(person_entity_1, 'away')
        and 
        person_entity_2 != none and is_state(person_entity_2, 'away')
        and 
        person_entity_3 != none and is_state(person_entity_3, 'away')
     }}

Is it not possible to use a value template in a trigger or is my syntax incorrect?

Anyone know?

Did you get this to work?

I’m no expert, but I think you might have to use trigger-variables. Check out the documentation here: Automation Trigger - Home Assistant

And this post might also be useful: How do you create optional !input triggers for A Blueprint Automation?

CC: @Eimeel

1 Like