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

thanks for that :slight_smile:

thank you :slight_smile:

@Dimmers

Your welcome.

Thanks for the awesome blueprint.

@Renzikushi

Welcome to the community :wave:

Your welcome :smiling_face_with_three_hearts:

FAQ - Schedule Helper & Time of the Day Helper + Pro Tips

Schedule Helper

The schedule helper lets you set a time based trigger to turn ON and OFF your lights. You can set different time for each day and have it trigger multiple times in any given day.

Times of the day sensor helper

The times of the day sensor helper lets you set a time based trigger to turn ON and OFF your lights. This is for the same time of every day.

How to create a schedule helper our a time of the day sensor helper.

  1. Go to settings / Devices and Services / click on the helper tab at the top, then click create helper.
  2. Then click “Schedule” or “Time of the day” and input your settings as required.

Pro Tips

What if you would like your lights to come ON when it gets dark or when the sun sets, to then turn OFF later at a given set time. You might like the light to come ON at a set time and turn OFF when the sun rises. You might like it to turn ON when the sun sets and turn OFF when the sun rises. You might like to use the ambient sensor rather than the sun. I will show you some examples below but there is just way to many options to explain them all. Hopefully this will help you understand enough to then start implementing your automations to suit your needs.

Our example goal is for the light to come ON when the sun sets and to turn OFF at 11:00pm.

  1. First you will need to create a schedule helper or times of day sensor helper as described above. Because the sunset time changes throughout the year we will also need to use the sun condition. Our helper ON time will be set to the earliest time the sun ever sets throughout the year. If the earliest time the sun will set is 5:17pm then it is safe to set the ON time to 5:00pm. Our OFF time will be 11:00pm.
  2. Once the helper is created we need to add this as the trigger.
  3. We then will need to enable the sun condition and set the sun elevation setting to our liking.
  4. Click save, and you’re done.

The lights will now turn ON when the sun sets and turn OFF at 11:00pm.

But what happens if you would like the light to come ON at 9:00pm and turn OFF when the sun rises in the morning.

  1. First you will need to create a schedule helper or times of day sensor helper as described above. Because the sunrise time changes throughout the year we will also need to use the sun condition. Our helper OFF time will be set to the latest time the sun ever rises throughout the year. If the latest time the sun will rise is 7:25pm then it is safe to set the OFF time to 7:30am. Our ON time will be 9:00pm.
  2. Once the helper is created we need to add this as the trigger.
  3. We then will need to enable the sun condition and set the sun elevation setting to our liking.
  4. Click save, and you’re done.

The lights will now turn ON at 9:00pm and OFF when the sun rises in the morning.

On how to set up a schedule helper and a visual example to use with a sun condition please click here.

But what happens if we would like the light to come on when the ambient goes below the set value and turn off when it rises above the set value.

  1. First you will need to decide what you would like for the trigger. You might like it to operate at different times on any given day, then you would choose a schedule helper. You might like it to operate the same time every day, then you would choose a times of day sensor helper. You might like it to operate 24/7 then you could use any suitable trigger that would set the trigger state to ON and never turn OFF. Once you have decided what trigger you would like, then just add it to the automation trigger.
  2. We then will need to enable the ambient options and set the settings to our liking.
  • If you would like your lights to turn OFF when the ambient value increases then your ambient sensor can’t be effected by the lights and the site conditions must be set to “NO - My Ambient Light Sensor is not affected by the Lights”.

In this example we will set our site conditions to “NO - My Ambient Light Sensor is not affected by the Lights”. Then set your LUX value.

  1. Click save, and you’re done.

Depending on what you have chosen to use in the trigger, the lights will now turn ON and OFF depending on you ambient light value setting.

I hope this helps you get a better understanding on how to use the conditions, sun, ambient and time to turn ON and OFF your lights.

Enjoy

Blacky :smiley:

Back to FAQ: Click Here

Back to “The Settings & Best Practice Guidelines” Click Here

2 Likes

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

@ChielB

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
  conditions:
    - "{{ (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:

@spideyfusion

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.

Enjoy

Blacky :grinning:

3 Likes

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

@geox19

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?

@pablopoo

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.

Thanks

Blacky :smiley: