Monitor Multiple Device and Alert When Temperature Doesn't Change


1) Give a description of the problem

I have 6 SmartThings leak detectors that return an incorrect battery level and stop responding even though the battery level shows it’s fine. What I’d like to do is monitor the temperature they’re reporting and have a piston react if the temperature doesn’t change over a 12-hour period, as that will tell me that one or more sensor is likely dead.

Can someone help me design a piston that will do this? I could cobble something together that monitors each sensor but I’d like something that’s more efficient and more concise than the pistons I usually cobble together.

2) What is the expected behaviour?

I need something like this:

If Sensor1 or Sensor2 or Sensor3’s temperature stays the same for 12 hours then
"alert Message = “{sensorThatsNotResponding} temperature has not changed in 12 hours”
Push “alertMessage”
End if

**3) What is happening/not happen

Nothing is happening as I haven’t written the piston yet. I’m hoping someone with strong Webcore chops can assist me in creating a much more concise and efficient piston than what I usually come up with. Teach a man to fish and all that…

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full

If a solution is found for your question then please mark the post as the solution.


I’m happy to share my health check piston. It checks the health f all my battery powered devices. It’s easy to add extra devices into the device arrays at the start. For each device, I created a corresponding virtual device, which is turned ob if there is no activity from the battery device for the time specified. These are then displayed in an HE dashboard. I also update the statusmessage to display the last update of each device and show that on the HE dashboard.
There is some specific code for the presence sensors we have in the cars, which you may not need


Thanks for sharing that. I actually already have one but for some reason it never catches the fact the moisture sensors have gone offline. It works with every other device I have, but not the 6 moisture sensors.

The other odd thing is the battery level stops changing when it reaches are 50 or 55 percent even though the batteries are dead. I’m hoping that monitoring the temperature they’re reporting will give me a reliable way to tell when I have an issue with one of them.


I’ve given up on checking the battery levels, battery’s reporting 100% fail, others reporting 10% run for months etc. I think I’ve seen in the past that a device going offline does not produce an event. I;m not sure if you could periodically send a refresh t lithe device from WC, then check the status?

I found the temp readings work quite well, as long as the temps vary!


Here’s what I came up with. It’s not pretty but it seems to be working. If anyone has suggestions as to a more efficient way to do what I’m trying to do, feel free to offer feedback.


Here’s one I was playing with earlier then my hub decided it’s not gonna play nice and locked up.
You can adjust it to your liking, most obviously the frequency of the checking, it’s set to one minute right now since I was testing.

Edit: Line 34 needs to be edited to show count(deadDevices)


I did not know the age() function existed. Is there a list somewhere of all functions that are available in Webcore?


It’s here somewhere…


I looked there before I posted. Age is not on that webpage.


Thanks for putting that together. I just created a piston using that backup code and it will runs shortly. And as expected, it’s MUCH more concise than what I came up with. Much appreciated.


It’s right under the Integers section. It may have been added into the app but never really documented properly.


Mark, I tried to import that piston with the z632 code and it errors out every time. Not sure if it’s a webcore issue or if the code was deleted. I’d like to give this piston a try through as I’m in the same boat with a lot of people and battery levels not reporting correctly.




I think I figure out why it was erroring out, it looks like that maybe a RED snapshot of the piston and not a GREEN snapshot. Can you post a GREEN snapshot of it? Thanks


What is the length of time for the 1260601000000? Is this Milliseconds? When I entered into a calculator the math I came out to 500 days. I just want to make sure it’s not supposed to be 1260601000 for 12 hours.


It is milliseconds.
Try importing code feg5


Any way to easily add a PUSH alert to this? I tried adding the following however during testing if one device was in dead devices it sent all 6 devices in the PUSH. Color me confused as it should only be pushing whats in deadDevices


I actually have mine similar to yours…