I’m new with ha so also with yaml configuration files.
What I want to do is really simple but even chatgpt isn’t abble to generate a correct script for this:
“I want my light to start 30min before sunrise with a luminosity of 1% and a température color of 2000 kelvins. When my lights are on, the luminosity should go up from 1% to 100% in 30min (until real sunrise in fact). Then when the luminosity is maxed out I want a progressive change in the color from 2000 kelvin to 4000 in 15minutes.”
At the beginning I thought it this way:
`alias: Test
description: “”
trigger:
platform: sun
event: sunrise
offset: “-00:30:00”
condition: []
action:
When I start this up my luminosity get to 100 in 4seconds, so I began to try it with chatgpt who made me a bunch of different versions also not working (with loops and so on) because the luminosity is getting to 100% too fast it has to take 30min.
Anyway if my light doesnt support long transition lighting, chatgpt made a script that bypass this limitation, it work a bit because it still fast when reaching the 100% luminosity but i have enough time to see the progress with my eyes (i think it start with 50% then goes up slowly) my only problem is that it start from 50% if it would start from 1% the script would be perfect:
With a quick search in this community you will find way better solutions to this. This code you shared generated by ChatGPT is useless… It will try to increase the brightness even when it is 100% or when you want the light off.
It might be good to help in your learning process though.
Which light you have? Maybe we can help more when knowing that info.
Really?
It only increases the brightness by 3% per minute.
It starts from the point where the light is… If you try to dim you light down to 10% this automation will push it back to 100% (and will try to go beyond) in a 3% increase/minute rate.
It would be nice if you select all the yaml block and then use this code icon from the dialog box in other to make easier for us to read the yaml you are sharing.
This looks much nicer than the way you shared above, and it is the same yaml, with the difference we can cooy&paste&try without having to edit the text, although still the same useless ChatGPT-generated automation ():
There was a typo (an unexpected blank space) on entity_id in the original yaml shared by @123. Please try this and if the error persists could you please share a screenshot of that screen with your YAML and this error message?
That’s due to a simple typo. There’s an unnecessary space character in the word entity _id. It should be entity_id.
If the light increases to 100% much faster than 5 minutes, then it doesn’t support the transition command.
ChatGPT has proven to be an unreliable source for automations and scripts. Please do not post non-functional examples created by ChatGPT. For more information, refer to this blog post.
If you want to dim/brighten a light over a long period of time, and it doesn’t support transition, then you will need to use a script that sends consecutive discrete commands. The problem was discussed and resolved in the following topic:
Here’s another solution to the same problem that also offers non-linear fading.
To recognize this device I just scanned into the mqtt zigbee window and it found instantly the device.
I also have a little card on my dashboard that enable me to set on/off , set the brightness and set the color.
Now I want to make it automatic through the automation yaml script and clearly there is something wrong with it, don’t know why a 300 transition set the light bright from 1% to 100% in few seconds but this made me search for hours and still not explainable.
If anyone has another clue about it, I also took a look at the “light fader by transition time” but it seems nothing happens, I’m also not sure I understand the whole script right.
Take a look on the links shared above. By taking a quick look I found this comment where it is explained by steps how to set up a script for that and how to call that script from your automation.
I had to download file editor and it seems it’s a system file, I pasted the function there I’m working on it and will give you feedback
EDIT:
Ok so, the code is successfully saved into scripts.yaml and inside configuration.yaml you can see this:
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
# Text to speech
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
So my scripts.yaml is included, but when I go to developper tool => services. It doesn’t show me the function “fade_light”.
EDIT: I had to reboot HA, the function works perfectly for luminosity ! now I have to find it for color