Virtual Dimmer is a device within the SmartThings environment that appears to be a regular dimmer switch; however, the device is “virtual” and not tied to a physical device. This is useful to use as a control for other devices, such as its implementation within the SmartApp Alexa Helper. You can not only turn this virtual device “on” or “off” but you can also set different levels (0 to 100) of “brightness”.
Product: Virtual Dimmer
ST Community handle: https://community.smartthings.com/users/michaels/activity
The latest version of the device code is as follows (as of 3/26/17):
Virtual Dimmer: Version: 1.1.1a https://github.com/MichaelStruck/SmartThingsPublic/blob/master/devicetypes/michaelstruck/virtual-dimmer.src/virtual-dimmer.groovy
Open Source License/Trademarks
Licensed under the Apache License, Version 2.0 (the "License"); you may not use the Virtual Dimmer code except in compliance with the License. You may obtain a copy of the License at:
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
All product and company names are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
First, copy the code from the following GitHub location:
Click the Raw link, and then select all of the code (CTRL+A), and then copy it (CTRL+C) to your computer’s clipboard. Then go to the SmartThings IDE at http://ide.smartthings.com. Log into the site and proceed to the link at the top labeled My Device Types. Click on this link.
This will present you with a list of custom device types that you may have within your account. If you do not yet have the virtual dimmer listed, click the link +New Device Type in the upper right-hand corner of the screen.
There will be three tabs at the top, which represent the different ways to add a device. Choose From Code and you will be presented an empty area where the code you copied earlier can be placed. In the open area in the middle paste (CTRL+V) this code.
From here, simply Save and Publish this code.
Notice The code for the virtual dimmer only needs to be installed in this manner once; you can create multiple virtual dimmers as long as this code is in place.
Find the section labeled My Devices at the top of http://ide.smartthings.com. Click this link.
On this next page you will be presented a list of all of the devices within your SmartThings account. These are typically the physical devices within your account. From here, find the button in the upper-right corner of the page labeled +New Device. Click this link and you will be presented a number of fields to fill in.
Starting at the top of the fields, fill out the name of the device. You can always change this name later within the SmartThings mobile application or the IDE.
Once you fill out the name, simply use the same name for the Label.
Since this is a virtual device, leave the Zigbee Id field blank.
For the field labeled Device Network Id, fill in a number that is unique to your environment (you may need to look at the list from the previous screen to determine what is unique.) This field is required, however, the number is not used anywhere else, so a simple “1234567890” could work well for this. Any subsequent devices created could build off of this (for example: “223456790”).
In the next field labeled Type, choose “Virtual Dimmer”.
The Version field should remain as “Published”, and both the Location and Hub should have your location’s hub listed. Ensure both of these fields are not empty, however Group can remain empty. When you are happy with your entries, click the Create button. You will be taken back to the My Devices page, which should now include your newly created virtual switch. You can always click on the switch again and edit it should you need to, or you can edit some of the attributes (such as the name) in the SmartThings mobile application on your phone or tablet.
Finally, you should include this newly added switch in any app that can use dimmer switches.
For advanced users who have their SmartThings IDE integrated with GitHub, the installation and maintaining of code becomes very simple. This manual will not go into detail about setting up your IDE with GitHub; those instructions can be found here: http://docs.smartthings.com/en/latest/tools-and-ide/github-integration.html?highlight=git
Once you have integration, the code you might need will be available to you to download and keep in sync with the latest versions.
- First, find the Settings button at the top of your SmartThings IDE page under My SmartApps or My Device Handlers(this button will only appear after you integrate with GitHub). For the virtual dimmer, ou should be under the My Device Handlers section
- Clicking this button will open the GitHub Repository Integration page. To find the Virtual Dimmer code, enter the information as you see it below:
- Close the GitHub Repository Integration page
- Next, click the Update from Repo button at the upper-right corner of the IDE
- On the right-hand column, scroll down to click the apps you want to install. This will typically be:
Virtual Dimmer: devicetypes/michaelstruck/virtual-dimmer.src/virtual-dimmer.groovy
- Click the Execute Update in the bottom-right corner of the screen. When done syncing, the new apps should now appear in your IDE. If they ever change color, that indicates a new version is available.