[quote=“Aaron, post:1, topic:182280”]I’ve been using PLEG as my DIY alarm. So far, this is pretty good but the problem has been timing issues with motion, door closings, etc
I’d like the security modes (Away, Sleep, etc) to be set manually but the logic to be something like this…
- Away set manually to ON
- Check all Motion Sensors / Door Sensors, etc for the next 3 minutes.
- IF no sensors are tripped, enable “Away Mode”
- IF any sensors are tripped, do not set Away Mode and Send Alert (VeraAlerts) with the sensor(s) that are tripped.
Anyone do anything like this? Example code is highly appreciated![/quote]
I am more likely more a newb then you but atleast let me make a fool outofmyself for doing it the hard way.
I try a variant of RexBeckets example from the PLEG basics doc, (thanks rex btw they have helped me alot in understanding a bit more.)
So here i go, to get the string output i think you need to get into the vera template library stuff.
http://rts-services.com/VeraTemplates/
Which i at this point in time know nothing about, and here its getting a tad late so i cant indulge myself to much in it atm. (scrambled brain and no coffe)
Triggers:
ArmSw - manual alarm switch
Sens1
Sens2
SensN…
Conditions:
AnySensor - Sens1 or sens2 or … SensN
Alarm$Idle - Not ArmSw
Alarm$Armed - Alarm eq ‘Idle’ and ArmSw and !AnySens and (!AnySens; Now>03:00)
Alarm$Error - Alarm eq ‘Idle’ and ArmSw and AnySens and (AnySens; Now>03:00)
(i wont fill in the gaps after this this is where you do your alarm tripped or alerts conditions/actions)
Actions:
Alarm$Error - Run VeraAlert Profile with the message you want, possibly with the template output i mentioned above.
I gave it a 1minute glance so i might be totally wrong… dont know if it is possible to fetch only tripped ones though.
But here we go with my solution.
I would guess it would be something like:
An error occurind while Arming the Alarm!! Sensor 1 in {Device([insert device number of sensor 1 here].room.name)} is {Device([INSERT DEVICE NUMBER HERE of sensor 1].service[urn:upnp-org:serviceId:SwitchPower1].Status) , Sensor N in {Device([insert device number of sensor N here].room.name)} are {Device([INSERT DEVICE NUMBER HERE of sensor N].service[urn:upnp-org:serviceId:SwitchPower1].Status) | Choose(0=OK, 1=Tripped, Other=Unknown)} . End of report!
With the above you the following if sensor 1 in toolshed(example) was tripped and SensorN in basement(example) was not tripped.
Printout should be something like.
An error occurind while Arming the Alarm!! Sensor 1 in Toolshed is Tripped, Sensor N in Basement is OK . End of report!
I have no idea if your could do some sort output of devices with state 1 only. like a condistional printF of sorts… read my link and the MCV docs http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#variable:_devices
Good luck!
Atleast i learned something in the process i think.