Scene to Notify Which Alarm Sensor is Tripped

I created a scene to notify me if any of a set of alarm sensors has been tripped (by setting triggers). Is it possible to established which one of the alarm sensors caused the scene to trigger? It would be nice to see a message like “Front Door Triggered”. I am hoping to do this with a single scene that has the desired sensors as triggers, rather than individual notifications from each sensor.

Thx

Yes, this sort of need has been discussed many times on the forum. The trick is to put code in each of the triggers, setting a global variable with the name of the specific trigger. The scene code can then pick this up and determine which trigger fired.

A search of the forum should find more technical details if you need them.

[quote=“akbooer, post:2, topic:181894”]Yes, this sort of need has been discussed many times on the forum. The trick is to put code in each of the triggers, setting a global variable with the name of the specific trigger. The scene code can then pick this up and determine which trigger fired.

A search of the forum should find more technical details if you need them.[/quote]

Thanks for the reply. Any chance you could link me to an example? I must not be searching the forum with the proper terms.

Here’s a link I found with the search string “trigger Lua code”.

Close to what you need, I think?

There’s code attached if you follow the link.

[quote=“akbooer, post:4, topic:181894”]Here’s a link I found with the search string “trigger Lua code”.

Close to what you need, I think?

There’s code attached if you follow the link.[/quote]

So the code has to be pasted into each trigger’s LUA code? That seems pretty tedious. I’ve searched, and have not come up with anything better though.

Hardly tedious. It’s only a one-liner.

The code still does not work woth hardwired zones even with virtual relays setup.

Hard to diagnose without seeing the actual code you’ve written.

I created a scene “Notify Tripped Zone”.
Set triggers, one for each zone.
In the LUUP for the trigger, I set a variable gAlarmDevID = the DevID of the zone.

Luup for the scene

[code]local partition = 53
local alarmstate = luup.variable_get(“urn:micasaverde-com:serviceId:AlarmPartition2”, “ArmMode”, partition)
print("alarmstate: "…alarmstate)

local vDevName = “”

if alarmstate == “Armed” then
vDevName = "Alarm " … alarmstate … “:\n-----------------------------”

if gAlarmDevID == “0” then – “0” is the default in startup lua
vDevName = vDevName…“\n”…" unknown sensor or zone"
else
local vDevID = tonumber(gAlarmDevID)
vDevName = vDevName…“\n”…luup.devices[vDevID].description
luup.call_action(“urn:upnp-org:serviceId:IOSPush1”, “SendProwlNotification”, {Event=“Alarm Panel”, Description=vDevName, Priority=2, URL=“”}, 378)
end
print(vDevName)
else
end

print("gAlarmDevID: " … gAlarmDevID)
gAlarmDevID = “0”[/code]

Works fine for wireless zone, but not hardwired ones. I need to double-check, but it may not work for wireless zones that have a zone type not = 23 either. Don’t remember.

I just set up a scene for each sensor that allows me to customize each alert mesage. Took some work for 20+ sensors, but now I can also give more detailed locations for the WAV file followed by a customized TTS alert.

Rather than go the “Scenes” route I used PLEG for my alarm processing and have configured a notification for each alarm sensor detection.

Since I have three sensors in the garage but only one way into the house from there I only need one notification for the garage which is easy to do do in PLEG. So:

 Alarm Violated AND (Garage_Door OR Garage_Window OR Garage_OVHD) 

send notification using Vera Alerts “Vera Alert: Alarm Active GARAGE”

all of the others are simply “Alarm Violated AND Front_Door” or “Alarm Violated AND Patio_Door”, etc., and sends the appropriate notification (Vera Alert: Alarm Active FAMILY ROOM, etc) to all family members. Using PLEG the condition “Alarm Violated” also turns on selected lights, etc.

I’m using Vera Alerts which is configured to write to the SysLog, and send to the phones using both Pushover AND SMS to make sure that one of them arrives in a timely manner.