Lighting Presets

rich5741 4 years ago in Panels (dashboards) / Sharing updated 4 years ago 0

Just wanted to share some work I did to create lighting pre-sets (but really can apply to any controls that have varied levels for which you want to create presets.  WiIl recommend trying only if you have familiarity with Webcore, and using IDE.  Will also welcome the community's input on this - I'm new to the game and still learning the ropes.  

Also the only advantage of this versus doing through setting up a couple routines is the ability to show which preset is active (i.e. on/off and will only show one active and other off at any time), which probably only appears to obsessives like myself :-)

1. Create simulated dimmer via Smartthings IDE.  I've found the ST Classic Smartapp for creating virtual devices to be a bit wonky, so will recommend the manual method through IDE. (https://community.smartthings.com/t/faq-creating-a-virtual-device/11282/2, but select simulated switch.  Create one for each pre-set (example, High, Medium, Low, Off)

2. Add these devices to Actiontiles through the Smartapp

3.  Create a Webcore Piston such that when a switch is flipped on, the other switches in that preset will flip off (eg if High is On, then Medium, Low, Off are turn off).  Don't link any of these simulated switches to other devices.  Below you will see my example.

4.  Optional: Create an additional Webcore Piston that will "sync" your switches in case you have other devices/automations/manually controls that change light states.  For example, I have other simple switches around the apartment that will turn on and off these same lights, and I wanted my panel to be synced to this.  I also included my piston as an example below - note that it will have odd behavior at times since I think Smartthings devices don't all report status instantaneously, I've tried my best to use execution delays and a "pause" variable to prevent an unintended loop (where my "clean up" piston changes the state of a preset switch, which then triggers another run of the clean up piston - this causes a 10s delay as Webcore pauses execution to break the loop (you will see "paused at semaphore" in the logs).  For the below, I purposely left the clean up such that all the preset buttons are turned off if the lights are set something other than one of my presets.

5.  Add tiles to Actiontiles that correspond to the switches.  See my panel below as an example.

Note: the fuzziness in the screenshot is not a function of Actiontiles, I have some issues with my Fire and awaiting a replacement.

Image 4705

Image 4706

Image 4707

If the above screenshots don't work, here are the picture files:
Living Room Presets.png

Living Room Preset Cleanup.png

Annotation 2020-01-25 221639.png