Hi,
I’m having a problem with the following code, basically looking for the scene to trigger if the result from device 65 is false:
local dID = 65 – Device ID of your VirtualSwitch
local allow = false – false runs scene if switch is on, true blocks it
local status = luup.variable_get(“urn:schemas-upnp-org:device:VSwitch:1”,“Status”,dID)
return ((status == “1”) == allow)
No matter what allow is defined as, seems to run the scene 
is there anything wrong with this code?
The Service ID is wrong. Try this:
local status = luup.variable_get("urn:upnp-org:serviceId:VSwitch1","Status",dID)
See Service IDs, Variables and Actions for more examples.
Hi
Now using the following code:
local dID = 65 – Device ID of your VirtualSwitch
local allow = false – false runs scene if switch is on, true blocks it
local status = luup.variable_get(“urn:upnp-org:serviceId:VSwitch1”,“Status”,dID)
return ((status == “1”) == allow)
However, the device is still turning on, even with the virtual switch is turned on. Any ideas?
Thx
However, the device is still turning on, even with the virtual switch is turned on. Any ideas?
Things to check:
[ul][li]The device number in dID is correct (as shown at the top of the device’s Advanced tab).[/li]
[li]You are using a VirtualSwitch plugin device (not a Z-Wave or MultiSwitch device).[/li]
[li]You pasted the code onto the scene’s LUUP tab.[/li]
[li]You clicked Save Lua, Confirm and Save/Reload.[/li]
[li]There are no other scenes or PLEG that use the same trigger and action.[/li][/ul]
[quote=“RexBeckett, post:4, topic:186427”]
However, the device is still turning on, even with the virtual switch is turned on. Any ideas?
Things to check:
[ul][li]The device number in dID is correct (as shown at the top of the device’s Advanced tab).[/li]
[li]You are using a VirtualSwitch plugin device (not a Z-Wave or MultiSwitch device).[/li]
[li]You pasted the code onto the scene’s LUUP tab.[/li]
[li]You clicked Save Lua, Confirm and Save/Reload.[/li]
[li]There are no other scenes or PLEG that use the same trigger and action.[/li][/ul][/quote]
Hi, thanks for your help:
ID 65 - check
virtual switch - check
Code pasted - check
Saved code - ui7, save lua, finish - not sure about reload
Pleg not being used
The
Tony
Pleg not being used
PLEG would be a lot simpler … just use menu selects … do not need to know about or deal with the case sensitive Service IDs.
Try changing false to true and see what happens.