Dynamic Blueprint for lamp(s) either as light or switch

I would like to write up a template blueprint that targets lamps, but in the blueprint there is no way of knowing if the lamp itself is hooked up though the light domain or the switch domain (personally I have a mixture).

The question addresses both the input section of the blueprint as well as the action section.

The simplest, but futile, attempt was just to have input select for either domain, but that failed on creation of the automation, not suprisingly.

in the target you can set the domain to lights then that will list only the lights

domain: light

where

domain: switch

would list all the switches

dont think you can mix lights and switches YET

this is my understand of blueprints

This is what I tried, but as stated, the automation editor will not create the instance unless all inputs are provided, so I’m good as long as the template addresses light AND switch.

Seems like I will need three blueprints for now, one for each possibility (light, switch or both). In time it might be possible to reduce it to one…

blueprint:
  name: Template, lights out evening
  description: Turn of light, eg at 23:30
  domain: automation
  input:
    turn_off_time:
      name: Turn off time
      selector:
        time:
    target_light_smart:
      name: Light(s)
      selector:
        target: 
          entity:
            domain: light
    target_light:
      name: Light(s)
      selector:
        target:
          entity:
            domain: switch

trigger:
- at: !input turn_off_time
  platform: time
  condition:
  - condition: state
    entity_id: input_boolean.gaster_hemma
    state: 'off'

action:
- type: turn_off
  entity_id: !input target_light
  domain: switch
action:
- type: turn_off
  entity_id: !input target_light_smart
  domain: light
mode: single

You can always configure the switch to be a light using the light switch integration.

1 Like

A near perfect solution :slight_smile:

The only “improvement” that I would be lacking is the option to not have to list all the switches in the main config file, but it can be a small price to pay in regards to the other benefits.