Some quick testing this morning and it works well! Super clean way of doing it, and quite straightforward, appreciate the detailed instructions!
Hey, Thanks for all the work so far.
Got a bit of a question for you. I live in Norway, so when using sun elevation settings, simply using a time based trigger wont work. As well, the sun rising and setting has a large variation between summer and winter.
So instead, to trigger it, i use a threshold sensor, and set the elevation about 5% more than what i want when starting to set, so in practical terms, i set the binary sensor, so that the sun is 20% over the horizon, using the sun integration in home assistant, which gives current elevation.
When the sun dips below 20%, the binary sensor turns on, it stays on until it goes over 20%.
So far, this has worked great for turning ON the lights, see I want my lights to turn ON when the sun goes down, and off when they come up. I am using elevation inverted, and as i said the ON works greatā¦ itās the OFF
It doesnāt seem to happen.
What iām expecting, is that whilst the binary sensor is on, the automation is running, constantly checking the elevation and updating the lights accordingly, but what I think happens is that only when the binary sensor turns from OFF to ON does the automation run, until the lights get to 100% then it stops the automation.
So I am going to experiment with an inverse of the binary sensor, one that turns ON when the suns elevation rises above say, -10% where the llights should start turning OFF when the sun goes from -5% to 5%
Thoughts?
Hi Daniel, welcome to the community.
I would do it like this;
Step 1: For the trigger, you have several options. The goal is to have the trigger activated well before sunset and remain active well after sunrise. 2 options are;
-
Option 1 - Schedule helper: Set the time as suggested. For example, you could configure it from 4 PM to 10 AM. Once created add it into the trigger.
-
Option 2 - Toggle helper: To add a toggle helper into the trigger. Then keep your toggle helper on 24/7, and the trigger will stay active.
- To add a toggle helper into the trigger, first add any entity as the trigger.
- Then, click on the three dots in the top right corner and select āEdit in YAML.ā
- Replace the trigger entity with your toggle helper entity ID and save the changes.
Create a helper go to;
- Navigate to Settings > Device & Services > Helpers tab at the top.
- Click the Create helper button.
- Create the schedule or toggle helper as your chose.
Step 2: Set up the sun elevation condition.
- Sun Elevation: In the blueprint, enable it and set up your elevation setting. I see you know what to do here.
Now it will be triggered on sun elevation and you can easily set it up in the blueprint. No need for your threshold sensor or any other sensor
Let us know how you go.
Blacky
I can not import this blueprint automatically or manually(create file, copy raw text from gist). Any ideas why? Thanks
Invalid blueprint: extra keys not allowed @ data['blueprint']['input']['ambient_settings']['collapsed']. Got True extra keys not allowed @ data['blueprint']['input']['ambient_settings']['icon']. Got 'mdi:theme-light-dark' extra keys not allowed @ data['blueprint']['input']['ambient_settings']['input']. Got {'include_ambient': {'name': 'Use The Ambient Options (Optional)',...........
Hi Sergey, and welcome to the community.
You are on a old version of Home assistant. You must be on Home Assistant Version 2024.6 or later. Please update if you can.
TIP: Best to do it automatically using the import blueprint button. Then it will be easy to update later.
Blacky
Hey, thanks for the reply, however youāve missed the key part, I live in Norway, far north, like its summer right now, and the sun doesnāt start setting till 10pm, in winter thats more like 1pm
edit: To elaborate more on this, right now, sunset is at 10-11pm, and rise is at 1-2am
in winter thats more like, sunrise at 10-11am, and sunset at 1-2pmā¦ see the issue?
The variation there is too much. So the issue ISNT the start, but the second part, hence using the suns elevation to enable a binary trigger similar to an on/off functionality of the schedule triggerā¦
The issue is, even if i used your schedule helper like you suggested, the lights arenāt going off in the morning, just on at night.
So without digging into the yaml, iām curious did you set some kind of "wait for x hours " between the sun set, to the sunrise? because if so, that wont work here.
Omg, so easy fix. Thank you. Will do it
Then you can use the toggle helper and leave it ON 24/7. The sun elevation condition in the BP is what will actually turn it ON and OFF not the toggle helper.
That is what is used in the blueprint and why I did it that way. It uses sun elevation.
Have I missed something? I think this is what you are asking.
Do you think there could be a bugā¦ I have tested this many times so it should work. I am running a test now. Stay turned.
Blacky
I just ran a live test and it worked perfectly and instantly as soon as the sun elevation changed, no delay. Lights turned OFF. I know the light turn ON because I use that everyday so I donāt need to test that.
Blacky
Ahh great, iāll just leave it on 24/7 then thats what i was hoping for.
Yep, because your worst case is sunset 1pm to sunrise 11am that only leaves 2 hours so just have it ON 24/7. Then use the sun elevation condition in the blueprint to turn the light ON and OFF.
You could also just use this blueprint Turn Light, Switch or Scene On & Off with Trigger Conditions and just use the sun condition.
Blacky
Thanks, however it seems that the sun elevation condition looks like a binary ON/OFF, iād like a transition.
edit: I think i need to use BOTH the optional sun elevation AND what iāve been using which is the dynamic settings.
One last thing, could you give the optional sun elevation settings a bit more of a range?
say, 15 to -15
Transition is used. Set it in the light control.
You can use toggle helper as the trigger 24/7, with dynamic lighting and the sun elevation. They will all work together.
Just type the number you would like and click save.
Blacky
Hey Blacky,
thanks for your fast response and suggested solution.
I previously implemented the bypass option 2 as proposed. However, I encountered the following issue: When I deactivated the night-mode entity in the morning (which was set as a bypass), the lights reverted back to the brightness level selected before the night-mode entity has been activated the evening before, even if absence was detected in the zone. As a result, the light remained on indefinitely, as long as someone entered the zone again, starting the trigger of the blueprint. Is there any alternative solution?
Lukas
Lets start again.
Okay that all good and working.
Try not doing it this way. Try to just use the bypass option 2 rather than using night lights and setting the brightness to 0%. Your night-mode entityā¦ what is this? If it is something you turn ON then use it in the bypass. I use do not disturb on my phone. Some people I talked to have a toggle helper and they call in something like āSleep Modeā. or you can have a button near your bed that you push.
This could be because you are using scenes. I have toggle helpers for scenes now. The input is just under were you select your lights in normal lights and night lights. You need 2 toggle helpers, one for normal lights and one for night lights. This is because a scene has no state and the automation has no idea if it is ON or OFF. The toggle helper resolves this.
What I would do is probably something like thisā¦ but I could be totally off the mark of what you are trying to do, so please forgive me if I get it wrong.
- No scene at all, have it trigger normal lights 100% brightness (or whatever you like).
- When you trigger the bed area, use this as a state condition for night lights and set the brightness to 20% (??). Make sure you also select āIf lights are ON, adjust the lights when crossing overā in night light control.
- Some type of entity used for sleep mode, whatever you like and put it into bypass option 2. Turn it ON when you go to bed, turn it OFF when you wake up. Some people use bed sensors, I use do not disturb on my phone, some people use a toggle helper what every you like.
I think this will do what you would like.
Blacky
Just a suggestion, add option for sunset and sunrise, with time settings. For example switch on light at sunset - 1h, an hour earlier that sunset, you get the idea. Would be more useful than elevation in my opinion, and easier to customise the timings!
The FAQ has an explanation on why sun elevation is the recommended approach here. Itās easy to use and works pretty well!
Thanks for your suggestion, as @Nuwanda said you will find the link to the sun condition. I have also just updated it to reflect all the questions I have had in the last few post. You will find why I did it like this by clicking here.
A good example of why I used it is in this post recently click here
Blacky
@Blacky Hi, not sure when this started happening, but when I turn on my main kitchen lights during the day, my cabinet and floor lights come on. I donāt want this to happen, this should happen only after sunset.
alias: Kitchen Motion Light
description: ""
use_blueprint:
path: Blackshome/sensor-light.yaml
input:
motion_trigger:
- binary_sensor.kitchen_motion_sensor_occupancy
include_sun: sun_enabled
time_delay: 1.5
end_scenes:
- scene.kitchen_motion_light_off
include_night_lights: night_lights_disabled
light_switch:
entity_id: scene.kitchen_motion_light_on
sun_elevation: 0
light_transition_on: 0.5
motion_bypass_lights_off: []
motion_bypass_lights_on:
- light.kitchen_lights
include_bypass:
- bypass_enabled_turn_on
any ideas why, or is this bug ?