Save older notification to piston


#1

Hi,

I have a piston like this:

When ever something from the piston’s if list happens then send device notification to one of my mobile devices. That mobile device is virtual device and I’m using these notifications in SharpTools dashboard to inform what was the latest notification about location mode changes.
Here’s example:
image

What I’m trying to do is get more history information to that dashboard tile. I’m able to create another mobile app (virtual device) because one mobile app can only have one notification text attribute. With one mobile app device I’m able to create one notification text to tile but with two I would be able to create latest notification plus one notification before latest.

I need to create a new piston which would send all notifications to that new mobile app virtual device but instead of showing latest notification in notification text attribute this one would show second latest notification.

image

How can I achieve this with a piston?


#2

I like to use local variables to achieve this… Maybe something like:

define
   string now = (no value set)
   string prev = (no value set)
end define

execute
   IF Something happens
   Then 
      Set variable {prev} = {now}
      Set variable {now} = "Something cool"
      Send device notification {now} /n {prev}
   END IF
END EXECUTE

#3

@WCmore thank you so much. It seems to be easy when you know what to do and how to do it :slight_smile:

One more thing. Am I right that /n means next line? I added it but it does this:
image

Is there something else that I need to to get that line change work?


#4

Yes… If the end results look funny, I often use an Expression box, and simply add a carriage return (Enter) inside quotes to achieve this. IE:

Clipboard03

Note the variables are outside the quotes


#5

I got it. Thanks again.
Now my next plan is to figure out how to get all notifications through this piston that is now working. I have a lot of pistons…for example door notification piston (copied from here) which counts minutes and send notifications if door is still open. That is separate piston. Is there a way to get notifications created from piston x to run through piston y so that I could enjoy latest notification and one before. Is this something called global variables or am I lost once again?


#6

Absolutely, but I would create a new topic for that question, since that piston-pair will look nothing like the one(s) above.


#7

Thanks. Will do that! :slight_smile: