Creating alarm for both Time AND State of switch

Need help creating scene with just scene creation tools on Vera, for an alarm that goes off at 10 pm if a door has been left open. I tried combining a trigger of both device (door switch) and time (schedule) but alarm went off at desired time, regardless of whether door was open or closed. I need an “and” to include both time and device. Looks like what Vera scene creator has in an “or” situation. Of course, I may (probably?) be missing something. Suggestions are welcome. Thanks.

See this post for some examples. You’ll set you scene to run at 10 PM, then qualify it with conditional code in your scene. http://forum.micasaverde.com/index.php/topic,18679.msg141959.html#msg141959

You need to change it to be a security sensor instead of a switch, so it might look like this:

local tripped = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", dID) return (tripped == "1")
that will get the status of the sensor, and if it is equal to the string “1”, it will return true which will allow the scene to run. Otherwise the scene won’t run. Do remember to change the dID to the actual device ID of your sensor.

I made a mistake in describing my situation. It is NOT a door switch I have, but a door sensor. The sensor shows “red” on the controller page when the door is “open”. So it knows that the door is open. So did I need the “conditional scene execution?”

  1. Why can I not set up a scene just “test” to see if that sensor is “red” (door open) at a certain time, e.g. 10pm, and set off the alarm if it is?

  2. Do I still need to insert this code (for an ID #23)
    local tripped = luup.variable_get(“urn:micasaverde-com:serviceId:SecuritySensor1”, “Tripped”, 23)
    return (tripped == “1”)

Sorry to be so dense…

Thanks.

I think you are asking why the AND function is not built in without the lua code. And the answer is that Vera just hasn’t provided that yet, but it is coming. If you use the iOS app, you can have it now with the latest firmware. And if you are willing to load other plugins such as PLEG or AltUI, you can get it there too. But the AND simply isn’t there yet for scenes at this time in the standard GUI, so you have use a small bit of lua or use the other plugins.

#1 is exactly what I described. The scene triggers at 10PM, checks to see if the door is open, then runs the scene if true.

In the web GUI, go to the devices page, click on the door sensor device you will use, click on the advanced tab. That will show the Device ID (23 in your example). Scroll down and you’ll see the variables for the device. Probably you’ll see “Tripped” there. If not, maybe “Status”? In either case note what it is, and hover your mouse over the variable. This will show you the Service ID. It is very likely to be the URN string I list below. If it is “Tripped” and the same URN, then use the code I posted. If not, modify to match appropriately. It’s a little confusing at first, but not too hard once you get used to it. You are simply identifying the variable you want to test and you need the variable name, the Service ID, and the Device ID in order to do that. Once you have those 3, it’s easy to check the value.

I tried the IOS app. Two triggers…time and sensor. Checked box “only if all triggers are tripped at same time.”
Success! BTW, when I tried “hovering” over the variable in the GUI, nothing happened. No service ID appeared.

Thanks for your thoughtful and prompt help.

Ira

[quote=“jswim788, post:4, topic:196957”]I think you are asking why the AND function is not built in without the lua code. And the answer is that Vera just hasn’t provided that yet, but it is coming. If you use the iOS app, you can have it now with the latest firmware. And if you are willing to load other plugins such as PLEG or AltUI, you can get it there too. But the AND simply isn’t there yet for scenes at this time in the standard GUI, so you have use a small bit of lua or use the other plugins.

#1 is exactly what I described. The scene triggers at 10PM, checks to see if the door is open, then runs the scene if true.

In the web GUI, go to the devices page, click on the door sensor device you will use, click on the advanced tab. That will show the Device ID (23 in your example). Scroll down and you’ll see the variables for the device. Probably you’ll see “Tripped” there. If not, maybe “Status”? In either case note what it is, and hover your mouse over the variable. This will show you the Service ID. It is very likely to be the URN string I list below. If it is “Tripped” and the same URN, then use the code I posted. If not, modify to match appropriately. It’s a little confusing at first, but not too hard once you get used to it. You are simply identifying the variable you want to test and you need the variable name, the Service ID, and the Device ID in order to do that. Once you have those 3, it’s easy to check the value.[/quote]

[quote=“HarryB, post:5, topic:196957”]BTW, when I tried “hovering” over the variable in the GUI, nothing happened. No service ID appeared.[/quote]In the web GUI, not the iOS GUI, right? And you hover over the variable name on the left, not the value on the right.