Use target for trigger in blueprint?

Tags: #<Tag:0x00007f3270a50f60>

I want create a blueprint for alarm when I could select multiple motion sensor as trigger.

Any way to use target as selector and use in trigger?

I see that I can set in automation multitples entity_id, but, I don’t know how use the variable in blueprint.

1 Like

Same question! Two motion sensors should turn on / off the light…

1 Like

Someone? Any trick to emulate it?

It’s a bit sketchy but should work:

blueprint:
  name: Test blueprint
  description: Test multiple trigger selection
  domain: automation

  input:
    input_target:
      name: Entity state triggers
      selector:
        target:

mode: restart
max_exceeded: warning

variables:
  var_targets: !input input_target

trigger:
    - platform: event
      event_type: state_changed
    
condition:
  # Only look at lights going off to on
  - condition: template
    value_template: "{{ trigger.event.data is defined }}"

  - condition: template
    value_template: "{{ trigger.event.data.entity_id in var_targets.entity_id }}"
  
action:
  - alias: "Log to logbook"
    service: logbook.log
    data:
      name: Climate
      message: >
        Triggered by -> {{ trigger.event.data.entity_id }} 
        targets {{ var_targets.entity_id | to_json }}
1 Like

This works for me for multiple triggers including motion, but all three inputs need to be selected. In the event that you have less than three motion sensors you can select the same sensor twice or three times and it still works.

OPTIONAL/default: for the last two triggers indicating that they’re optional is a hangover. The blueprint/automoation will fail unless all are selected.

Should work for all binaries, but I’ve only experimented with two - motion and switch.

  input:
    trigger_entity_1:
      name: Trigger Entity No. 1
      selector:
        entity: {}
    trigger_entity_2:
      name: (OPTIONAL) Trigger Entity No. 2
      default:
      selector:
        entity: {}
    trigger_entity_3:
      name: (OPTIONAL) Trigger Entity No. 3
      default:
      selector:
        entity: {}

trigger:
  - platform: state
    entity_id:
      - !input 'trigger_entity_1'
      - !input 'trigger_entity_2'
      - !input 'trigger_entity_3'
    to: 'on'