Notification from piston x to piston z


#1

Hi all,

I have a piston like this.

When things happen then send notification but include older notification from that piston too so that notification includes “what happened” and “what happened before that”.
That works now and big thanks for @WCmore

Now I’m trying to figure out how can I send notifications created from other pistons to go through this piston. Situation at the moment is that my other pistons send notification but they do not know what was the notification before (created by other piston). So basically all other pistons that send notifications sends just “what happened”. Here’s on example:

Is there a way to get all notification from all of my pistons so that no matter from what pistons they come they would know what was the notification before even though it came from different piston?

(sorry if I’m not clear enough…language barrier…) :slight_smile:


#2

You can set up a ‘receiver piston’ that gets executed when other pistons call it. This will be the one that will update your virtual device. The receiver piston will have a system variable called $args that will be populated with the information your other piston passes to it.

In your other pistons, you add the “Execute piston” task, and it has an option to send a variable/parameter which in this case are the notifications you want to pass along. You can save the notifications in a variable and then send the variable as the parameter. Your choice, whichever one you think is easier/manageable.


#3

As an added note, I keep the “receiver” piston with NO triggers.
(no lightning bolts in the left margin).

Once saved, you will see this up top:

This means the piston will only run when other piston(s) call it.


#4

I need to spar this with you.

So I need to create receiver piston.
Then I set all of my pistons (which send notifications) to call receiver piston.

Couple of questions:

  • I need to add $args as …dynamic variable to all pistons right? Then when something happens in piston, "set variable $args = {‘something’} and call receiver piston? $args variables information is somehow carried to receiver piston.
  • In receiver piston logic should be, it subscribes nothing. It runs only when it is called and it gets $args variable information. Every time when it runs it executes “send device notification” and sends “Now” and “prev” information to the device?

EDIT:
Should the receiver piston be something like this:

and piston that sends notification like this:

Because… as I tested it receiving piston says:

Tested it twice and got two nulls:
image

So basically the idea of new and previous notification still works but can’t get “testi” notification. Just “null”.


#5

Still not getting it. It seems like receiving piston works okay but it just doesn’t get that variable notification from sending piston. I think I have something wrong in sending piston.


#6

My apologies… My freetime is a bit scarce at the moment.

In the sending piston(s), I typically trigger the receiver piston using the External URL, with args at the end. Something like:

Make GET request to https://api.smartthings.com/api/token/abc123/smartapps/installations/def456/execute/:ghi789:?locMode=Day

(Notice the ? and everything afterwards I added)


In the receiver piston (with no triggers), we can look for that (or any) dataPoint:

IF {$args.locMode} is 'Day"
   Then do stuff
END IF

#7

Oh man,…I finally got it working. It was only because variable was written as “Notifications”… and in other piston it was “notifications” :slight_smile:

I have now changed all my pistons to send notifications and I think everything is working as expected except one thing. Can you (or someone) clarify what is the right way to get door notifications deliver as the way the piston now creates them.

At the moment door notification piston sends {alertmessage} which includes door name, time, etc information. Now I need to forward {alertmessage} as a “Notification” variable to receiving piston. How should I do that?

image

EDIT: wait…I think I actually solved it already…?