[ST Edge] Virtual Dimmer Device Driver

I have made a driver that implements Virtual Dimmer.
This Virtual Dimmer is normal Dimmer and it includes also Step Level function.

This Virtual Dimmer can be used with Zigbee Lights and Matter Lights.

Virtual Dimmer Device’s Settings:

Using Setting Minumum Level when using Step Level is possible to adjust minimum Dimmer Level. The setting only affects Step Level operation. Using the dimmer function, it is possible to set lower dimming levels.

By using the On Off Mode setting, is possible choose whether the Step Level function (setting step level) affects the device’s status (Switch On).
Default setting is that the Step Level function affects the device’s status.

@mocelet has made some driver testing.

I have used Ikea Rodret Dimmer driver

for testing this Virtual Dimmer.

Channel enrollment and driver installation

Enroll your hub into my SmartThings channel
Invitation Link
and install the Edge Driver called Virtual Dimmer StepLevel Tx.

Step Level function can be controlled using SmartThings App routines and Rodret buttons.

Virtual Dimmer Devices works with the Smart Lighting switch sync.
@mocelet has made also the Smart Lighting testing.

I have not used the Smart Lighting function and so I cannot advise its use.

6 Likes

Using these Rules API rules Virtual Dimmer operates as master Light and
every time Master Light is operated rules copies the master light state to slave Light(s).

Using AWA for adding Rules API rules.

Copy and paste Device IDs from AWA Devices to template rule

Keep quotation marks at the beginning and end of Device ID

Paste new rule json to yellow marked area in Add a Rule.

Rule: Virtual Dimmer Level Changes or On > Copy Level

	   {
		 "if": {
		  "or": [
		  {
			  "changes": {
				"operand": {
				  "device": {
					"devices": [
					  "-- ID Virtual Dimmer Device --"
					],
					"component": "main",
					"capability": "switchLevel",
					"attribute": "level",
					"trigger": "Always"
				  }
				}
			  }
		  },
		  {
			  "equals": {
				 "left": {
					"device": {
						"devices": [
							"-- ID Virtual Dimmer Device --"
						],
						"component": "main",
						"capability": "switch",
						"attribute": "switch",
						"trigger": "Always"
					},
				 },
				 "right": {
					"string": "on",
				 }
			   }
           }
		  ],
		   "then": [
			  {
				"command": {
				  "devices": [
					"-- ID Real Lamp Dimmer Device --"
				  ],
				  "commands": [
					{
					  "component": "main",
					  "capability": "switchLevel",
					  "command": "setLevel",
					  "arguments": [
						{
						  "device": {
							"devices": [
							  "-- ID Virtual Dimmer Device --"
							],
							"component": "main",
							"capability": "switchLevel",
							"attribute": "level"
						  }
						}
					  ]
					}					
				  ]
				}
			  }
			]
		}
	   }

Rule: Virtual Dimmer Off > Real Lamp Off

        {
            "if": {
				"equals": {
					"left": {
						"device": {
							"devices": [
								"-- ID Virtual Dimmer Device --"
							],
							"component": "main",
							"capability": "switch",
							"attribute": "switch",
						    "trigger": "Always"
						}
					},
					"right": {
						"string": "off"
					}
                },
                "then": [
				{
					"command": {
						"devices": [
							"-- ID Real Lamp Dimmer Device --"
						],
						"commands": [
							{
								"component": "main",
								"capability": "switch",
								"command": "off"
							}
						]
					}
				}
                ]
            }
        }


To devices list is possible to add multiple Lights IDs (comma separated).

2 Likes

Great driver that can theoretically work with any light since for SmartThings it’s a dimmer and it does not depend on the light’s driver.

I believe so far it’s the best generic workaround to the notoriously missing relative dimming action in SmartThings (really, why is that not a stock feature when even Zigbee and Matter have native step commands??).

5 Likes

Gonna try it as soon as possible. This way I could get rid of about 30 routines.

I’m not at home right now but I could point a camera at one of my lights to test the driver. Such a shame that I forgot to attach two fingerbots to the STYRBAR…

3 Likes

For testing you can use manual routine

1 Like

I know. It was a joke.

1 Like

Since people were asking about Smart Lighting, if I recall correctly it has to be enabled first in the routines tab, clicking the discover icon and then scrolling to the end. I found a post with the screenshots so I’ll just link it:

In regions where it’s not available, the workaround is creating the Rules to sync the light and the dimmer as per the second comment of this post.

By the way, even though my button driver is mentioned, it’s not really needed, any smart button will do of course. However, if you happen to use my button driver, there’s an auto-repeat Held feature that you can use for steps so the brightness keeps increasing/decreasing while you keep the button held.

3 Likes

This replaces @mocelet awesome Scene Switcher in my case.

Routines needed for two lights and 20% steps:

Now down to two routines per light (group).

I just hope that the Smart Lighting doesn’t disappear like it happened in the past. I had to re-add it two times.

Great work, @TapioX !

Upon request, a picture of the buttons to understand what kind of devices this driver is intended to be used with:

3 Likes

Thanks for recommending this. It does the job for toggling light brightness.

@mocelet, I noticed that there’s a significant delay between input and execution. Is there something that can be done to minimise time taken between pressing/holding the button > displaying the appropriate result?

E.g: Holding down the 5 button remote is only executed after fully letting go of the button and waiting it to increase/decrease from 0-100/100-0

Let’s go step by step :slight_smile:

Does the dimmer change the brightness of the lights when you manually change it from the app?

How did you set the routines for the buttons? If it’s like in the example of the first post, with the Pressed event, a single “click” is a step. If you want to step two times you’ll have to click it twice.

I have also tested Virtual Dimmer Device and Wiz Lamps.
Wiz Lamps are connected using Cloud to Cloud connection to SmartThings.
Wiz Lamps also support the use of the Matter protocol, but I haven’t taken it yet in use.

I have used 4 Button Device to control Virtual Dimmer Device.

Airam Remote

The top Button is controlling Virtual Dimmer On / Off switching.
The second Button is controlling dimming (for example -15%).
The third Button is controlling dimming (for example +15%).

4 ST APP routines implement Virtual Dimmer control using Button Device.

2 Rules API rules implement Wiz lamps control from Virtual Dimmer.
Rules API rules are operating in cloud, because Wiz Lamps are connected using Cloud to Cloud connection to SmartThings.

The control speed of Wiz lamps is surprisingly good.
According to my estimate, it takes a little over a second from pressing the button until the lamps light up or change dimming level.

3 Likes

Even if I were able to fall asleep, I’d wake up in the middle of the night, connect them via Matter and finally sleep like a baby afterwards.

2 Likes

Talking about WiZ, I measured the WiZmote and its dimming capabilities. For those who don’t know, that’s the native remote for WiZ that communicates directly with the light using the ESP-NOW protocol, it’s great as a manual backup since it works even if the hub or the router dies.

The numbers:

  • Steps are 10% and, since it has dedicated on/off buttons, the minimum brightness is 10% and won’t go to 0%. The step has a beautiful gradual transition.
  • When you hold the brightness buttons it will brighten or dim continuosly but it’s actually the same 10% steps, just repeated until you release the button. The transitions are so seamless that it feels continuous. I don’t know if the remote protocol has a start/stop, it probably just repeats the same step command.
  • The time to go from 100% to 10% while holding the dim button is around 3 seconds, that would be an auto-repeat interval of around 350-400 milliseconds between steps.

Just writing it down so I don’t forget :sweat_smile:

2 Likes