⏭ Simple Scene Toggle

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!!! :slight_smile:

1 Like

Works like a champ! It’s a very nice upgrade for my scene buttons. Thank you for sharing this blueprint.

1 Like

Thanks you - working great!

1 Like

Thank you for this BP!

1 Like

@panhans

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:

1 Like

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

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?

1 Like

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.

1 Like