Help with Device Offline Notifications


#1

1) Give a description of the problem
It appears that my piston isn’t properly recognizing the device state.

2) What is the expected behavior?
When a device’s status changes to offline, I’d like to be notified about it so I can take action to fix/repair. I only want to receive a notification once and would prefer to receive notification somewhat quick, without bogging down the system with processing the piston all the time.

3) What is happening/not happening?
A device within my list has been offline today and I haven’t received any notifications. The piston state shows all devices are normal but my hub shows one device as offline.

4) Post a Green Snapshot of the pistonimage

I’d also like to avoid defining all the specific devices and am hoping it would just check every available device. This is based off another piston found in a different thread but it seems like I’ve mucked it up a bit. I added the “every” statement in the most recent versions. When I add an SMS notification to the “else”, I was getting texts every time the piston was run so it seems like the problem is with it recognizing the statuses.

Here’s what my IDE shows:


#2

Change your IF statement from “changes to offline” to “is offline”.

Since you’re not subscribed to changes in event status, your piston is only executing every 30 minutes. Unless the device changed to offline within a few seconds of the piston running, “changes to offline” will be evaluated as false.

“Changes to offline” is an instantaneous, real-time condition.

As an alternative, you could get rid of your 30 minute loop and just use the “changes to offline” as a trigger to make your piston run.


#3

After I posted that, I was wondering if the “changes to” would clash with the timer statement I had set up but I don’t have too much experience with CoRE or webCoRe quite yet. Good suggestion!

How would the piston subscribe to changes in event status? If I get rid of the timer statement (which I’d like to do), would this notification work?

Here’s an update based on your notes:

Do you think this will accomplish my goal? I enabled (confirmed via IDE as ONLINE) then unpublished a device that is somewhat easily testable so we’ll see if it works. Let me know if I should make any other changes.

Thank you!


#4

That should work! That little orange lightning bolt on the left of your piston indicates your piston is subscribed to that line. So any changes associated with the device, devices, or variables in a line with that lightning bolt will trigger your piston to run.

Now your alerts will be real-time rather than waiting for the 30-minute window to run down.


#5

Hmm… I don’t think it worked. I plugged in my Aeotec Speaker to change it from OFFLINE to ONLINE then unplugged it last night. It didn’t switch back to OFFLINE this morning when I checked but it is showing as OFFLINE just now but I didn’t get any notification. Could this be a problem with this particular device? Any recommendations for how to test other devices?


#6

Can you turn logs on full, try again, and post them? With those we can figure out where it’s failing.


#7

Sure thing. I’m not sure for this device how to switch it from ONLINE to OFFLINE as it seems to happen well after when it has been unplugged. Perhaps I can try it with another device, but I’m tying to figure out the best way to take a device offline. I’m open to suggestions. :slight_smile:


#8

Do you have any in wall dimmers with a disable switch on them? It’s used for changing light bulbs but also takes the simmer offline.


#9

Here’s the logs from when I last had updated the piston:

I believe this is from after the piston had last been saved:

12/14/2017, 4:18:06 PM +437ms
+1ms	╔Starting piston... (v0.2.100.20171211)
+381ms	║╔Subscribing to devices...
+456ms	║║Subscribing to Aeotec Speaker.$status...
+481ms	║║Subscribing to All Speakers.$status...
+503ms	║║Subscribing to Artichoke Light.$status...
+522ms	║║Subscribing to Atrium Slider East.$status...
+541ms	║║Subscribing to Atrium Slider West.$status...
+566ms	║║Subscribing to Atrium Tree.$status...
+584ms	║║Subscribing to Backyard Speakers [Harmony Activity].$status...
+601ms	║║Subscribing to Bar.$status...
+619ms	║║Subscribing to Bar North East.$status...
+640ms	║║Subscribing to Bar North West.$status...
+658ms	║║Subscribing to Bar South East.$status...
+677ms	║║Subscribing to Bar South West.$status...
+694ms	║║Subscribing to Housemate #1 Wifi Presence.$status...
+713ms	║║Subscribing to Christmas Lights.$status...
+731ms	║║Subscribing to Christmas Tree.$status...
+749ms	║║Subscribing to Dusk.$status...
+768ms	║║Subscribing to Easement Motion At Fence Line.$status...
+787ms	║║Subscribing to Easement Motion At Gate.$status...
+804ms	║║Subscribing to Easement Motion by Avocado.$status...
+822ms	║║Subscribing to Housemate #2's Bedroom Christmas Lights.$status...
+839ms	║║Subscribing to Housemate #2 Wifi Presence.$status...
+858ms	║║Subscribing to Housemate #2's Room.$status...
+876ms	║║Subscribing to Everyone but Housemate #2.$status...
+935ms	║║Subscribing to Front Porch Wall Switch.$status...
+955ms	║║Subscribing to Garage Door.$status...
+975ms	║║Subscribing to Garage Door Backup Sensor.$status...
+995ms	║║Subscribing to Hue B Smart Bridge (192.168.86.50).$status...
+1017ms	║║Subscribing to Living Room Chromecast.$status...
+1038ms	║║Subscribing to Living Room Lamp East.$status...
+1058ms	║║Subscribing to Living Room Lamp West.$status...
+1077ms	║║Subscribing to Living Room Lamps.$status...
+1096ms	║║Subscribing to Living Room Speaker.$status...
+1118ms	║║Subscribing to Master Bedroom.$status...
+1138ms	║║Subscribing to Nest Presence Device.$status...
+1158ms	║║Subscribing to Nest Thermostat - Entryway.$status...
+1183ms	║║Subscribing to Nest Weather (92706).$status...
+1203ms	║║Subscribing to Nightlight.$status...
+1225ms	║║Subscribing to Office Speaker.$status...
+1244ms	║║Subscribing to Pioneer VSX-80 HDZONE.$status...
+1262ms	║║Subscribing to Pioneer VSX-80 MAIN.$status...
+1281ms	║║Subscribing to Porch.$status...
+1299ms	║║Subscribing to Porch Bollard Lights.$status...
+1318ms	║║Subscribing to Porch Corner.$status...
+1336ms	║║Subscribing to Porch Lower Left.$status...
+1354ms	║║Subscribing to Porch Lower Right.$status...
+1373ms	║║Subscribing to Porch Outlet.$status...
+1391ms	║║Subscribing to Porch Upper Left.$status...
+1409ms	║║Subscribing to Porch Upper Right.$status...
+1429ms	║║Subscribing to Projector.$status...
+1448ms	║║Subscribing to Ring Doorbell.$status...
+1468ms	║║Subscribing to Housemate #3's IFTTT Location Presence.$status...
+1488ms	║║Subscribing to Housemate #3's iPhone.$status...
+1510ms	║║Subscribing to Housemate #3's Wifi Presence.$status...
+1532ms	║║Subscribing to SimpliSafe Virtual Switch.$status...
+1551ms	║║Subscribing to VSX-80 Speaker.$status...
+1569ms	║║Subscribing to Wemo Mini.$status...
+1752ms	║╚Finished subscribing (1453ms)
+2093ms	╚Piston successfully started (2093ms)

Here’s the next log after:

12/14/2017, 4:18:19 PM +969ms
+0ms	╔Received event [Home].test = 1513297099965 with a delay of 3ms
+320ms	║RunTime Analysis CS > 22ms > PS > 63ms > PE > 235ms > CE
+323ms	║Runtime (55045 bytes) successfully initialized in 63ms (v0.2.100.20171211) (322ms)
+324ms	║╔Execution stage started
+470ms	║║Condition #5 evaluated false (140ms)
+471ms	║║Condition group #1 evaluated false (state did not change) (142ms)
+477ms	║║Cancelling statement #6's schedules...
+486ms	║║Calculating (string) Everything is awesome as of + (string) Thu, Dec 14 2017 @ 4:18:20 PM PST >> (string) Everything is awesome as of Thu, Dec 14 2017 @ 4:18:20 PM PST
+489ms	║║Calculating (string) Everything is awesome as of Thu, Dec 14 2017 @ 4:18:20 PM PST + (string) ! >> (string) Everything is awesome as of Thu, Dec 14 2017 @ 4:18:20 PM PST!
+498ms	║║Executed virtual command setState (3ms)
+514ms	║╚Execution stage complete. (190ms)
+519ms	╚Event processed successfully (519ms)

It doesn’t seem like any other entries are showing on the logs and, since then, I’ve turned my Aeotec Speaker online then it went back offline (sometime between 8am PT and 11am PT this morning).


#10

Yeah, the top is from when you last saved/resumed it and the second is from clicking the test button… Nothing external has triggered the piston to run.

I just boarded my last flight for the day, finally. When I get home I can try a few things real time to help you get this going. It’ll work the way it’s written, we just have to find a different system variable to make it trigger properly.


#11

I’m going to try again later today - I was at this for quite a while and last night couldn’t even get ST to recognize my dimmers were offline. I had their breaker turned off for 45 minutes, during which time I sent them commands that failed to process, yet they still showed online.

I know in the past they’ve shown offline pretty quickly after the breaker was shut off.


#12

Yeah something is up. I unplugged some Peanut smart plugs I’m using for the holidays but it never showed OFFLINE for me either. I wonder if there’s some core functionality issues in the ST platform for status going on.


#13

When that gets sorted out, we’ll give this piston working. I have no idea why ST isn’t seeing anything as offline now but I’m glad it’s not just mine! lol


#14

This works for me.
It’s a daily check for devices that are offline.
Very similar to above but not quite.


#15

Thanks for sharing this piston. Yours works because the the timer statement mixed with $status being IS instead of CHANGES TO. It appears that there’s an issue either on the SmartThings side or maybe with webCoRE which doesn’t properly subscribe to $status with CHANGES TO. I’ll send a report to SmartThings about it to see if they can provide more context or perhaps open as a defect to fix.

My goal was to only have one notification when a device goes offline but not every time the piston is scheduled to run (because that would be notification overkill). Perhaps if I could set it up so there’s three variables defined: 1) devicesToCheck, 2) devicesToNotify, 3) devicesNotResponding. I’m trying to figure out if there’s a way I can send the SMS with the devicesToNotify variable value then add/move that value into devicesNotResponding (and have the piston show those values) while clearing devicesToNotify so it can be ready for another device to be added to it if it goes offline. I’m trying to figure out how to do this within the UI.


#16

Maybe just change it to do a check every hour, 2 hours, whatever you want.
Glad it works for you.


#17

I think I’m getting closer to my three variable idea. The only thing I need help figuring out is how to clear a variable and how to determine whether a variable is null/empty.


#18

So if your devicenotresponding variable has a device and it, and you fix the problem with the device to make it online again, how do you clear the variable?

So that the next day at 1700 you don’t get an incorrect notification that the device is still offline Because the variable did not reset?


#19

This piston is working if a regular device is off (just found out my door lock was offline), but it’s not working with my echoes. :frowning: (Using Echo Speaks)