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

Tried a few different settings. Must be an iOS problem. I use 3 of these virtual scene switchers and have not gotten any of them to respond to the action button on the tile. No action button shows up on the browser based my SmartThings so have no other way to test. Not a big deal but it would be nice to have the feature. Using manually run routines for now.

The button should call the activateScene command with the argument mainAction, you can test that with the advanced website, at least so we can determine if the button is not running the action or is something else.

The tile button is cloud based since the SmartThings app is not local. And, well, so is the advanced website so the outcome will probably be the same.

It works when I run the activateScene>mainAction from advanced. IOS issue I guess. Appreciate your help

1 Like

Maybe you can report the issue through the SmartThings app.

The custom capability has not changed in a year and and it’s just a pushButton action so it should work.

Fun case number 9. Build an auto-repeat Step dimmer level while holding a button

Sometimes you need a way to auto-repeat something, for instance brightness steps of this virtual dimmer so you can mimic with buttons the behaviour of a smart dimmer when holding / releasing a button. Note there may be more ways depending on your devices, this is just one more alternative.

The EASY way: using TWO scene switchers

A switcher with one scene in circular mode is basically an auto-repeat, so use two, one for stepping up and another for stepping down. Just change these settings for each:

  • Number of scenes: 1
  • Circular max loops: 10

Then create the automations, quite trivial. For one, if Active scene is 1 then step up, for the other, if Active scene is 1 then step down. For the button held events run the Auto-cycle [>] and for the release the Auto-cycle [STOP].

That’s it, we can leave it here, thanks for watching :grin: .

The HARD way: using ONE scene switcher

I saw this comment trying to achieve the same result with only one switcher to reduce the device count. Although I implemented the auto-repeat in the driver, I found the idea amazing and challenging so I’ve replicated it and will suggest some optimizations.

The clever idea is being able to step up with Auto-cycle [>] and step down with Auto-cycle [<] using just a couple routines, the linear mode and a high number of scenes. When we sit in the middle, the half in one direction repeats the step down and the other half repeats the step up.

Let’s build it to achieve this especifically: two buttons, one for brightening (>) and another for dimming (<) and just a stop in the release action:

First things first, create the virtual switcher and change these settings:

  • Number of scenes to cycle: 21
  • Cycle mode: Linear. Will not loop
  • Targeted action window: 0 (at the very end of the settings, crucial for the reset)

Reseting to middle position

The idea is that scenes 1 to 10 step down and 12 to 21 step up, of course you won’t need 20 routines :grin: . If we are in 11, an auto-cycle in one direction will auto-repeat the step down and in the other auto-repeat the step up.

We need to reset the position every time, for that we can use the routine condition Auto-cycle: stopped and set Scene 11:

The actual stepping

This is conceptually easy since it’s just two routines:

  • If Active Scene is equal to or below 10 then step down 10%.
  • If Active Scene is equal to or above 12 then step up 10%.

But that won’t work if you create the routines in the app because SmartThings will not trigger the routine multiple times as it creates the rules as changesOnly: true and will only trigger one time for scene 10 instead of every time for 10, 9, 8, etc.

You’ll need the Rules API for that. If you create the routine in the app it’s basically the same JSON code that you can see in the AWA but removing the changesOnly line and those type lines.

Rule to auto-repeat the step up
[
  {
    "if": {
      "greaterThanOrEquals": {
        "left": {
          "device": {
            "devices": [
              "SCENE SWITCHER ID HERE"
            ],
            "component": "main",
            "capability": "panelorange55982.activeScene",
            "attribute": "scene",
            "trigger": "Always"
          }
        },
        "right": {
          "integer": 12
        }
      },
      "then": [
        {
          "command": {
            "devices": [
              "DEVICE ID THAT YOU ARE STEPPING HERE",
              "MORE DEVICES IF NEEDED",
              "YOU MAY HAVE TO CHANGE THE COMMAND TOO"
            ],
            "commands": [
              {
                "component": "main",
                "capability": "panelorange55982.stepLevel",
                "command": "stepLevel",
                "arguments": [
                  {
                    "integer": 10
                  }
                ]
              }
            ]
          }
        }
      ],
      "sequence": {
        "then": "Parallel",
        "else": "Parallel"
      }
    }
  }
]
Rule to auto-repeat the step down
[
  {
    "if": {
      "lessThanOrEquals": {
        "left": {
          "device": {
            "devices": [
              "SCENE SWITCHER ID HERE"
            ],
            "component": "main",
            "capability": "panelorange55982.activeScene",
            "attribute": "scene",
            "trigger": "Always"
          }
        },
        "right": {
          "integer": 10
        }
      },
      "then": [
        {
          "command": {
            "devices": [
              "DEVICE ID THAT YOU ARE STEPPING HERE",
              "MORE DEVICES IF NEEDED",
              "YOU MAY HAVE TO CHANGE THE COMMAND TOO"            
            ],
            "commands": [
              {
                "component": "main",
                "capability": "panelorange55982.stepLevel",
                "command": "stepLevel",
                "arguments": [
                  {
                    "integer": -10
                  }
                ]
              }
            ]
          }
        }
      ],
      "sequence": {
        "then": "Parallel",
        "else": "Parallel"
      }
    }
  }
]
1 Like

Hey!

Using two of these to monitor my sump pump. One is 60min cycle and one is 1min looping at 60. When my sump runs (signee power meter) I reset the scenes back to 1. Would love the ability to capture the last value before reset. Ideally I would like to compare previous scene to my now current scene to see if the cycle time has increased significantly indicating a potential failure of the pump. Have not figured out a good way to do this without a large number of routines to capture the value at the time the pump runs to compare later

There’s an edge driver to track time that probably fits better this use case:

Regarding saving values somewhere, maybe with Rules API you can copy the values to another driver, like this calculator, but I don’t think there’s a clean way without some routines.

1 Like

Been experimenting with the scene switcher since I got a few bilresa IKEA buttons.
In one instance I have a scene which changes colour and brightness of a group of 4 Nanoleaf matter over thread bulbs and then changes colour and brightness of a Nanoleaf M over T led strip.

When I use the scene switcher it seems that the scene runs quite slowly, with sometimes one device lagging way behind the others , it’s often the led strip, but not always. Executing the same scene invoking it from an Alexa routine seems to run faster. This seems odd to me and the reverse of expectations. I don’t think the scene switcher is slow to start executing the scene, but once executing seems slower to complete.

That’s weird since the switcher only changes the active scene number and anything happening after that is just SmartThings running your conditions and routines.

The so called “popcorn effect” is normal when trying to change the attributes of multiple lights since the hub sends individual commands to each light and they are not sent at the exact same time, especially if the hub is busy with more stuff.

SmartThings provides some optimizations for on/off and brightness when they all belong to the same group. There’s a huge difference between changing the brightness of 3 lights in a routine and changing the brightness of a group with those 3 lights.

If invoking the same manually run routine from Alexa (a cloud integration) has consistently less popcorn effect than invoking it from a local automation, my only theory is that SmartThings is doing some optimizations in the cloud that are not present in the local automation engine. More specifically, they may be grouping all the actions so the hub prioritizes sending the batch of commands as close in time as possible.

1 Like

Yeah. It’s odd. The scene is applying Power on, brightness change and colour change to 4 bulbs, so arguably that’s 12 operations, then another 3 similar for the light strip. Potentially 15 operations. Theres quite a variance though in execution. Some are fairly fast an other executions are much slower. Sometimes with one device taking up to roughly 30 seconds to change. I cant spot any pattern to it

Unselect the “Turn on” action, it’s not needed since the brightness command in Matter will also turn on the lights and having both will kill the fade-in so will look uglier.

BTW, in reddit someone from Nanoleaf said a Matter 1.4 update will be coming in early-mid 2026, that will help since they spam the hub too much with the reports and can impact performance in time-sensitive routines like this. In fact, that may be what’s happening here, if you switch scenes quickly, the hub might be busy with the reports from the previous scene.

1 Like

That may well be the case, there are 3 scenes in rotation. Just checked, only one of them has power on checked, the others didn’t. Sometimes I need to press scene switch 3 times to cycle to where I want because if the scene is changed directly by Alexa using voice the actual scene is out of step with what the switcher “thinks” is the current scene.

You can use Alexa to change the switcher scene instead of directly changing the lights so it is in sync.

For that you would need a manually run routine that runs the “Scene 1” or 2 or 3 in the switcher and invoke that from Alexa.

1 Like

Are you @mocelet using in both cases SmartThings Lighting group (or individual lights)?


Edit:

I did some tests.

Lighting group execution location is local.

Simple ST App routines and RulesAPI rules involving Lighting group are executed locally. More complex RulesAPI rules involving Lighting group are executed in the cloud.

In my opinion, all group routines used to be cloud-based.


Edit 2:

If Lighting group is used as a condition, the RulesAPI rule becomes cloud-based.

1 Like

Yeah, they were added last year

There’s still no local toggle (Turn On or Turn Off) though.

Groups also use the native handlers for on/off/brightness so they’re super fast and I believe they are optimized so they are even faster than addressing the individual lights.

That’s why I hope they will also add the step capability to groups and native handlers, will be a day and night difference.

2 Likes

It’s definitely not the scene switcher, I tried binding two of the scenes to double click and held respectively on the bilresa, They are equally sluggish.

Might try it with another scene listing each device directly rather than using the group. I’d thought poor performance from a lighting group was mostly a zigbee thing :thinking:

1 Like

Yeah, it’s SmartThings automation engine and the fact that SmartThings does not use native Matter groups and instead just sends individual commands to each light.

Funny that you mention Zigbee since in a recent hub firmware update they stated they were using native Zigbee groups to avoid the popcorn effect with Zigbee lights.

Still, if you find a consistent, replicable, difference between a local automation invoking a manually run routine and the same routine invoked from Alexa it’s worth reporting it so they look at it.

2 Likes