[Edge] Virtual Scene Switcher, more than a fun way to cycle through scenes

New update (2024-04-13T13:05:01.829076766)

After getting more insight about persistence, all Long Spanning Auto-cycles are now persisted by default so they may survive a hub or driver restart. The setting to specify a minimum time interval is no longer needed and has been removed. Long Spanning meaning 1 minute or more between scene switches.

I’ve updated the documentation on Long Spanning Cycles to reflect that.

Edit: By the way, I’m going to introduce breaking changes to the preset/recall feature that I guess nobody is using anyway since I didn’t even explain its purpose yet :sweat_smile:


New update: easy daily rhythms with preset/recall (2024-04-14T10:34)

Let’s say you want your “On” button to trigger the high brightness scene during the morning, a warmer scene during evening and something dim with colours at night. That’s a few routines checking if the button was pressed between X and Y hours to activate one scene or another.

Preset / Recall simplifies this not having to worry about time periods at all! If you know WiZ lights, it’s my rendition of the custom rhythms feature.

Preset/Recall concept: Preset Scene actions store the scene number in memory without activation, meaning the lights will not turn on when scheduled. The activation happens only when you press the button with the Recall Preset action assigned, typically the “On” button, effectively having a button with different behaviour during the day.

A two-step process:

  1. Schedule a Preset for the scene when the period starts. For instance, after sunrise pick the action Preset Scene 1, later at around 15:00 Preset Scene 2, at sunset Preset Scene 3, at 22:00 Preset Scene 4. The periods are implicit and you don’t need multiple routines per room either, you can use the same routine that runs at sunset to preset scenes in the office, the bedroom and the living room.

  2. Assign the Recall Preset action to the button that “turns on” the room.

Now, every time you want to turn on a room, it will go into the scene belonging to that time of the day. All with few simple routines and no time period checks.

Would look like this:

Hope you like it! The old preset/recall mode in settings has been removed in favour of the new Preset and Recall commands, hopefully nobody was using the old mode yet.

Just like with the IKEA drivers I believe the Virtual Scene Switcher is feature complete now and fills the gap I found in SmartThings when it comes to scene management. From now on it will probably be bugfixes or minor additions.

Note that the driver, capabilities and presentations may need few hours to auto-update and until everything is updated it may not work as expected.

Edit: If you need extreme reliability, keep your time period conditions. This aims for simplicity in lighting scenarios. While the preset is persisted, it may not survive a sudden power loss of the hub. In that case, the previous preset or the default scene would be used.


Tutorial: Build a custom Wake-Up Machine

You can certainly do this with a virtual switch or with cloud services. The scene switcher is local, simplifies the routines and makes it cleaner and easier to test.

The idea is having a few scenes from the lowest brightness you can get, which in lights like my WiZ means using a red-ish colour at 1% (actually 10% because that’s WiZ minimum) and then ramp-up until a 100% cool white or another colour that gives you energy to start the day.

The Switcher settings for a Wake-Up sequence lasting 15 minutes:

  • Number of scenes: 15 (does not mean 15 routines)
  • Cycle mode: Linear
  • Auto-cycle section: Starting scene: Initial
  • Long Spanning section: Switching delay (minutes): 1

For testing let it stay in 0 minutes, we don’t want to wait 15 minutes to test the sequence each time if we can do it in 15 seconds.

The routines

  • Map the switcher active scene to actions. No need to create 15, that’s just an easy way to know that, if the whole routine lasts 15 minutes, the scene number matches the minute so you can create actions for scene 1, 3, 5, 10 and 15 for instance with gentler changes at the beginning and more steep at the end if you haven’t woken up.

Scheduling the wake-up

  • To start the wake-up machine, schedule the “Auto-cycle [ > ]” action. For testing you can use the dashboard button, configure the Dashboard button action as “Smart Auto-cycle [ > / Stop ]” or as Looping Next to go one by one.

It will automatically finish in the last scene unless you run the “Auto-cycle [ STOP ]” action. I have a routine that calls it when the light Turns Off so that’s my way of stopping the wake-up cycling if I don’t want it to continue.


Hi mocelet…
Great and amazing work… I’m very happy with your driver. For my own use it will be perfect if you can add/change only 3 things:

  • Next command should’nt stop auto-cycle.
  • Will be nice if we can use auto-cycle status (on/off) in routines condition.
  • Option to choose Smart Next/Prev in routines action.

Thanks you to share your work with the community.


Thanks! They’re good ideas, could you elaborate a bit more the use case for the “Next command shouldn’t stop the auto-cycle”?

In one case it’s easy, in other it’s not. The auto-cycle schedules the next change and calculates in advance how many switches it needs to meet the conditions like number of loops, ending scene, etc.

For example, if it has to switch to scene 4 in ten minutes it will schedule that change and do nothing meanwhile. If you mean that during those ten minutes you can change the scene with next / prev, that’s not a problem as long as you’re ok with auto-cycle switching to scene 4 as planned after ten minutes.

Yes… Is last case… I’m ok with auto-cycle switching planned but if in the meantime i push next/prev, i want the auto-cycle Switcher planned continues.

My scenario:
Some LED’s in the living room change through 15 colors(scenes) when i press a button (Next /Prev). If certain routines conditions are met, activate auto-cycle (Next/Prev) changing to next or prev color(scene) every 2 minutes during 3 hours.
I still want be able to press my button to Change next or prev color(scene) mantaining the actual auto-cycle running.

I hope i made myself understood… Poor English speak…

1 Like

I see, is it related to the other petitions (check if it’s running and the smart next/prev action)?

Is it circular or linear mode? I guess circular fits better your scenario.

I ask because, in circular modes, the Smart Next / Prev action is exactly the same as Next since in circular there is no “end”.

In auto-cycle there is no Smart Next / Prev action, that was only for the virtual button since there’s only one and would get stuck at the end in linear cycles. Did you mean kind of a Auto-Cycle Smart Next/Prev for linear modes?

For switching colors i use circular. I use another virtual Switcher for long press button that change brightness level. For this one i choose Linear mode but i will love to use Smart Next/Prev when long press is done. It’s perfect for brightness…
The ability to check auto-cycle status in routines condition is because i want use diferent brightness levels if auto-cycle is running or assign diferent actions for buttons.

This is part one of the incoming features so the auto-updates are smooth for everybody. Thanks for the feedback @Pyrylamo !

  • New option to select whether or not any action will stop an ongoing auto-cycle. By default stops with any action. When Stop action only is selected, manual or external scene switches are allowed during an active auto-cycle, although they will have no effect in the auto-cycle scheduled pattern.
  • New cycle mode: Reversing auto-cycle Linear. It’s a Linear mode with a twist. Auto-cycle will not finish in the end like in Linear but reverse the direction. It adheres to the settings for max loops and ending scene conditions. Useful for brightness control as well as effects like pulsing lights or even a KITT Scanner Bar if you have multiple smart bulbs and want that going forwards and backwards effect.

Recap of existing cycling modes

An example is always better, let’s say we have 4 scenes with the following settings:

  • Starting scene: Initial
  • Ends in starting scene
  • Max loops if not stopped: 2

This is what an Auto-cycle [ > ] action would do without stopping it, depending on the cycle mode:

  • Linear: 1, 2, 3, 4. no loop
  • Circular: 1, 2, 3, 4, 1, 2, 3, 4, 1. circular loop
  • Reversing: 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 1 KITT vibes!

Hi mocelet,
Thank you very much…
Now auto-cycle don’t stop when accidently press my physical button… Great… Just what i asked.
When i ask for Smart Next/Previous, i’m talking about a way to do what your dashbord button(Smart Next/Previous) do but whith my physical button… And you do it for auto-cycle!!
I’m also happy with this new addition… I’m planning now add new cool effects for my ambient LED’s…
Great job. Thanks…

1 Like

Part 2 of the update is live!

  • New routine action: Smart Next / Prev. It’s the same action you could assign to the dashboard button and they both share the current direction.
  • New routine condition: Auto-cycle started / stopped. The state is also shown in history.

While the auto-cycle state meaning may seem obvious, there are some subtleties:

  • Started: a scene switch is scheduled for the future, in other words, there is a timer running. By default, the first scene switch is done at the moment before setting any timer, so it’s normal to see the Started after the first switch. Sometimes you may not even see the Started at all if there was nothing to schedule, like when trying to do an auto-cycle next in a Linear mode being at the end.
  • Stopped: there is nothing scheduled, no timer running. Transitions to Stopped happen when:
    • Explicitly stopped with a stopping action.
    • Automatically stopped after reaching the ending conditions set.
    • Starting another auto-cycle, the running one is stopped first.
    • A hub or driver restart where the timer information could not be restored or was past due.

Hope you enjoy it!


Also added some quality of life improvements, will take hours to auto-update:

  • In detail view, auto-cycle state is displayed next to the current scene.
  • In the dashboard, the widget has active and inactive (dimmed) states. When the auto-cycle is running it displays as active and “auto-cycle” is displayed.

Note that sometimes SmartThings displays cached values so may not be totally accurate. You can look at the history too and filter by Auto-cycle events.

I believe it’s a useful feature for users of long-spanning auto-cycles or just for troubleshooting in general. It also makes the widgets less distracting.

1 Like

:clap: :clap: :clap: :clap:
Amazing!!! Thank you for all your effort. It’s now an amazing and very complete driver…

1 Like

Excelent idea :smiley:

1 Like

Fun case #8: Build a Tabata timer with rest and ending feedback!

Tabata is a type of high-intensity interval training or HIIT where you do a certain exercise for 20 seconds, rest for 10 seconds and repeat it for a total of 4 minutes. There are apps for that and you may remember the instructions for the Pomodoro timer with a similar concept.

Thanks to the recent addition of auto-cycle state as condition we can improve that Pomodoro base and make a proper smart and energising Tabata timer with colour lights to fuel your workout! With feedback halfway through the rest and feedback after the whole workout has finished.

Settings for a newly created Switcher

  • Number of scenes 6 (we’ll only make 4 routines)
  • Starting scene: Initial
  • Switching delay: 5000 ms (5 seconds, that will be our ticks)
  • (optional) Circular behaviour if not stopped: Ends right before starting scene
  • Circular max loops: 8

Pick a type of light for each phase. We need four different types of light, the choice of brightness and colours is yours!

  • High-intensity workout phase: I’d recommend a 100% brightness saturated colour like green to feel the energy. Or blue that helps focusing.
  • Start resting phase: Maybe a softer less saturated colour at 20%, like orange. Resting but aware because it’s not over yet.
  • Halfway resting phase: A brighter variation at 50%, but still low to feel the contrast when the workout begins.
  • Ended: You did it! Revert the light to normal, turn it off or pick a relaxing colour. Maybe announce something in smart speakers like “Congratulations!” :partying_face:

Now create the 4 routines:

  • If Active scene is 1 Then (light for start resting phase)
  • If Active scene is 2 Then (halfway rest phase)
  • If Active scene is 3 Then (workout phase)
  • If Auto-cycle is Stopped Then (ended phase)

Since switches happen every 5 seconds that will give us a 10 seconds rest and 20 seconds workout phase. All repeated 8 times for a total of 4 minutes.

To start the timer, either configure the Dashboard button action as Smart auto-cycle [> / Stop] or use your own smart button with the Auto-cycle [>] action assigned or any other routine that calls that action.

The preparation time will be the first “resting” period, but you can extend it if needed using the Delay this action option when running the Auto-Cycle [ > ] action from a routine.

1 Like

Hi mocelet,
Please explain me:

  • Additional random offset
  • Conditioned recall

Additional random offset adds a random amount of time to the delay, different each time. There are examples in this comment: [Edge] Virtual Scene Switcher, more than a fun way to cycle through scenes - #29 by mocelet

Conditioned recall is an undocumented feature, guess it’s documented now :see_no_evil:. While a regular recall activates the preset that was stored, a conditioned recall only activates the preset IF the current scene is the same than the previous preset. In other words, it only activates the preset if there were no changes since the previous preset was activated.

Read through this thread while sitting in a park and thought that I’ll spend at least an hour to set it up when back home.

Couldn’t resist and started then and there and when I came home, it just worked! Took about 15 minutes to create and configure the virtual scene switch and the routines.

Now I can dim my bedroom light with the STYRBAR button!

Thank you very much!!!