Use case
Maybe you own an one button remote e.g. an ikea button. Now you are able to map the script you’ve created with this blueprint to it in order to toggle through scenes with just one button push.
You can’t turn off a scene. A scene specifies the actual state of its entities.
Whats your purpose? You can specify in each scene the entities that should be turned off.
Or I can extend the blueprint for an ‘off-scene’, e.g a scene where all devices will be turned off specified by you and activate this scene before each scene toggle.
Hey is there anyway to add a scene transition time to this blueprint? When my lights toggle from their lowest brightness scene (about 3% brightness) to their highest brightness at 100% the snap effect is pretty jarring. If a transition time could be added it would allow you that 1-2 seconds between scenes to react and toggle to the next scene.
Would it be possible to change the way scenes are identified as part of the cycle group? Using areas I have situations where it picks up scenes I don’t want it to activate via the button press. eg I have a media room with 3 different light scenes, and 1 scene which is lights, amp, projector etc. I really want to exclude that last scene and only have it cycle the lights.
So in an ideal world, is it possible to be able to choose the scenes I want the blueprint to target, rather than the area?
HI, I installed your script but when I run it with simple 2 scenes I get an error message:
"Error: Error rendering data template: ValueError: Template error: as_timestamp got invalid input 'unknown' when rendering template '{%- set t = namespace(time = 0) %} {%- set s = namespace(scene = '') %} {%- for scene in states.scene if ((area_id(scene.entity_id) == area or scene.entity_id in included_scenes) and scene.entity_id not in excluded_scenes) %} {%- if ((as_timestamp(states[scene.entity_id].state) < t.time) or t.time == 0) %} {%- set s.scene = scene.entity_id %} {%- set t.time = as_timestamp(states[scene.entity_id].state) %} {%- endif %} {%- endfor %} {{ s.scene }}' but no default was specified"
I’ve updated the script. Can you please try the new version? I couldn’t recreate the problem, but I think it has something to to with scenes that were never triggered before so the state isn’t a timestamp but ‘unknown’. Please try the fixed version and be free to give some feedback. Thanks!
I reinstalled script and now it works perfect
Now my buttons are way more functional - Thank you Panhams
EDIT
I was too optimistic - first scene loads very slowly, so does the second one - it take minutes to change the scenes (transition time is set to default 100ms). I did not get any error messages.
I’ve updated the script again. But maybe I have to go another way . Instead of looping through scenes I have to use selectors. Maybe you try it again with the updated version.
Hi panhans, script sill does not work like it is supposed to. I have selected 2 Hue scenes:
1st is “night light” 10% brightness
2nd Is “concentration” 100 brightness
After running the script light turns on quickly - but not the scene I selected as first. Previous color of light turns on that was active before turning off the light - color blue 50% brightness in my case), switching scene does not work at all ;-(
The order you selected the scenes has no impact to the order itself. Selecting the next scene is based on its state (timestamp). So the next scene that will be activated is the one that was activated before the others.
I’m using your script and it works great, thank you for that!
But I’m also tending to like the idea that the scenes should have a fixed order with a timeout. For example if the script hasn’t been called for 10s, start again with the first scene.
What do you think?
Hello @panhans, I was really excited to give your bp a go as I’ve been trying to create a toggle for HA scripts but unfortunately it looks like your bp works on HA scenes only? Do you have any thoughts about extending your bp to cater for scripts as well? Thanks.