WTH! 😀 Howto: reference A Device/Area's state (On/Off/unavailable) with A "Target Selector"?

Because it never seem to load in my system. I think i need to use β€œ>-”, I don’t know? I will look into it tomorrow.
But onto a much more important things! @petro I think you have don’t it (i’ll do a heap of testing tomorrow) but I think I owe you a BEEPING BEEB more :coffee:
:pray: :grinning: :smiley: :grinning_face_with_smiling_eyes: :grin: :laughing: :joy: :slightly_smiling_face: :upside_down_face: :wink: :heart_eyes: :star_struck: :yum: :stuck_out_tongue: :stuck_out_tongue_winking_eye: :crazy_face: :stuck_out_tongue_closed_eyes:

They load on every system, it’s built into yaml. Your spacing needs to be correct. Notice how my templates are indented based on the field they are in.

field: >
  {{...
1 Like

:partying_face: The Final solution! :partying_face:

@petro you’re a LEGEND!

blueprint:
  name: A Test
  description: "A Variable State Test for Target Selector input"
  domain: script

  input:
    lights:
      name: Targeted Lights
      description: The Lights this Script is Targeted at.
      selector:
        target:
          entity:
            domain: light

variables:
  lights: !input lights
  entities: >
    {%- set ns = namespace(ret=[]) %}
    {%- for key in ['device_id', 'area_id', 'entity_id'] %}
      {%- set items = lights.get(key, [])  %}
      {%- if items %}
        {%- set items = [ items ] if items is string else items %}
        {%- set filt = key.split('_') | first %}
        {%- set items = items if filt == 'entity' else items | map(filt ~ '_entities') | sum(start=[]) %}
        {%- set ns.ret = ns.ret + [ items ] %}
      {%- endif %}
    {%- endfor %}
    {{ ns.ret | sum(start=[]) }}
  filtered: "{{ entities | select( 'search' , '^light' ) | select('is_state', 'on') | list }}"
  lights_on: "{{ filtered | count > 0 }}"
  transition: "{{ iif ( lights_on , 90, 0 ) }}"

sequence:
  - service: light.turn_on
    data:
      transition: "{{ transition }}"
    target: !input lights

:grinning: :smiley: :grinning_face_with_smiling_eyes: :grin: :laughing: :sweat_smile: :rofl: :joy: :slightly_smiling_face: :upside_down_face: :blush: :innocent: :star_struck: :yum: :stuck_out_tongue: :stuck_out_tongue_winking_eye: :crazy_face: :stuck_out_tongue_closed_eyes: :exploding_head: :partying_face: :sunglasses: :cowboy_hat_face: :nerd_face:
:pleading_face: I think i’m going to cry! :persevere: :confounded:

2 Likes