Who pressed the button and notify only those present


#1

Can you tell who did something (e.g.) pressed a button in the ST app?

I am looking to create a piston that sends a notification on an event to everyone in my contact list that is present except the person that triggered the event.

Doable?


#2

WebCoRE does not know who or what mobile device pressed a button… just that it was pressed.

A possible workaround might be to use routines instead… setup a routine for each person, then add only that persons routibe to the widget (on iOS) or equivalent on Android.

You can then programme webCoRE to respond to each persons routine differently.


#3

OK Thanks. Shame the info on who did something is not available form the SGT app.

How about the second part. What’s the cleanest way to notify anyone present?


#4

I’ll post an example for you in a hour or so… got an engineer here fitting a smart meter so my WiFi is down (and don’t fancy doing it on my tiny mobile screen).


#5

How many people are you allowing for?

I’ve come up with a snag, can’t search and compare names in contact list… would SMS’s be OK?


#6

up to 5 people. No rush.


#7

I got very close getting this to work with contacts… requires Contact names to be identical to presence sensor names.

In my case the 3 presence sensors listed are called “Abby” “Robin” and “Wanyu”

I got stuck on the last hurdle though, how to dynamically build the “contacts” (To) section of the notification command with an expression.

When selected from the preset options, mine for example appears as “Robin null (Home)”

and “Robin null (Home/SMS)” when saved.

I’ve tried building this via the following expressions:

  • $device " null (Home)"
  • $device " null (Home/SMS)"
  • $device

I’m running a virtual hub hence the “null” part.

But all return an error in the logs, for example, Invalid list of contacts: Robin null (Home)

@webCoRE_Minions Any Thoughts?


#8

I’ve encountered this before as well. First facet of the problem is that the contact names you want to use have to be selected in a Send Notifications to Contacts action somewhere in the piston in order for webCoRE to preload those contacts for that piston. An expression can work, but only against contacts that are selected.

Second, the value of the expression needs to be the contact ID rather than the name. This is a tricky one, I never really figured out where to find those IDs other than as specified in my instructions over here.

So, I think that in order to get this to work you would need to

  1. Add a Send Notification to Contacts somewhere in the piston (e.g. if false then Send Notification to Contacts) with all contacts selected so that the contacts are preloaded
  2. Get those contact IDs with the browser console snippet
  3. Use an array to map the device name to the contact ID

TL;DR: It’s probably easiest to not use contacts for this


#9

Yikes!!

Maybe something to add to the webCoRE todo bug list lol (an easier way to find / reference the contactID’s)


#10

Wasn’t so hard lol… This works as intended now!

I especially like the last part of the logs haha Setting up scheduled job for Mon, Jan 1 12018 @ 12:00:00 PM GMT… I’ll be waiting a long time for that one!!

@ipaterson Any thoughts on an easier way to identify which routine was activated… similar to the use of $currentEventDevice? Or do I need to reference the routine ID’s? How would I find the ID’s short of monitoring the logs?


Best way to send message to only certain contacts depending on conditions?
#11

Wow, great work! I’ll give this a try when I get back tonight. Presumably this could also be used to notify those present at a location you set with the WebCore presence sensor? A sort of zonal messaging system.


#12

With a bit of tweaking I guess… but that’s gonna be one hell of a lot of notifications across 5 people!!

btw… with my example, remember that the variable name set for each routine and your Presence devices need to have matching names.

Name on the contacts no longer Need to match anything as we are just referencing the ID’s now.


#13

Sorry not sure, that’s out of my league.