I am a new user of scenes and trying to fit it into our “current way of living”, were the family typically pushes wall-switches to turn on the lights. So I have started to create scenes that can be manually applied (see image below).
In this setup I created scripts that saves the previous light settings before applying a pre-configured scene, ie so tapping “All on” - will save the current setup (scene.create with snapshot_entities) and apply the “All on” screne turn on all lights. Tapping “Previous” will return to the previous setting (scene.turn_on with the created scene.before). Everyone is
But…that only works if we move in and out of one scene at a time…so if somebody first taps “All on” (maybe by mistake) and then “Movie”, tapping “Previous” will return to the “All on” scene. Most are
So (maybe) I am looking for ideas to save the light states before entering scenes (or maybe I need to look for some other ways). Any ideas or comments are welcome on how to accomplish this?
Is this a case of trying to overcome a problem that doesn’t exist given most people will probably remember which of the 4 choices was the one they were trying to return to?
I did something quite similar. I had 5 scenes (ranging from 'all off" to “all on”) that were auto-selected based on an outside lux sensor. I also had buttons to manually select each scene (essentially an override to the lux-based automation). I then created a button called “reset” which manually triggered the automation to re-select the ‘correct’ scene - useful after a manual selection, right? However, I quickly realised that no-one ever used that button because they were either happy with their manual selection or they simply set a new one that they were happy with.
Here is a scenario;
Wife and kids mostly control our lights using the wall-switches (having Shelly dimmers behind them) and not using any scenes. Later we might decide to watch a movie, but as we couldn’t find the remote control I apply the “All on” scene to look for it. After finding it I turn on the Movie scene.
After the movie finished I would like to go back to the light state that we had before we started to look for the remote control.
So maybe its a way of trying to bridge between wall-switch based light control and scene based light control.
Sorry, I thought that example was the scenario, not a scenario,
You need to find a unique real-world identifier that is unique to wanting to ignore the scene_create. For example, would it always be when the scene is only active for (say) 3 minutes? If so, you can set a 3 min timer when each scene is selected and have the script only scene_create if the timer isn’t running when the button is pushed.
Make the “previous” button call a “home” state not an actual stored “previous” state. When previous is pressed you load the state you created called “home” or default. Something like that. I have a light that I call a flicker state when a camera sees someone at the door, then it calls a default, home state after a few seconds to put things back to normal or default.
Thanks - your comments maybe me think a bit…and maybe this is exactly what you are suggesting but I couldn’t grasp…
EDITED: This became my solution;
I created an input select like “scene_is_active” to indicate if a scene is applied or not + a timer how long the snapshot scene shall be consider valid to revert to.
When user taps to apply a scene it runs a script; to check if “scene_is_active” = FALSE, then sets “scene_is_active” to TRUE + do a scene.create snapshot + start a timer of 3h + applies the selected scene.
If the scripts finds out that “scene_is_active” = TRUE, then just applies selected the scene (ie. don’t update the saved snapshot scene).
When user taps “Previous” - I revert back to the “snapshot scene” + set “scen_is active” to FALSE + cancels the timer.
If the timer finshes I set “scene_is_active” = FALSE. (as after some 3h I could consider he “previous” settings are old…).
Sorry if unclear description, if anyone is interested I am happy to share more.
Thanks a lot!
I combined your code with some of what I created already and it works nice.
The automation gets triggered when my android tv starts to play a movie. The only problem i’ve noticed is that the scene also gets triggered when the tv plays an intro or trailer in the menus.
Maybe off topic for this thread, but potentially it might work having a condition based on which app is playing the media? I see that on when my NVIDIA Shield plays there is property called app_name on the media player which is populated with things like “Disney+”.
One can manipulate the stateful scene config entities to control whether the scene restores previous state, calls another scene for off, or just turns off. This method allows one to effectively chain scenes together in multiple ways.