virtual switch on off

hallo i have been playing around with the virtual switch the last couple of days. it works ok if i dont set any other screen activator in the same scene. my problem is that i need the virtual plut to be the master in that scene so no matter what i am trying to make the seen do i will not activate that sceen if the virtual switch is set to off. i am trying to make 2 set of scenes winter and summer.what i want to do is turn on winter scene i the winter and in the summer turn it off, then it should not activate anny of the winter scene before next winter(or till i turn them on again) maybe there’s a lua code that will do that please help my.

very easy. Just create the virtual switch for summer (say its ID is 10), in every summer-only scene add the following code at the top of your LUUP tab:

local SUMMER_DEV_ID = 10 local summer = luup.variable_get("urn:upnp-org:serviceId:VSwitch1", "Status", SUMMER_DEV_ID) if (summer == "0") then return false end

and you are all set.

super works nice, tanks a mil :slight_smile:

Hello,

I have a problem with the status of a vistual switch.
I have this code:

local holiday = luup.variable_get("urn:upnp-org:device:VSwitch:1", "Status", 94) if (holiday == "1") then return false else luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", {SceneNum = "29"}, 0) end

that checks if the virtual switch is on (I’m on hoydays), so the scene doesn’t run.

The thing is the scene runs no matter what.

What am I doing wrong?

Thanks in advance

Try:

local holiday = luup.variable_get("urn:upnp-org:serviceId:VSwitch1", "Status", 94)
  if (holiday == "1") then
     return false
  else
    luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", {SceneNum = "29"}, 0)
  end

Ok, I got it working, thank you. I’m a lua newbie and I often get confused with sintax. Is not as straight forward as it seems.

While waiting for your reply, I also managed to get it working using the set/get virtual switch state by name from this post:
[url=http://forum.micasaverde.com/index.php/topic,14896.msg115681.html#msg115681]http://forum.micasaverde.com/index.php/topic,14896.msg115681.html#msg115681[/url]

local isholiday=VSwitch.get("holidays") if (isholiday == "1") then return false else luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", {SceneNum = "29"}, 0) end