🔆 Smart Light - Entity - Sun Elevation - Ambient & Time Triggers

Hi @Stevie , firstly welcome to the community :+1:.

This automation works when it passes through or over the trigger condition. So if you have a light sensor every time it passes over the set point it will turn the light ON and or OFF. If you have also set the time trigger then every time it passes over the set time it will turn ON and or OFF. The only global condition is weekdays.

The automation was developed as a lot of people just wanted a simple ON / OFF for a light with time. I added extra options to choose from when developing it if time was not your thing, like LUX, sun & binary sensor. You can choose weekday as a global setting so it could be used in a office environment were Monday to Friday you need the lights ON and OFF. Example: If using time option set the time to turn the lights ON at 8 am and OFF at 6 pm Monday to Friday.

Normally you would choose just one option.

So for what your trying to do, this automation will not work.

This works fantastic, really appreciate the blueprint!! I might tweak it to add the ability to control entities (door locks, garage etc) so I can have schedules like lock the door, shut the garage and turn off all the lights at a set time and unlock the doors and turn on lights in the morning. That would basically make this an all in one starter for any automation, really.

@jclendineng

Hi Joel, I will do an update to include any entity you like. Just update to Version: 1.4 and you will be good to go.

New update 1.4

  • You can now select any entity you like to turn ON and OFF not just lights, switches or scenes.

Enjoy

Blacky :grinning:

2 Likes

Hello, thanks for the script and the continued support!

I have played around with both the time for it to be active and the sun position, but it appears the light will turn on regardless of the time of day, instead of only when i am trying to define it. unless i am drastically misinterpreting it

which from an earlier post: The automation was developed as a lot of people just wanted a simple ON / OFF for a light with time. I added extra options to choose from when developing it if time was not your thing, like LUX, sun & binary sensor. You can choose weekday as a global setting so it could be used in a office environment were Monday to Friday you need the lights ON and OFF. Example: If using time option set the time to turn the lights ON at 8 am and OFF at 6 pm Monday to Friday.

It looks like it might not do what i was hoping (basically when a event in frigate is logged to turn on a light) I only want to turn on a light if a person is seen, not the millions of bugs in florida :slight_smile:

@mykpoz

Hi Michael, firstly welcome to the community.

This blueprint works with the actual trigger points (crosses over your setting). Example

You mentioned time and sun.

When the sun drops below the sun elevation or the “ON time” it will turn the light ON. If you enabled the option.

When the sun rises above the sun elevation or the “Off Time” it will turn the light OFF at that point. It is not a condition to only work when the sun is below the sun elevation.

It is the same for “Binary Sensor” and “Ambient Light Sensor”.

So the sun could turn the light ON when it goes below the sun elevation and then the time can turn it off. Example if you let the sun turn it ON and then you would like it off at 11:30pm you would set the sun elevation at say -1.5 and the light would come ON when it passes over this setting. Then if you would like it OFF at 11:30pm you would use the time and set the ON time to 11:29pm (the light is already ON so nothing changes) and the off time to 11:30pm. Light turns OFF. When the sun goes above the sun elevation it will turn it OFF but it is already OFF so nothing happens.

What I think your after is for the light to only come ON when it is dark or below the sun elevation. For this you would need to use my other blueprint called :bulb: Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time.

This is tricky… but if you have a CCTV camera that can detect humans and then send triggers for this and not the millions of bugs you have in florida it should work with my other blueprint.

Hope the helps you.

Blacky :smiley:

1 Like

It is actually working pretty much as I want now. :+1:

I would like to see a timer option for switching off lights. Now it needs two?? automations that might interfere as I see it but please correct me if I am wrong.
I want to use it with a ‘presence sensor group’ switch light groups on but when no occupancy it should switch of after X time.

Hi Stevie, that is good news :+1:

@zebrahosting

I think you may be after my other blueprint. Have a look at this one.

:bulb: Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time

Can it be made to accept any sensor?
I.E. Use a battery sensor to toggle a the smart plug where the charger is when the battery is below X%.
And disable when battery above Y% percent?

@beloso

Hi Tiago, have a look at another one of my blueprints called :snowflake: Temperature Control Exhaust Fan - Inverted. I think this is what you are after.

I’ll try it, it does seem to be able to accomplish my idea. But the name kinda threw me away xD.

Yea the name will throw you, but when saving it you will have the option to rename it.

Good luck and hope this helps you.

Blacky :smiley:

1 Like

Good point. I’ll do that.

Much appreciated for your work in these fine blueprints.
I use Sensor Light as well.

1 Like

New update 1.5

:warning: BLUEPRINT CODE UPDATE :exclamation:

Just a heads up if your still on a old HA version before you update.

From time to time Home Assistant update their code structure and the old code will become “DEPRECATED” stopping / breaking automations from working. It effected this blueprint about 4 to 6 months ago. I wanted to wait some time so everyone had a chance to update their HA version before updating the code as older HA versions can not run the new code. This blueprint has now been updated so it will still operate once HA remove the “DEPRECATED” code from their system. :wink: :+1:

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:

Enjoy

Blacky :grinning:

Hi

Is there a way of adding conditions to the trigger ? For example, I have an alarm system which is integrated to HA, so I want to trigger the lights based on

  1. The Alarm systems “sunset flag”
  2. The alarm systems mode (ie, dont trigger if set to night mode).

Thanks,
Eamon

Hi @Wexfordman

I would have to add this option in. Give us a few days so I can have a look at it and I will get back to you.

Blacky :smiley:

I have done this, before I update it could you confirm your “sunset flag” domain. If you are unsure what this is could you please copy paste the entity ID in here.

EDIT: Don’t worry I am going to change this so you can have any domain you like.

New update 1.6

:warning: Some work is required in this upgrade. Please see below on the steps required when upgrading. It is easy and not a breaking change.

Upgrade Features :new:

  • Binary Sensor: “Use The Binary Sensor Option (Optional)”, as been upgraded to “Use The Entity State Option (Optional)”. This now allows you to enter in any entity you like and not just a binary sensor. The entity still must have an ON / OFF state. Because of this update you will need to update your YAML as shown below.

New Features :new:

  • Global Condition: You can now add in any global condition you like.

:warning: :stethoscope: STEPS REQUIRED WHEN UPGRADING :white_check_mark:

If you have never selected to use a “Binary Sensor” then most likely you won’t need to do anything but you may want to check just encase you have selected “Binary Sensor” in the past.

1 - Upgrade your blueprint.
2 - Go into your automation (the ones using this blueprint). Click on the 3 dots top right and edit in YAML.

3 - We are looking for the words… “include_binary_sensor…” & “binary_sensor…”. If you don’t see them then you are all good, nothing to do. If you see them then read on.

4 - We need to delete the 2 lines, click save then the 3 dots and edit in virtual editor.

5 - Then you will need to enable the entity state option and enter in your binary sensor again into input entity.

6 - Click save, you’re done. Now just do the same in your other automations using this blueprint.

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:

Enjoy

Blacky :grinning:

1 Like