SmartThings Community

Virtual Dimmer and Dim With Me

(Todd Wackford) #1

Created a new SmartThings “Virtual Dimmer” and a “Dim With Me” app that subscribes to it. Now I have many dimmers follow in unison. One virtual dimmer for each room group. My Tasker Gentle Wake-up task drives now only the virtual dimmer and the subscribed lights follow. Also, I can set the virtual dimmer level with Tasker and Autovoice. No lag or pause between each light getting a command. It works faster/better than the actual wall dimmer switches.

This stuff is too cool!

Switch + dimmer in a single device
Can A Dimmer Switch Trigger Other Events?
Where are all the V2 Excitement Posts?
Long time reader - 1st time Poster - Lighting Question
LED bulbs that don't require Gateway?
New user questions
SmartTiles Dashboard 5.4.2 - July 13 (
(Todd Wackford) #2

Here’s some video to show it working. let me know what you think.

(Andrew Urman) #3

bad. ass.

ActiON, aka Web Dashboard 3.0
(Chrisb) #4

Nicely done dude.

(Steve S) #5

@wackware - very cool!

Any chance you would share your device code?

(Corey McLaughlin) #6

How do I go about adding this Smartapp?


I’d like to add this app too, please. Where can I find it?

(Scott G) #8

Try this thread for updated code…

(Chad) #9

I am trying to use dim with me with a virtual switch… But nothing happens when I switch on or off or dim the virtual dimmer. I added a device in ide of type dimmer switch. Is that correct? How can I debug or see what is causing it not to work?

Thank you.

(Mike Maxwell) #10

If you’ve been trying this over the last few hours it will be hit and miss, ST’s a bit backwards at the moment.

(Chad) #11

Yup… Will try tomorrow :slight_smile: thanks…

(Chad) #12

No luck today either. Anyone has it working? I know it worked before…

(Bruce) #13

No. You need a “Virtual Dimmer Switch” as the device type. If that isn’t in the list of available Device Types, then you will have to get the Device Type code and install the Device Type in the IDE, and Publish [For me], then create the Virtual Dimmer.

(Chad) #14

Thanks. I doubted that but I do not have virtual dimmer switch in my list. Will search for code and add the new device type and try.


(Bruce) #15

I think it’s called “Virtual Dimmer”.

(Chad) #16

Not in my list of devices. Can you please send me the code for that device?

(Bruce) #17

Here you go:

metadata {
        definition (name: "Virtual Dimmer", namespace: "", author: "smartthings") {
        capability "Switch"
        capability "Refresh"
        capability "Switch Level"

	// simulator metadata
	simulator {

	// UI tile definitions
	tiles {
		standardTile("button", "device.switch", width: 2, height: 2, canChangeIcon: true) {
			state "off", label: 'Off', action: "switch.on", icon: "st.Kids.kid10", backgroundColor: "#ffffff", nextState: "on"
			state "on", label: 'On', action: "", icon: "st.Kids.kid10", backgroundColor: "#79b821", nextState: "off"
		standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat") {
			state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
        controlTile("levelSliderControl", "device.level", "slider", height: 1, width: 2, inactiveLabel: false, backgroundColor:"#ffe71e") {
            state "level", action:"switch level.setLevel"
        valueTile("lValue", "device.level", inactiveLabel: true, height:1, width:1, decoration: "flat") {
            state "levelValue", label:'${currentValue}%', unit:"", backgroundColor: "#53a7c0"

		details(["button", "refresh","levelSliderControl","lValue"])

def parse(String description) {

def on() {
	sendEvent(name: "switch", value: "on") "Dimmer On"

def off() {
	sendEvent(name: "switch", value: "off") "Dimmer Off"

def setLevel(val){ "setLevel $val"
    // make sure we don't drive switches past allowed values (command will hang device waiting for it to
    // execute. Never commes back)
    if (val < 0){
    	val = 0
    if( val > 100){
    	val = 100
    if (val == 0){ // I liked that 0 = off
    	sendEvent(name:"switch.setLevel",value:val) // had to add this to work if apps subscribed to
                                                    // setLevel event. "Dim With Me" was one.

def refresh() { "refresh"

(Chad) #18

Thank you.

Gives me an error when I try to save:

physicalgraph.exception.ValidationException: Validation error

(Bruce) #19

Sorry, bug is it needs an author. Just put your name in there, and it should work.

(Chad) #20

Thanks. It works now :slight_smile: