Setting up Home/Away?

I’m currently turning my lamps on/off using schedules but I would now like to start combining the schedules with a Home/Away state, i.e. when Home I would like to use a certain set of schedules and when away a different one. I would also probably like to have less lamps on when Away.

I’ve understood that a virtual switch is a good way to go where On would mean Away. I would for a start switch to Away mode manually, later on integrate with an alarm. But I’m lost how I should set all of this up in Vera. Any pointers in the right direction would be much appreciated.

Its actually easier than you think. Start with installing a virtual switch. In the scenes that you don’t want to run when away, then you need to add a bit of code in the luup tab. There are quite a few examples around, but essentially its going to look something like this:

scene = luup.variable_get("urn:upnp-org:serviceId:VSwitch1","Status",117) if(scene=="1")then return false end

Replace the number 117 with whatever the device ID of your virtual switch is.

Later on when you want to have this set up automatically by an alarm or something, then you toggle the virtual switch using the state of the alarm.

Thanks, strangely. That’s easy enough and makes totally sense. I understand I have to start digging into luup to get a better understanding of the pontential of Vera. There’s so much I would like to achive with my home automation. :slight_smile:

Adding this code to my current “Home” scenes will make sure that they are not run when away. But what should I do when I’m “in the middle” of a schedule? Assume the porch light should be on both in the morning between 6:00-9:00 and in the evening between 17:00-22:00 when I’m home but when away I only want it to be on in the evening between 18:00-21:00. What would be the easiest way to achive this?

I assume it could be done with some “hard coding” where you add luup code with times and schedules but it will soon be very complex if you have many devices and group of lamps you wish to control using Home/Away.

I guess you just need to split the scene into two perhaps? If you want to get more complexity, then you might be better off installing PLEG and use that instead.

Is there a guide on how to use virtual switches…looks like something someone needs to have down before doing the advanced stuff.

i just got my verde a few days ago.

its been fun so far…alot out there to explore

Not that I know of specifically, but you could start looking in the programming forum in the scene scripting section for some pointers. Also the wiki could be of some help.

The virtual switch and most devices (especially switches) are all scripted in the same way, so a lot of the serviceids and actions are the same. Once you know all of the serviceids and actions a device supports, then that’s a start.

This strikes me as something that could be handled with the Program Logic Event Generator (PLEG) plugin. It’ll let you set conditions based on whether that virtual switch is on/off. So you’d get “if home and it’s 10am…”

PLEG has a bit of a learning curve, but if you want “this AND that” logic, PLEG is good for that.

Agreed and I mentioned that above :wink:


Some ideas for you to work on…

I have two sets of scenes for my HVAC. One set that controls the day and overnight temperatures when my Virtual Switch is set to “Vacation ModeOff” and one set that works only when Vacation Mode is on. Since I live in South Florida, I have another HVAC scene that brings down the temperature for a few hours once a week (called A/C Dryout). This scene takes the humidity out of the house and only triggers when Vacation Mode is On.

I have some exterior lighting that comes on regardless of Vacation Mode and a few that I don’t have turn on during Vacation Mode (e.g. my pool light, an nightlight and some accent lighting indoors). Likewise I use Vacation Ghost and it triggers some interior lights on only when Vacation Mode is on.

Have fun with your new Vera… It is a nice challenge to learn, and extremely powerful.

Great, thanks guys. These are def good pointers. I think the next step for me is digging into PLEG.