i try to create a script to simulate sunrise / sunset over all the connected bulbs.
Unfortunately in the Log i get the following error and the script is not working properly
17-03-04 13:59:45 WARNING (MainThread) [homeassistant.helpers.state] reproduce_state: Unable to reproduce state <state group.lights=None; rgb_color=[254, 91, 53], brightness=20, transition=9000 @ 2017-03-04T13:59:21.302311+01:00>
Does maybe anyone have a running script for sunrise / sunset simulation?
Hi Thorbeen, have you solved this problem? Iāve got RGBW Yeelights and have been using the Yeelight app to trigger a sunset sequence while Iām getting ready for bed. However, I now want to automate this using Home Assistant and not be reliant on a connection to the Yeelight Singapore servers. Iāve played around with the Flux platform but canāt set it up as part of an action that Iām controlling via an input.boolean trigger independent of the time when I trigger it.
This is 2 automations I have for some of my Yeelights. I know this is different in some way to what you are trying to achieve, but itās more so you can get how the light values work.
This one turns on the 2 lights, 30 mins before Sunset to a normal light about 4500k (yellow/white).
Then this one changes the color of the lights to Blue if a family member is home, and the sun sets
# Sunset - Steps & Table Turn Blue #
- id: Sunset - Steps & Table Turn Blue
alias: Sunset - Steps and Table Turn Blue
trigger:
platform: sun
event: sunset
condition:
condition: state
entity_id: group.family
state: 'home'
action:
service: light.turn_on
entity_id:
- light.steps
- light.table
data:
brightness: 60
rgb_color: [0,0,255]
transition: 3
You will notice that the Blue color setting has an RGB value and the āwhite lightā setting uses a color temp value, which is read in mireds. To obtain the mired number, you divide 1,000,000 by the Kelvin color temp you wish to dial in, in my case it was 4500k, so that gives me a mired value of 222 which becomes the value used for color_temp.
You could use the above automation and adjust the transition time to what you want to bring the lights on slowly, or have them go off slowly based on a offset time before sunset/sunrise perhaps? I hope I am making sense, I understand me at least
I had some difficulties with my Yeelights when I first got them, so I hope this helps a little at least to get the color settings right.
On a side note, itās a pity the yeelight api call is not accessible from the hass service api ā¦ I donāt feel throwing myself in alone ā¦ wanna pair ?
@Thorbeenās approach is definitely the most explicit. Maybe chaining the scenes/transitions would effectively be a better pattern ?
It effectively comes close to the sunrise scene in the yeelight app.
It look cryptic, but for the gist: the bulb execute the specified composition of state transitions from time, colorspace values and brightness, yes ā¦ just like in home-assistant.
Donāt use my example as is, itās just a dumb example or the next shellcode.
But this is just scratching an itch, again, Iām pretty sure itāll evolve towards Thorbeenās pattern.
When I run the shell command in a script nothing happens. I created a file with the script in home assistant directory and Iām using a script to call the shell command.
What would be interesting is ā¦ crunching some cropped yt videos and extract normalized rgb and/or brightness values from the timelapse to a timeserie.
Wait a minute (sorry, right brain switch) ! We could leverage this boblight pet project that I mention in post#3 for that !