Input with a device property that doesn't change, but gets set

I have a Leviton VRCS1-1LZ 1 button scene controller that I have setup with associations (Leviton proprietary stuff) for working if it can’t talk to the Vera. However, sometimes this requires me to tap the button twice to toggle the light. I noticed in the log that I get

06 07/12/17 20:08:51.546 Device_Variable::m_szValue_set device: 294 service: urn:micasaverde-com:serviceId:SceneController1 variable: sl_SceneActivated was: 0 now: 0 #hooks: 2 upnp: 0 skip: 0 v:0xeebba0/NONE duplicate:0 <0x775cd520>

But the was and now never change. I was thinking of using PLEG as a catalyst to send some Lua code, but PLEG’s device properties trigger on changes and this isn’t a change. Is there anyway to get PLEG to also execute if a device property is set even if it is the same?

My plan is to have it execute this Lua code:

status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1","Status", 264) if status == "1" then luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="0" },264) else luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="1" },264) end

which works great to toggle the light.

Any other suggestions? The device isn’t sending a button message according to the log; there are only a few threads talking about this device and none of those suggestions have worked.


Coming to this late, I realize, but maybe still useful to you or someone in future…

I have several VRCS1/VRCZ1 scene controllers that I use with great success. Direct scene activation through Vera configuration doesn’t work, as you’ve pointed out. The log messages seem to suggest that the scene controller is telling the Vera that “button 0” is being pressed, and Vera is probably expecting “1” for a single-button controller. Whatever the reason, any scenes configured on the controller don’t run.

But there is another way… you can put a Lua code snippet into a scene, as your code example shows (I do almost exactly the same thing that you came up with), and then, leave the scene bindings empty in the scene controller configuration. Instead, set your scene up with a device trigger on the scene controller when button 0 is pressed. The UI and MiOS will accept 0 for the button number in the trigger, match it correctly when handling the notification from the scene controller, and run your scene Lua!

Here’s the scene Lua I use:

-- Single-button Scene Control/Toggler (Workaround) for SINGLE DEVICE
-- This is a variation on the multi-button scene controller code I use 
-- for the Enerwave SC7 7-button controllers. This version specifically
-- supports for Leviton VRCS1 and VRCZ1.
-- Device # of the controlled load
local loadID =          55 -- Foyer Chandelier
-- of course, you know what you're doing, in which case, have at it! 
-- Please post updates/fixes on the forum for the benefit of others!
-- ---------------------------------------------------------------------

local category = tonumber(luup.devices[loadID].category_num,10)
if category == 2 then
	-- It's a dimmable light
	local level = luup.variable_get("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", loadID)
	if ( tonumber( level, 10) > 0 ) then
		luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", { newLoadlevelTarget = 0 }, loadID)
		luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", { newLoadlevelTarget = 100 }, loadID)
elseif category == 3 then
	-- It's an on/off switch
	local status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", loadID)
	if ( status == "0" ) then
		luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", { newTargetValue=1 }, loadID)
		luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", { newTargetValue=0 }, loadID)

return true

Using a similar strategy, I’ve gotten Leviton four-button scene controllers to work really well (IMHO) as well, and as indicated in the code comments, the Enerwave 7-button scene controller (although it’s generally a clunky, tempermental beast and not my favorite to use). I’m working on packaging that into a plugin.

1 Like

Best Home Automation shopping experience. Shop at getvera!

© 2021 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules