We’re going to be away for a few days surrounding Halloween. We’d like to leave the porch lights, interior lights, etc doing their normal dance while we’re gone, to give the appearance that the house is still occupied. But on Halloween, we’d like the front of the house to be dark–no reason for the little goblins to come up our driveway and onto the porch if we’re not there to hand out candy.
I’m guessing the easiest way to do this is to go into all my “on” scenes for the affected lights and add some LUUP code that checks the date, and returns “false” if it’s Halloween in our timezone. What’s the easiest way to do this? Does os.time() on Vera return GMT or local?
I created a “Virtual Device” that I call “Manual”. I check this virtual device state in all of my timed scenes, and abort the scene if the virtual device is set on.
I use this function for when I am having a party or something, where I want to prevent the normal timers from going off. In other words, all of my lights and such are now in “manual mode”.
You could create a scene that turns on this “Manual” virtual device the morning of Halloween, and turn the virtual device off late that evening.
[quote=“aa6vh, post:2, topic:169308”]I created a “Virtual Device” that I call “Manual”. I check this virtual device state in all of my timed scenes, and abort the scene if the virtual device is set on.
I use this function for when I am having a party or something, where I want to prevent the normal timers from going off. In other words, all of my lights and such are now in “manual mode”.
You could create a scene that turns on this “Manual” virtual device the morning of Halloween, and turn the virtual device off late that evening.[/quote]
And this is a fine approach. I snagged the “State Device” plug-in bits, installed them, but am having a bit of unexpected behavior. I’m not worried about the LUUP code to check the virtual device’s state…my problem seems to be that the State Device “status” variable doesn’t change when I hit the “on” and “off” buttons for the device. I’ve named mine “Disable Lighting Timers”, with the expectation that when it is “on” the LUUP code for my lighting timers will return false, and the scenes won’t fire. But my first simple test failed, and when I started checking the advanced tab on this virtual device, I see why.
Things work. I was being misled by the UI4 value displayed for “Status” in the Advanced tab. It’s not consistent with the actual value. Once I got over that, things were straightforward. The lights will be off here on Halloween.
Things work. I was being misled by the UI4 value displayed for “Status” in the Advanced tab. It’s not consistent with the actual value. Once I got over that, things were straightforward. The lights will be off here on Halloween.
–Richard[/quote]
Mind posting the code you are using? I am trying to do largely the same thing.
It’s pretty straightforward. Install the State Device, and make a note of its device number. For my purposes, I named mine “Lighting disable”, as I was going have things get skipped when this device was “on”. I set up a scene to turn the State Device “on” at noon on Halloween, and turn it off at noon on the 1st of November. And then in the scenes that turn on each of the devices I wanted to control with the State Device, I added the following LUUP code in the LUUP tab (my State Device has device ID 40:
skip = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”,“Status”,40)
if(skip==“1”)then
return false
end
That’s it. I had to add this to a handful of scenes, but it’s done now. Workee.
It’s pretty straightforward. Install the State Device, and make a note of its device number. For my purposes, I named mine “Lighting disable”, as I was going have things get skipped when this device was “on”. I set up a scene to turn the State Device “on” at noon on Halloween, and turn it off at noon on the 1st of November. And then in the scenes that turn on each of the devices I wanted to control with the State Device, I added the following LUUP code in the LUUP tab (my State Device has device ID 40:
skip = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”,“Status”,40)
if(skip==“1”)then
return false
end
That’s it. I had to add this to a handful of scenes, but it’s done now. Workee.
–Richard[/quote]
@rimalisz
I just installed the new virtual switch plugin and for the most part understand the code. One thing I do not understand (and I really tried to search the forums before asking) is the serviceid variable. What is SwitchPower1? is that user definable in the advanced tab of the virtual switch? I assume Status is hard coded as a keyword in the xml file…
Thanks!
Best Home Automation shopping experience. Shop at Ezlo!