💡 Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights

Hey @Blacky I still owe you an answer here…
I was going to your guide and tried several things but this was not what i was searching for. So i found out that there is functionality to create scenese on the fly. (Scenes - Home Assistant)
With this it was very easy to create a automation for my needs.
Thank you anyway!

1 Like

Just discovered your blueprint, it works like a charm, thanks for all the efforts! It is capable of a lot more features than I actually needed, as I only was looking for entity based motion activated light with override (which this one does too). Installed it and worked immediately, the solar elevation angle is a nice additon, playing around with that. Shoutout to you for the great work.

1 Like


Thank you for you kind words :smiling_face_with_three_hearts:. Keep an eye out as a new update will be out in a day or two… we are just doing the final testing / QA.

Blacky :smiley:

Thanks for making this blueprint. It made setting up multiple light-related automations pretty straightforward.

@Blacky Here’s one thing I noticed while setting up an automation. This warning appears in the logs if you don’t define any night light entities:

Error evaluating condition in 'Hallway lights control': In 'condition' (item 1 of 6): In 'or' (item 9 of 9): In 'and' (item 1 of 2): In 'template' condition: UndefinedError: 'dict object' has no attribute 'entity_id'

Looks like there isn’t a a key check in the referenced condition block:

- condition: and # trigger by HA Restart & check if any lights are on
    - "{{ (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) or (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}"
    - condition: trigger
      id: 't9'

Interestingly enough, I only just noticed it after upgrading my HA instance to 2023.6.0 (yeah, I like living on the edge :smiley:).

Maybe it started popping up because Home Assistant Operating System now uses Python 3.11 (just a guess). :thinking:


Hi Petar

Thanks for the info :+1:. I also noticed it when testing and this has been fixed in the next release that will be out sometime today.

I have done all my testing on 2023.5.4. You should be good now :+1: :smiley:

New update 3.6

A lot of work has gone into this update so the conditions, sun, ambient & time can act as a trigger, as long as the main trigger (Trigger Sensor - Binary Sensors) is ON unlocking even more hidden options for this blueprint. This is useful when using a schedule as the trigger. Hope you all like it.

New Features :new:

  • Added the ability to use a schedule helper as the trigger. The schedule helper will allow you to select different time triggers values for each day.
  • Sun option will now turn lights OFF when the sun rises above the set value and the trigger is ON.
  • Ambient option will now turn lights OFF when LUX value rises above the set value and the trigger is ON. Note: It will only work when selecting your “Ambient Light Sensor - Site Conditions” to “NO - My Ambient Light Sensor is not affected by the Lights”
  • Time option will now turn lights OFF when time passes over the “end time” and the trigger is ON.

For pro tips on using the “times of the day sensor helper” and or a “schedule helper” as the trigger please see or FAQ.

Bugs Fixes :bug:

  • Fixed error log in safe guard HA restart condition.
  • Fixed error log in ambient condition.
  • Fixed bug in sun.
  • Fix bug in ambient.
  • Fixed bug in time.
  • Fixed bug in trigger.


Blacky :grinning:


Thanks for all the efforts with this blueprint Blacky!! All these new features are awesome. My most useful blueprint by far. I finally found the Donation link, I never really look at the links in the top of the blueprint. Not sure when you added the link but it sure would be embarrassing not to donate when I kept calling on you to add a donation link. Again thanks for the awesome blueprint.

1 Like


Thanks for your support :smiling_face_with_three_hearts:. The Donation link was only just added so your on the ball. I am glad you like the new features and there are more to come :+1:

Blacky :smiley:

1 Like

Thanks for this automation!
Any chances to use the sun option to drive the night lights?


Hi Pablo, yes this is 100% on the road map. I am just trying to work out the best way to do this (not the code just the best user-friendly way) and have a few questions for myself that I am trying to work out. Maybe I should ask the community.

Lately, I am always getting the following error once I trigger a sensor:

Error rendering variables: UndefinedError: 'dict object' has no attribute 'entity_id'
Source: components/automation/__init__.py:508

I tried different sensors, it is always the same error.

Hi @Danielki

Firstly welcome to the community :+1:

What version are you on? If you are not on Version 3.6 please update.

Q: How do you update the blueprint and not delete / recreate existing automations?

A Please follow these steps Click Here.

Please also make sure you haven’t enabled an option and not added a entity in the Bypass, Ambient , Zone & Night Lights. If you dont what to use the option please disable it.

Let us know how you go.

Hey @Blacky

Thanks for the quick reply. I am on the latest HA 2023.6.1 and I have also successfully updated your blueprint.
I have not added additional entities. Unfortunately, I still get the error on every trigger.

Hi @Danielki

Could you please provide us your YAML of the automation? To do this go into your automation, top right 3 dots, Edit in YAML, copy all the code, come back to the forum and in your reply at the top tool bar click on “</>” and paste code in there.

Just quickly, did you reload the automation as well. It is in the how to link above when updating. You need to check the version number is displayed at the top. Just checking for sure as this was one of the bug fixes in Version 3.6.


Blacky :smiley:

Hi @Blacky!

As per status quo:

  • By-pass: On
  • Check By-pass Option: Leave Lights On

Currently, if lights are on, they will stay on as the automation will stop.
However, if lights are originally off, they will not turn on.

To make the bypass behave more like a normal light switch, is it possible for the blueprint to turn the lights on?
I have not given it deeper thought if this case would lead to any logical issues.

1 Like

HI @samuelthng

Yes correct :+1:

You can turn the lights ON manually, but the automation will not turn them ON.

I can see what you are trying to do, and yes I like it. Thanks for the suggestion :+1:. Not promising anything but I reckon this will be in the next release. Now I have to do the code for it :wink:

Blacky :smiley:


Hello @Blacky

thanks for the great work. But I am doing something wrong or I have overlooked something.

HA. 2023.6.2
Blueprint 3.6

Occupancy triggers but in the flow of the automation I don’t see that the trigger was triggered in the automation.

I have checked Occupancy via developer mode which goes cleanly from off to on and from on to off.

Did I miss something?
if I make a simple automation with the sensor and Occupancy everything is ok and works

Hi @Blackymas

Thanks for all the information :+1:

Could you please expand ("< >") your devices down to entities as “Areas” and “Devices” are not supported. Once you have done that, you should see your triggers.



Let us know how you go.

Blacky :smiley:

Hi Blacky,

I’m on a mission to remove bugs from the HA instance. Here is one from this blueprint

Error evaluating condition in 'Laundry - Lights on motion': In 'condition' (item 1 of 6): In 'or' (item 9 of 9): In 'and' (item 1 of 2): In 'template' condition: UndefinedError: 'dict object' has no attribute 'entity_id'

7:21:53 AM – (WARNING) Automation

Here is the YAML for the only automation I use (testing it presently for wider implementation)

alias: Laundry - Lights on motion
description: Laundry - Lights on motion
  path: Blackshome/sensor-light.yaml
      - binary_sensor.md_laundry_group
      entity_id: light.laundry_white
    time_delay: 3
      - use_brightness
    light_transition_on: 0

that was the mistake - sorry and thank you

1 Like