My first virtual device . Designed as a companion for smart buttons to easily cycle through scenes, it is not short on features like automatic cycling, random selection of scenes and even brings double-tap and beyond to any button.
I’ve been adding more features over time to fit multiple scenarios, at the end of the post there are links to fun use cases like blinkers, pomodoro timers, presence simulation routines, wake-up machines, etc.
Scene switching made easy: each Switcher manages a set of scenes from 1 to N. Scenes can be anything, they’re just a number and you create routines to assign actions to each scene like 1 turning on a light red. The driver handles the switchting with high-level actions and settings to define its behaviour.
At its core it is a specialised virtual counter with lots of extra features and scene-oriented design decisions that eliminates most boring work. Previously, just like other users, for scene switching I was using a combination of the auto-repeat feature of my IKEA button driver and the great Counter Utility by @TAustin which inspired this and actually helped me a lot to understand how virtual devices work.
Let’s start with the main feature, setting a simple scene-switching scenario to cycle through four colours pressing a button. It won’t take long to get crazy.
Install the driver from:
https://bestow-regional.api.smartthings.com/invite/Kr2zNDg0Wr2A
Create the virtual device:
- In the SmartThings app “Add a device” and “Scan nearby”. It will create a device called Scene Switcher. Let’s rename it to Colour Switcher.
- To create more, use the “Create Switcher” button in the switcher.
Perform the 3 steps to scene switching:
-
Set the number of scenes. Just go to the Switcher settings and change the number, by default is 4 so you can skip this step!
-
Map each scene number. In the Switcher routines tab click add routine. You’ll have to create four routines that will read like “If the Switcher Active scene is 1/2/3/4 Then (Run routine or Control devices)”. For testing let’s just try changing the colours of a light.
-
Assign actions to the buttons. The Switcher device is not short on commands, in your button pick “Next” as action to cycle forwards and “Previous” for backwards. You can also use the dashboard button with configurable actions instead of a physical button.
It’s done! You may have noticed it already saved you at least two boring routines to handle the circular loop in each direction. Let’s spice it up!
What if you want to…
… add more colours? Easy! Just change the number of scenes and assign the new actions.
… make it stop in the last one instead of looping? Sure, change the cycle mode to Linear. That’s useful if your scenes follow an increasing order, like brightness levels, you would not want to suddenly switch from full to lowest brightness.
… fight monotony with something less predictable than next/previous? Got you! Use the Surprise Me action and let the driver pick the scene for you!
… cycle scenes while holding a button? Glad you asked, auto-cycle has you covered! It is incredibly satisfying to see the scenes changing and just stop it when you like. There are settings to start / stop the cycling with buttons that don’t support hold/release.
… assign a colour to triple-tap even if your button has single-tap only? Yup! The driver has a special action called Register Pressed. If you call this action from your button, the driver understands it is a multi-tap sequence so it will wait until the sequence is over. If you press it three times it will activate scene 3. Neat, right? You can change the default waiting time for the next tap to fit your button behaviour. Supports buttons with native double-tap! Try 1 second delay and don’t forget to also assign the action Register Double to the double pressed event. You can have up to 1000x multi-tap
.
Those were just some ideas, some I use every day like the auto-cycling or the basic switching, others were implemented in my IKEA button drivers and now are available for every button. There are even features I haven’t even put in practice yet!
More fun things you can do:
This is a recopilation of comments I’ve been writing over time featuring multiple use cases.
- A light blinker or flasher, local and with sub-second delay!
- Add multi-tap to any button, tutorial.
- Simulate presence turning on different things at random times.
- Build a Pomodoro timer to increase productivity.
- Create a virtual button with double-tap!
- Set a daily rhythm to change button behaviour during the day.
- Build a custom Wake-Up Machine!
- Create a Tabata timer with smart lights to spice up your workouts!
Play around with the actions or take a peek at the source to see what you’re installing!
Hope you like it and it’s useful!