Page 1 of 1

[Answered] Which device triggered the group?

PostPosted: Mon Oct 05, 2015 8:01 am
by CraftGeek
Hi,

I have a device group that includes all leak detectors. Any one of them can turn the group value to On. This is a trigger for an action group that sends many emails using the Better Email plugin. Some of the emails go to cell phone texting services that only display the first few lines of the email so I can't simply list all leak sensor states in the email. I want to include the name of the triggering sensor in the alert emails. Better Email can show variable and device states in the subject and body text.

What I need help with is...

How do I set a variable with the name of the sensor that is detecting the leak?

I know I can create a list of triggers, one for each sensor, that will set a variable to a value. I want to avoid this approach if possible.

Re: Which device triggered the group?

PostPosted: Mon Oct 05, 2015 9:50 am
by jay (support)
Currently there is no information passed from the triggering event to any actions.

Re: Which device triggered the group?

PostPosted: Mon Oct 05, 2015 9:54 am
by CraftGeek
jay (support) wrote:
Currently there is no information passed from the triggering event to any actions.

Is there a value or property of a device group that tracks the member device that caused the group to change state?

Re: [ANSWERED]Which device triggered the group?

PostPosted: Mon Oct 05, 2015 9:55 am
by RogueProeliator
I know I can create a list of triggers, one for each sensor, that will set a variable to a value. I want to avoid this approach if possible.

Your best bet might be a short Python script executed as part of the trigger -- simply check each sensor you want to include to see if it has been tripped and update the variable when found; of course you could have more than one tripped and may want to account for that.

Adam

Re: Which device triggered the group?

PostPosted: Mon Oct 05, 2015 10:37 am
by matt (support)
CraftGeek wrote:
jay (support) wrote:
Currently there is no information passed from the triggering event to any actions.

Is there a value or property of a device group that tracks the member device that caused the group to change state?

No, not currently. Definitely on the wish list though.

Re: Which device triggered the group?

PostPosted: Mon Oct 05, 2015 10:44 am
by CraftGeek
So, I can learn Python scripting and implement Adam's suggestion or create a separate trigger for each of my leak detectors which sets the value of a variable to the name of the triggering sensor?

If I know no scripting languages, are there other options?

Re: Which device triggered the group?

PostPosted: Mon Oct 05, 2015 11:07 am
by jay (support)
I believe those are the only two options at the moment.

Re: Which device triggered the group?

PostPosted: Mon Oct 05, 2015 12:41 pm
by CraftGeek
OK, I created a variable called LastActiveSensor. I then created a trigger for each of my 25 window, door and leak detectors. Each of these triggers puts the descriptive name of the triggering sensor into LastActiveSensor.

Now, if the water leak or intrusion alarm sends notification to our email and phones, it will include the name of the sensor that tripped the alarm because I will include %%v: 957581619%% in the text of the notification. Yeah, I stumbled over the syntax. 957581619 is the ID of LastActiveSensor in my system.