Now it’s clear to me why it worked for you and not for me (sorting of the scene names).
The new version is working as expected (unkown scenes are taken into account, the reset after works and the scene toggle loops).
thx for your efforts!!!
Now it’s clear to me why it worked for you and not for me (sorting of the scene names).
The new version is working as expected (unkown scenes are taken into account, the reset after works and the scene toggle loops).
thx for your efforts!!!
Works like a champ! It’s a very nice upgrade for my scene buttons. Thank you for sharing this blueprint.
Thanks you - working great!
Thank you for this BP!
I really love your work here, and this is the first solution for me to toggle between scenes easily. So thank you for that.
The only problem I am facing though, Is that I have made scenes for the living room and the bedroom in z2mqtt. The living room is working perfectly, but I cant get the bedroom to work. I have made the scenes scripts etc in the exact same way.
What can I be doing wrong here? I really dont understand.
If I look at the “traces”, It says
Error: Error rendering data template: ValueError: Undefined is not in list
The trace timeline says:
Hi, thanks for reporting!
Could you download and share the trace log first?
After that:
Were all scenes activated at least once? If not activate them and try again. But the trace log would be helpfull for me.
Don’t know if this works. If yes, I have to check this because I thought I had fixed this bug already.
I had this problem, too. Interestingly, only with static order mode = true and timeout = 0.
I debugged this a little and all scenes had an “Unknown” last activation date.
What I did to fix this: Disable the static order mode, run script once → works
Reactivate static order mode → works now.
I can deliver the trace if needed… but glancing over the code… if all scenes are Unknown, wouldn’t
scenes_sorted_by_activation
be empty and thus
{% set last_activated_scene = scenes_sorted_by_activation[0] %}
would be out of bounds?
Thanks for your investigation. The static order and unknown scenes was the hint I’ve needed. I revised the logic a little bit so the bug is fixed now.
@panhans want to switch to the hue dimmer v2 and now i have a dadicatet hue button to use.
When i disable static order, the order is based on timestamps of last activation.
I have noticed it sometimes changes order (depending on what scene was last used).
But you can’t expect the same order.
Example scenes:
When i disable static order and run the script on the hue button, sometimes the order is upwards (Night → Dimmed → Bright) and sometimes downwards (Bright → Dimmed → Night).
Nice would be an hybrid of the two modes like “Static Smart” or so.
What i expect would be:
This way, the scene selection would be really smart, it depends on the last selected scene and has an fixed order.
Example 1 (configuration order is like aboce):
Example 2 (configuration order is like aboce):
… and so on…
Hope this makes sense
Please let me know your thoughts.
thx
More or less a noob here.
I have 3 scenes set up to toggle through. I’m trying to map the script (entity as I understand) to a dashboard tile or button.
No matter what I try, when it does work* it pops up a window with a Run button (which works great!)… how do I get it to just run when I click the “button”.
Feel silly asking, but I have spent an embarrassingly long time trying to figure this out haha -tia
You need to set a tap action. The action type is call-service and the service/action is the script entity.
tap_action:
action: call-service
service: script.YOUr_SCRIPT
Hi,
First of all, great job on this script! Really like the code.
Now let me explain my current need, searched this topic for same question, but was not able to find any similar question.
Im using your script to toggle through the exisiting scenes I have in our rooms at home. It works pretty well, but unfortunately the last state (last scene used) is not stored in HA. Hence, when turning the light of and after a while activating the light again, it activates another scene. I was expecting, that same scene should activate, but it does not.
Fyi, I’m using SWITCH MANAGER from the HACS and a Hue dimmer v2. Set up the Hue Switch inside the manager that in case of initially pressing the ON button, it will turn the light on - it uses the action: light.turn_on function. Maybe that is causing my issues?
Thank you so much
Hello, I have managed to integrate this. Thank you for your efforts.
Unfortunately, I am not yet completely satisfied. I would still like to manage the following.
I have 3 scenes for the light and switch them through with the Ikea On/Off switch. When I get to the end, it starts again from the beginning. Great.
BUT
When I press Off. it switches the lamp off, but then it continues from the old position the next time. It should always start again from the beginning.
And I would like to change the color after switching off. I would like to set it when it is switched off, so to speak. Because it starts again from the old color when it is switched on and then there is such an irritating color change. What do you think?
Oh this sounds tricky. I have to think about if and how this could be implemented.
This is possible if you activate the static order and set a reset time. If not using the static order the first scene to activate is always the last one which was activated.
What color do you mean? I could implement a custom action and condition after a scene switch. So you can set there whatever you want.