⏭ Simple Scene Toggle

:next_track_button: SIMPLE SCENE TOGGLE v3 :previous_track_button:

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.

Updates

My blueprints
Scene based theatre mode
Simple scene toggle
Yet not another door/window/sensor open warning notification with auto close
Zone notification extended
Advanced scheduled heating control with calibration and window detection
More intelligent vaccum robot scheduling

12 Likes

In basic what I am looking for!
Script blueprint will turn on scene, but not will turn off. Any suggestions?

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.

Hey, its implemented. The link to the source code was wrong. Now it points to the main branch. The import button still works . Just have a look.

Hey Panhans,

Love this blueprint.

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?

Hey! yes, I could implement an exclude and an include filter. I will try it over the weekend.

//EDIT: Ok, I’ve updated the script. Now you can include additional scenes or exclude specific ones.

Works perfectly thank you.

I’m no longer specifying an area at all in my implementations, just going straight for including the scenes I want and that works.

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"

What is that about? Can you help please?

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 :grinning:
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.

I’ve reinstalled the script and unfortunetly scene transitions are still very slow ale take minutes :confused:

It seems transition time is not ms but seconds. (Scenes - Home Assistant)

Please update, check the transition time and test again. Thank you!

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?

Hey, thanks four your thoughts. I think it’s an idea for a new blueprint. Maybe I’ll find time in the next few days.

Works a charm, thank you kindly!!

1 Like

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.