I started developing an add on blueprint about 4 months ago⌠maybe I should revisit it as it has been put on the back burner. I think it may help you but it is very raw and not finished. Maybe I will PM you and we can work through this together if your keen to do some testing.
Option 2 & 4 are turn On actions but are doing 2 different things
This is very complicated as there are so many scenarios. Right now I canât see it working. I will look into it butâŚ
Your general question is one I have on my listâŚI donât like to promises anything⌠I have it in my thoughts⌠thanks for all your suggestions and input.
Just to give you some understanding. I know what the logs are and what it relates to. I simple terms HA added a new way for us to write code and gave us some time to do so. I waited 3 months after the added the code to give everyone time to update. HA did this about + 6 months ago so it is not new. If we didnât do this the blueprint would probably be broken now. Because you have updated I am trying to get your HA to see this code by rebooting it. Hopefully it will work on your system. Just thought I would give you some info so you can be assured that it is within your system and not the blueprint.
I am more than happy to help in any way. Please let us know if this resolved your problem.
May I follow up with a recent question I had in mind after testing a bit more. What is the behavior of this blueprint if a light included in the lights to trigger is already on. Does the automation stop there or does it just overwrite everything with the âturn onâ setting.
Could you please provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can help. 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.
Hi Harry, Everything you said is perfect and I looks like you are doing everything correct
Would you be so kind to provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can help. 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.
Add your lights in as entities and select your dynamic lighting options. Then in âScenes - Scripts To Turn OFFâ add a scene with your lights at 10%, now they will turn off at 10%. Then set your sun conditions the same as the other automation and you should be good to go.
If the blueprint triggers the light ON and if it keeps getting triggered and the light is ON it will stay ON. You can adjust the light brightness etc once it is ON and it will stay that way until the light goes OFF. If the automation is triggered ON again then it start all over again. This is how it is designed to work or you will never be able to change your lights brightness, etc once it is ON.
This is just brilliant. This means my âoverwriteâ use-case (4th option) is implicitly handled by your automation. That makes thing a lot easier for now.
To achieve use-case âturn-on by switchâ (2nd option) I use your automation with delayed bypass OFF after i.e. 60min. So its only up to me, to handle the âturn-off by switch with cooldownâ (3rd option). I do this with the help of a script I wrote. I will test the next days and give feedback.
Also, to mitigate issues with scrambled âinput_booleansâ for turn on/off bypasses, I temporarily created an automation that resets everything every night.
Nice one Felix, your getting the hang of the blueprint⌠thanks for your feedback. It is quite powerful, once you know how to make it work. Fully understand it is a lot to take in on first glance.
Thanks Harry, I can see some old YAML in there relating to the by-pass that will probably be the cause.
I could walk you through it but it is probably easer to just delete this automation and create a new automation as it will also clean up all your disable options and make your YAML nice and clean to read.
Best way to do this is first disable this automation (3 dots to the right of the automation and select disable). Then create a new automation and if needed you can always refer back to your disabled automation if you need to check any settings. Once you have your new one up and running you then can delete the old disabled automation.
I would like to change this so instead of the light turning off, it would just drop to 5%, I was planning of doing this by just adjusting the scene to 5% instead of off, But I would like to add a 2nd time off scene for between 23:00 to sun up, so that would turn off the light after no motion.
so
the light will turn on to 5% by a evening automation
for this automation
0 elevation to 23:00, on motion go to 100%, done by scene Back Garden Sensor Light, then on no motion go back to 5% done by scene Back Garden Sensor Light (Off)
the light will turn off by a good Night automation
23:00 to 0 elevation, on motion go to 100%, done by scene Back Garden Sensor Light, then on no motion go back to off
you support and the response times are incredible. Thanks for that.
Regarding your post I am replying to. Is this behavior true for Scenes and Scripts in âLights - Switches - Scenes - Scriptsâ?
I did a little testing today and it seemed like the scenes and scripts are triggered over and over even if the light did not turn off before motion was detected.
Hi @Blacky, thank you so much for this fantastic blueprint.
We really like the dynamic light control .
However, for us the control with time is preffered over the control of sun elevation (at least for now in winter ).
So Iâve adapted the brightness calculation in your script. Iâve no clue of programming, but for us this works (after adding the time to the blueprint and adapting you brightness calculation). Just in case someone can make use of it, here the adapted code snippet
{# Convert current time to total minutes since midnight #}
{% set current_time = now().time() %}
{% set current_minutes = current_time.hour * 60 + current_time.minute %}
{# Convert start and end times to total minutes since midnight #}
{% set morning_start = strptime(dynamic_lighting_morning_start_time, '%H:%M:%S') %}
{% set morning_start_minutes = morning_start.hour * 60 + morning_start.minute %}
{% set morning_end = strptime(dynamic_lighting_morning_end_time, '%H:%M:%S') %}
{% set morning_end_minutes = morning_end.hour * 60 + morning_end.minute %}
{% set evening_start = strptime(dynamic_lighting_evening_start_time, '%H:%M:%S') %}
{% set evening_start_minutes = evening_start.hour * 60 + evening_start.minute %}
{% set evening_end = strptime(dynamic_lighting_evening_end_time, '%H:%M:%S') %}
{% set evening_end_minutes = evening_end.hour * 60 + evening_end.minute %}
{# Determine brightness based on current time #}
{% if current_minutes < morning_start_minutes or current_minutes > evening_end_minutes %}
{% set brightness_value = dynamic_lighting_min_brightness %}
{% elif morning_start_minutes <= current_minutes <= morning_end_minutes %}
{% set brightness_progress = (current_minutes - morning_start_minutes) / (morning_end_minutes - morning_start_minutes) %}
{% set brightness_value = (dynamic_lighting_min_brightness + brightness_progress * (dynamic_lighting_max_brightness - dynamic_lighting_min_brightness)) | round(0) %}
{% elif evening_start_minutes <= current_minutes <= evening_end_minutes %}
{% set brightness_progress = (current_minutes - evening_start_minutes) / (evening_end_minutes - evening_start_minutes) %}
{% set brightness_value = (dynamic_lighting_max_brightness - brightness_progress * (dynamic_lighting_max_brightness - dynamic_lighting_min_brightness)) | round(0) %}
{% else %}
{% set brightness_value = dynamic_lighting_max_brightness %}
{% endif %}
{{ brightness_value | round(0) }}