Help with first blueprint - how to trigger when ANY light turns on, in an inputted target

I wonder if I’m asking something impossible or just can’t figure it out.
The goal is:

  • you select any # of lights
  • automation triggers when any of those lights turn on

What I’ve tried:

blueprint:
  name: Corey Motion Test
  description: Automate light with motion and timer.  
  domain: automation
  input:
    target_lights:
      name: Lights
      description: Multiple lights to keep in sync.
      selector:
        target:
          entity:
            domain: light


variables:
    light_data: !input light_data
    aux_motion_sensor: !input aux_motion_sensor
    target_lights: !input target_lights
    target_lights_are_on: "{{ expand(target_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0 }}"

trigger_variables:
  aux_motion_sensor: !input aux_motion_sensor
  target_lights_are_on: "{{ target_lights_are_on }}"

trigger:
- platform: template
  value_template: "{{ target_lights_are_on }}"
  id: lights_on
Template variable error: 'target_lights_are_on' is undefined when rendering '{{ target_lights_are_on }}'

Anyway to achieve this in a blueprint? Thanks a ton for any help!

The solution was to wait a few days and magically get an update to home-assistant (2022.4) that has multiple-entity select, which allows this request.

The input:

    target_lights:
      name: Lights
      description:  The primary lights to be controlled
      selector:
        entity:
          multiple: true

The trigger:

# Light turned on
- platform: state
  entity_id: !input target_lights
  from: 'off'
  to: 'on'
  id: lights_on
  variables:
    should_start_timer: True
3 Likes

This is the same type of thing I am trying to do :wink: