Repeat the push notifications of the day when I arrive home


#1

Hi. I got many pistons running things at home when I’m away and some of them send me notifications like “Washing cycle finished”. It’s nice (maybe?) to get that info while I’m away but it’s kind of useless, I tend to dismiss and then forget about it. Not a huge problem actually, but this could be improved.
So I was thinking if there is any way to “store” the notifications and get them when I actually arrive at home. Or maybe repeat them when I arrive home. It would be ideal if they appeared on my Google Home Hub screen but I believe I’m dreaming here.

I have literally no idea on any way to design this but seeing the potential of webCoRE I believe it can be done, so any help is appreciated!

Thanks,
Rodrigo


#2

himmm never tried that… I don’t know if there is a natural way of doing this (maybe using wait but cancelled with presnse sensor’s arrival???)

but I can just try to brainstorm here…

How about, you store the notifications in a variable…
ie :
@dryerstatus (global variable)
@dryerstatustime
IF Dryer stops
Set @dryerstatus = “Dryer status”
Set @dryerstatustime = {now}

IF presense sensor changes to HOME
Send SMS "Your dryer status changed to @dryerstatus at this time @dryerstatustime"

#3

Makes sense, actually my notifications are quite simple so I’ll try it this way:

IF Washing machine changes to off
Set @washed_notif true

IF presence sensor changes to HOME
IF @washed_notif is true
Send PUSH notification “Washing cycle ended”.
Set @washed_notif false

I also tested another simpler way but a bit clumsy, just having one notification that when I arrive home says “check messages” and having the “store in messages” true in the PUSH notification settings, so the notifications are stored in the SmartThings hostory, but in that case I’d have to go and check the notifications manually, not so effective.

Thanks!
R.


#4

Yes your example looks very neat…
I’m glad it works:)


#5

This is a very interesting idea I might want to play with. If you only have one, your simple method works pretty well. If you have many notifications you are interested in, you could create a string global variable like @notificationList and after each push notification you would like repeated, add

If presence is not present
  @notificationList = @notificationList (count(@notificationList)>0? “,” : “” “New notification”
Endif

Or maybe just if present, push the notification and if not present store it. Then a separate arrival piston would just be

If presence changes to present
   And
  Count(@notificationList)>0
Then
  For $index=0 to count(@notificationList)-1
     Push @notificationList[$index]
  End for
  Set @notificationList=                <—  [blank] 
End if

I


#6

Alright, so I’ve been trying to create the piston you described but I’m not sure I’m setting it right.

For the test I’m using two simulated switches, one that should add an “up” or “down” text to the notification variable, and then another switch that pushes the notification.

The fist piston should add text to the variable based on Switch 15 on/off trigger. When I turn it on it should add “Up” and when I turn it off it should add “Down”. Instead, when I turn it on, it shows “Up” but when I turn it off it shows “,”. It doesn’t add the comma after “Up”, the whole text of the variable changes to a comma.

Also, I’m not understanding the meaning or the use of the “count” part.

The second piston should send the notification, and it’s working. I didn’t add the “blank” part because first I want to try adding a string of notifications and seeing how it is displayed.

Here I’m not understanding the “for” and $index=0 to count(@notificationList)-1

Thanks for your help!
Rodrigo


#7

Sorry, I was on my mobile device so not totally clear and then I gave you bad syntax. Here is what the storing piston might look like:

and the piston to send out the resulting list:

So as you turn on and of he one switch, the values build up as below:

List-Set

Once you arrive home, the messages ar sent out one at a time and then the list is reset:

List-Blank

The for loop separates each of the stored messages into their own push notification.

Right now the store piston has a string issue that if the first message is On it works fine but if the first message is off, it won’t insert a comma before the on (I get ‘OffOn,Off,On’). Not sure why and it’s late so I will look at it again when I have time but this is the idea.


WebCoRE reading from Google Sheets with multiple tabs
#8

Great, so now I understood the “count” :smiley: and the “add” piston is working fine.

Now I need to understand what’s the meaning of that “for” and how to add it to my “read” piston, I have no idea of how to make it appear there.

Thanks!
R.

EDIT: Okay, I copied your piston using the backup code and understood a bit about the FOR, but I still don’t know how I could add it for myself. Anyway it’s not important.

I’m still getting a weird mix with and without commas, but it works.

The “read” (“push”?) piston is not making so much sense though, it sends many notifications, one that has the whole text (OnOffOn) and then some separate Ons and Offs, I think this might be related to the missing commas, right?


#9

So it turns out there is a bug relative to a string with just the word ‘off’. If the test strings are a little longer, it will work fine. Perhaps make it ‘currently off’. Anyway, this is just a test.

To answer your questions, I think I need to step back a bit. To add a for, you have to have the advanced commands available. If you are. To seeing it, click on the settings in the upper right corner of the edit screen and select ‘show advanced commands’.

As for how all this works, you need to understand that WebCore automatically treats a string which contains commas as a comma separated list. The count function will tell you how many items are in the list (but won’t count any items that are just ‘off’). What the for loop is doing is going through and sending separate push notifications for each message that was added to the list. This is why I mentioned at the beginning non of your push messages can contain commas since that will mess up the list. ArrayItem accesses individual items in the list as numbered 0 through n-1.

If you change the ‘off’ string to something longer, it will all work fine putting all the commas in and then sending each message individually. If you want all the messages sent as one big list, you can take out the for loop.


#10

Great, it worked now. Yep, On/Off was just part of the test, I now set the actions in the pistons where they’re actually supposed to go :slight_smile:

Thanks again!
Rodrigo


Calculate time based on switch percentage?