Vacation settings

I’m sure this topic has been discussed before, but searching didn’t answer my question, which is: Is there a simple way to override thermostat settings for a vacation period? I can’t find any way to do it, so my only option appears to be to backup what I have, delete it all, create new scenes and timers, then restore when I return.

A simpler thing to do would be to disable one set of scenes and enable the other rather than deleting and re-adding. I bit more advanced method would be to create a virtual device to store whether you are home or not and put luup scene code in your scenes to look at that value. Search the Luup forum section of details on creating a virtual device.

I’m not sure which thermostat you have, but I have a Trane which has an Energy Saving Mode (ESM). The ESM is basically a single setpoint for both Cool & Heat that overrides the standard program. You can send a standard Zwave On or Off command to put the thermostat into ESM mode, so I created a virtual device that I use as my “House Occupied” flag in my weekend home, and when I trip that flag, I change the ESM mode on the thermostat accordingly. So when I’m there, the thermostat runs in standard program mode, and when I leave, I activate ESM which holds the cool & heat setpoints (essentially a vacation mode).

I don’t know if the Wayne Dalton thermostats offer such a mode.

Thanks Slackner, I do indeed have Trane thermostats, that sounds like a great suggestion.

Thanks to Mike, too, I’m a programmer by trade but I don’t have the time before I leave to investigate LUUP, although it’s on my list. I’m also not sure what you mean by “disabling” scenes, I can’t find any option for that. The only option I seem to have is the trash icon.

Ok, so that also seems to require programming. I went for the quick solution and disconnected the thermostats from z-wave.

Invisiblewave - I understand your aversion to doing any programming. I was the same way, even though I do have a programming background (many, many years ago). However, setting up two simple scenes to switch your Trane Thermostat between standard “Run” mode (i.e. regular program) and “ESM” mode as I describe in my earlier post, is quite simple and doesn’t require programming.

In my case, I created two scenes. One is called “ESM Mode” and the other “Run Mode”. For ESM Mode, I click the “Advanced” button, select my thermostat from the device list and click “Add”, and then I select “SetTarget” under the “SwitchPower1” service id and set the value to 0.

For the Run Mode, I do all the same steps but set the value to 1.

What you’re basically doing is issuing the standard ZWave power-on and power-off commands, but in the case of the Trane Thermostat, they’re interpreted as switching between standard Run mode and ESM mode. I owe the guy at ASIHome thanks for that information - certainly wouldn’t have figured that out on my own.

It’s that simple - you can then call those scenes anytime you want to switch between modes. Or you can embed those commands in other scenes you may have setup for when you leave, or arrive back at, your home.

That’s how I control my thermostat - no code required! Hope that helps.

Ok, I see what you’re trying to do now, but I can’t get it to work and I’m running out of time, so it’s going to have to be Plan A for this vacation. When I get back I’ll take another stab at it. Thanks!

I finally got round to doing this, but finding the necessary info was far from easy, so to gather my thoughts and hopefully help someone else out, here’s how to do it:

The basic principle is to create a simple on/off dummy device (known as a virtual device in technical parlance), then add lua code to each of your scenes to check whether your vacation virtual device is switched on (when on vacation) or off. Each device in Vera has a corresponding xml file that defines the interfaces for that particular device, and a “driver” implementing those interfaces. Most of these files are pre-loaded and can be viewed by clicking MIOS Developers in the Toolbox and clicking on the Luup Files tab. This tab also has a facility at the bottom for uploading new device files.

To add the virtual StateDevice that I used, I first located a zip file in the forum that contained both the xml files, I would post a link but I can’t find the page again I’m afraid, and there’s no download link (at time of writing) in the “official” list of plug-ins, although the device itself is listed as working: http://wiki.micasaverde.com/index.php/Luup_plugins_and_Luup_code#Plugins_and_code
Once you have the zip, extract the two xml files to a folder on your hard drive, then upload both using the MIOS Developers->Luup Files tab, this installs both files on Vera and makes them available to your dashboard.

Next, create the device using the Create Device tab (also in the MIOS Developers menu dialogue). There are only a couple of items that you need to fill on this page. The Device Type is found inside the D_StateDevice.xml file, open it with a simple text editor (or even a browser), and copy the text inside the definition, or copy it from here if you’re using the same device as me: urn:schemas-upnp-org:device:BinaryLight:1
Give your new device a name in the Description field, then the UpnpDevName is the name of the D_ xml file, in this case D_StateDevice.xml.
Everything else can be left empty, Vera assigns the next next device number in sequence, you can view this later once the device has been created.
Click Create Device, and your new virtual device should then show up on your dashboard (sometimes it’s instant, sometimes it takes a few seconds) in whatever room you chose (if any). It should have On and Off buttons (assuming you’re using the same device I did) and appears to work like a light switch, although it’s just a simple program operating in the background rather than a physical switch.

The final step is to add code to your scenes to check the status of your virtual device. The general principle of the luup code in your scenes (and if the documentation tells you these simple principles anywhere, I can’t find it, the introduction was almost useless as an information source) is that the code is executed when the scene runs, and returns either True or False. Returning True executes the scene, returning False causes the scene not to execute. Here’s my code:

local awayDevice=14
local awayStatus = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, awayDevice)
if (awayStatus == “1”) then
return false
end
return true

The first line defines a numeric program variable called awayDevice with a value of 14. The 14 is the id of your virtual device, you can find this by opening the device and clicking on the Advanced tab. I suspect you could get away without defining this variable and just coding the device id directly into the next line which interrogates the virtual device for its status.
The second line executes a lua function (variable_get) which retrieves a named value (Status) from a device type (SwitchPower1), with the specific device being identified by the third function argument (awayDevice). This line also defines another local program variable (awayStatus) and assigns the returned status to this variable, so after this line is executed you should end up with a local variable called awayStatus that contains a value telling your program whether your virtual device is On (status=1) or Off (status=0).
Next is a simple test, if the status is 1, the code returns false, meaning you’re away so the scene does not run. The return causes the program to end. If the device is switched off, then the next line executes, returning True which causes the scene to run.

For my upstairs area, I also created a slightly more complicated scenario using two virtual devices (Away and Vacation), the code for this includes an Or condition in the If statement, so the scene does not execute if either device is turned on:

local awayDevice=12
local vacationDevice=13
local awayStatus = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, awayDevice)
local vacationStatus = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, vacationDevice)
if (awayStatus == “1” or vacationStatus == “1”) then
return false
end
return true

[quote=“invisiblewave, post:8, topic:166090”]I finally got round to doing this, but finding the necessary info was far from easy, so to gather my thoughts and hopefully help someone else out, here’s how to do it:

The basic principle is to create a simple on/off dummy device (known as a virtual device in technical parlance), then add lua code to each of your scenes to check whether your vacation virtual device is switched on (when on vacation) or off. Each device in Vera has a corresponding xml file that defines the interfaces for that particular device, and a “driver” implementing those interfaces. Most of these files are pre-loaded and can be viewed by clicking MIOS Developers in the Toolbox and clicking on the Luup Files tab. This tab also has a facility at the bottom for uploading new device files.

To add the virtual StateDevice that I used, I first located a zip file in the forum that contained both the xml files, I would post a link but I can’t find the page again I’m afraid, and there’s no download link (at time of writing) in the “official” list of plug-ins, although the device itself is listed as working: http://wiki.micasaverde.com/index.php/Luup_plugins_and_Luup_code#Plugins_and_code
Once you have the zip, extract the two xml files to a folder on your hard drive, then upload both using the MIOS Developers->Luup Files tab, this installs both files on Vera and makes them available to your dashboard.

Next, create the device using the Create Device tab (also in the MIOS Developers menu dialogue). There are only a couple of items that you need to fill on this page. The Device Type is found inside the D_StateDevice.xml file, open it with a simple text editor (or even a browser), and copy the text inside the definition, or copy it from here if you’re using the same device as me: urn:schemas-upnp-org:device:BinaryLight:1
Give your new device a name in the Description field, then the UpnpDevName is the name of the D_ xml file, in this case D_StateDevice.xml.
Everything else can be left empty, Vera assigns the next next device number in sequence, you can view this later once the device has been created.
Click Create Device, and your new virtual device should then show up on your dashboard (sometimes it’s instant, sometimes it takes a few seconds) in whatever room you chose (if any). It should have On and Off buttons (assuming you’re using the same device I did) and appears to work like a light switch, although it’s just a simple program operating in the background rather than a physical switch.

The final step is to add code to your scenes to check the status of your virtual device. The general principle of the luup code in your scenes (and if the documentation tells you these simple principles anywhere, I can’t find it, the introductions was almost useless as an information source) is that the code is executed when the scene runs, and returns either True or False. Returning True executes the scene, returning False causes the scene not to execute. Here’s my code:

local awayDevice=14
local awayStatus = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, awayDevice)
if (awayStatus == “1”) then
return false
end
return true

The first line defines a numeric program variable called awayDevice with a value of 14. The 14 is the id of your virtual device, you can find this by opening the device and clicking on the Advanced tab. I suspect you could get away without defining this variable and just coding the device id directly into the next line which interrogates the virtual device for its status.
The second line executes a lua function (variable_get) which retrieves a named value (Status) from a device type (SwitchPower1), with the specific device being identified by the third function argument (awayDevice). This line also defines another local program variable (awayStatus) and assigns the returned status to this variable, so after this line is executed you should end up with a local variable called awayStatus that contains a value telling your program whether your virtual device is On (status=1) or Off (status=0).
Next is a simple test, if the status is 1, the code returns false, meaning you’re away so the scene does not run. The return causes the program to end. If the device is switched off, then the next line executes, returning True which causes the scene to run.

For my upstairs area, I also created a slightly more complicated scenario using two virtual devices (Away and Vacation), the code for this includes an Or condition in the If statement, so the scene does not execute if either device is turned on:

local awayDevice=12
local vacationDevice=13
local awayStatus = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, awayDevice)
local vacationStatus = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, vacationDevice)
if (awayStatus == “1” or vacationStatus == “1”) then
return false
end
return true[/quote]

@invisiblewave

I can get you the link to the plugin and even create a [How To] if you like.

Could you add the piece of luup code to add to your scenes here?

I think that would more or less complete your tutorial…

[quote=“Henk, post:9, topic:166090”]@invisiblewave

I can get you the link to the plugin and even create a [How To] if you like.

Could you add the piece of luup code to add to your scenes here?

I think that would more or less complete your tutorial…[/quote]

I think a How To would be a great idea, I wish there’d been one when I did this yesterday. I’m a Java programmer and am well used to reading manuals and documentation, but I couldn’t find anything really useful when I looked. I had to glean what I needed from disparate snippets in numerous forum posts.

Not sure what you’re asking with the question, since my code is already posted here and presumably you could just copy it when creating the How To.

It’d also be nice if someone could update the luup plugins/devices list and add a link to the viritual device download there.

The entry in the list for the Virtual Device has a link (currently ‘[293]’) to this post with the current ZIP file [tt]State Device 0.1.zip[/tt].

There are only a couple of items that you need to fill on this page[...]
Generic instructions on how to install a plug-in [url=http://wiki.micasaverde.com/index.php/Install_LUUP_Plugins]are found here[/url].
The general principle of the luup code in your scenes [...] is that the code is executed when the scene runs, and returns either True or False.
A page on adding Luup to events, including a diagram that shows the difference between Luup attached to Events and Luup in the Luup tab, [url=http://wiki.micasaverde.com/index.php/Luup_Scenes_Events]is here[/url].

These are some additional words on the virtual devices. And could probably be integrated with some of @invisiblewave’s words and code.

Yes thats my experience as well and thats why i piece it together and put it into how to’s for easy future reference

Not sure what you're asking with the question, since my code is already posted here and presumably you could just copy it when creating the How To.

It’d also be nice if someone could update the luup plugins/devices list and add a link to the viritual device download there.

@Oti provided the state device download link. Thats the only currently available set of files, but they work.

As for my question, it was based on this quote:

For my upstairs area, I also created a slightly more complicated scenario using two virtual devices (Away and Vacation), the code for this includes an Or condition in the If statement, so the scene does not execute if either device is turned on:

Is this the code you used to achieve this?

local awayDevice=12
local vacationDevice=13
local awayStatus = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", awayDevice)
local vacationStatus = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", vacationDevice)
if (awayStatus == "1" or vacationStatus == "1") then
    return false
end
return true

And did you put it into the luup section of the scene?

Henk