As far as i can tell, the HS_Color values are fine.
Looks like this borked the light.turn_on and the Media_player actions. No longer getting a change to green, nor flashing lights or the media playing.
Removing - service: script.save_lights brings back the expected function of the automation, minus the script.restore_lights since the save function is removed.
Can you invoke the scripts separately? E.g., go to the STATES tab of the Developer Tools page, find script.save_lights in the list, click on the “more info” icon to the left of it, and in the window that pops up, click on the EXECUTE button. Does that cause any errors (look in the LOGS tab)? Does it create the kitchencounter_lights.xxx entities (look in the STATES tab)? Do the same for script.restore_lights. Basically make sure these scripts work first before trying to figure out why you’re having problems calling them from an automation. Unless you’ve changed something in those scripts since you last posted them, I don’t see any problems with them. (And if you have changed them then you should re-post them.)
If you want me to continue helping you actually need to answer the questions I ask. Just showing me a snippet of a file that contains a couple of scripts does not answer the questions I asked.
Ok. BTW, the custom variables component I suppose has some nice features, but I’ve been using HA for over a year and have done just fine with HA’s built-in “variables” (i.e., input_boolean, input_number, input_text, etc.)
A similar functionality was just added to the core.
In release 0.103.0 a new parameter called snapshot_entities was added to the scene.create-service. This allows you to save the states of entities to a temporary scene and re-apply them by later calling the scene.
I was asking about the new scene creator with snapshot. - after tests it doesn’t have last “on” attributes, so workaround I use is to do 2 snapshots, first as the system is (mix of on, off) and then turn all lights on, and take the on snapshot, this way I can then do what I need with the lights (in my case flash the alarm lights), and when I’m done I first restore the on snapshot to re-set the on attributes, and then the other one to turn off what was turned off, and keep on what was turned on.
I was about to give the python script a go and saw your post.
I can confirm that the snapshot_entities worked for me. In case this helps others.
I have been using an automation for over a year now to turn on all outside lights for 10 minutes if any of my Ring cameras detected motion. Issue I always had was then I had to turn them all off, even if they were intentionally left on.
Taking snapshot worked perfectly for this, and was very easy to setup just following simple example from the link you gave.
It doesn’t work with light groups though, you need to list each entity separately.
Thanks for alerting us. Saved me a LOT of time. Since I had never set up python scripts before.
Downside is that I still don’t know how to do that.
Hi, thanks for sharing this. I was using python, but I had problem with colored lights which were off. The script was saving only on/off and not the color, so when i switched again i found colors that i don’t want. Could you please give me an example with the new double “scene snapshot” method? Sorry, newbie here