Author Topic: Virtual Panel Plugin: Example Master Dimmer  (Read 1926 times)

Offline rstrouse

  • Hero Member
  • *****
  • Posts: 833
  • Karma: +30/-9
Virtual Panel Plugin: Example Master Dimmer
« on: July 03, 2015, 08:53:17 pm »
In the next several posts I will go through an example of how to create a master dimmer on your panels using the Virtual Panel Plugin.  You can find the plugin files as well as instructions on how to install it from the post below.

http://forum.micasaverde.com/index.php/topic,31128.msg223995.html#msg223995

Background:
I have several panels that roll up device functions on my Vera one of them is a panel that controls the outdoor lighting and pool equipment.  On this panel there are several dimmers that can be controlled individually but for this example I will show you how to tie them all together into a single slider so that they can move together as well as separately.  Below is my panel that contains all the controls for the backyard.



1xVera3 1.7.619, 4xLinear WT00Z, 3xLinear WS15Z, 1xLeviton VRCZ4, 10xCooper RF9540, 1xLeviton VRFI10, 1xLeviton VP00R, 2xLinear GD00Z-4, 1xGE/Jasco 45612, 1xGE/Jasco 45610,  4xGE/Jasco 45605, 2xYale YRD220-ZW-619, 1xCaddx NX584, Autelis Intellitouch Pool Control, OpenSprinkler

Offline rstrouse

  • Hero Member
  • *****
  • Posts: 833
  • Karma: +30/-9
Re: Virtual Panel Plugin: Example Master Dimmer
« Reply #1 on: July 03, 2015, 09:29:28 pm »
In this example I won't go through the details for adding controls to a panel.  This is simple enough and the details that are important here is how to get a control on one panel to control another device on another panel that isn't even a Virtual Panel.  This is true for any command that you would like to call from an action within Vera.  So add a new Horizontal Slider to any Virtual Panel on your Vera.

1. Select the Virtual Panel you are editing for the Device under the Device Variable to monitor section.
2. Select or type urn:rstrouse-com:serviceId:VirtualPanel1 into the Service Id field
3. Type in a variable name that is unique within the panel.  I chose MasterSlider in this case.

Under the command section choose Execute Lua from the Action Dropdown.  An edit field will appear to accept luup code to be performed when the slider is moved.

Below is the code that is executed for me when the master slider is moved.

Code: [Select]
luup.variable_set("urn:rstrouse-com:serviceId:VirtualPanel1", "MasterSlider", context.controlValue, context.panelDeviceId)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {["newLoadlevelTarget"] = context.controlValue}, 27)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {["newLoadlevelTarget"] = context.controlValue}, 11)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {["newLoadlevelTarget"] = context.controlValue}, 30)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {["newLoadlevelTarget"] = context.controlValue}, 31)
if(tonumber(context.controlValue) ~= nil and tonumber(context.controlValue) > 15) then
    luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {["newTargetValue"] = "1"}, 42)
else
    luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {["newTargetValue"] = "0"}, 42)
end

From the list above the number 27, 11, 30, and 31 are the device ids for each of the sliders on the panel.  42 is the side door light binary switch which I have turn on if the dimming level is greater than 15 and off if it is less than or equal to 15.  Notice the use of context.controlValue.  This is the current slider position.

In the first statement I am persisting the slider value so that it stays where I last set it.  I use the context.panelDeviceId value since I am storing this value on the Outdoor panel itself.  The screenshot below is the definition for my master slider.
« Last Edit: July 03, 2015, 09:38:24 pm by rstrouse »
1xVera3 1.7.619, 4xLinear WT00Z, 3xLinear WS15Z, 1xLeviton VRCZ4, 10xCooper RF9540, 1xLeviton VRFI10, 1xLeviton VP00R, 2xLinear GD00Z-4, 1xGE/Jasco 45612, 1xGE/Jasco 45610,  4xGE/Jasco 45605, 2xYale YRD220-ZW-619, 1xCaddx NX584, Autelis Intellitouch Pool Control, OpenSprinkler

Offline rstrouse

  • Hero Member
  • *****
  • Posts: 833
  • Karma: +30/-9
Re: Virtual Panel Plugin: Example Master Dimmer
« Reply #2 on: July 03, 2015, 09:34:39 pm »
I also created a color indicator that increases in intensity as the master is slid toward 100% below is the definition for that.  Simply playing around with it because it is there.  Each of the individual dimmers work independently but I can home all of them to the master simply by moving it to a new value.
« Last Edit: July 03, 2015, 09:44:57 pm by rstrouse »
1xVera3 1.7.619, 4xLinear WT00Z, 3xLinear WS15Z, 1xLeviton VRCZ4, 10xCooper RF9540, 1xLeviton VRFI10, 1xLeviton VP00R, 2xLinear GD00Z-4, 1xGE/Jasco 45612, 1xGE/Jasco 45610,  4xGE/Jasco 45605, 2xYale YRD220-ZW-619, 1xCaddx NX584, Autelis Intellitouch Pool Control, OpenSprinkler

Offline reynoldslux

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
Re: Virtual Panel Plugin: Example Master Dimmer
« Reply #3 on: January 07, 2018, 06:18:31 pm »
RSTROUSE: Relatively new to Vera and am loving your plug in and all the work you put into it. Am trying to duplicate your master dimmer panel - however, I am stuck on one item. I have multiple dimmer sliders working along with the master slider working. However, I am at a loss as to how to get the master slider to reflect the "new value" when using the ALL OFF button....