I tried to make a rule to get notify on Offline devices with http request rule like Josh explained in this post: Labs: SmartThings Health and Battery Reports
The problem is that I dont get notified by email.
And when I post my URL with the token I get a list of devices that are offline, but not all of them.
So my question are:
why I dont get an email
why not all of my devices are shown when I run the URL with my token.
There’s a few things I would check with your rule configuration:
The condition will never be valid as the content of textSummary is not going to be ' Offline'. If you want a notification only when there are devices that are offline, change the condition to be not and empty string (eg. add a space and then delete it, so the field is blank)
$context.response.data.textSummary is not ‘’
I’m not sure what the $context.response.data.textSummary` is in your HTTP Action. That line should be the exact same URL that you put into your browser to get the result in your last screenshot.
What do you mean you get a list of devices that are offline, but not all of them? The list of devices provided by this endpoint are all the devices that SmartThings thinks are offline.
If the devices don’t properly implement offline status reporting, then they won’t show up on this list (eg. old community Groovy DTHs).
The email action was not shown in your screenshots above, but if I had to guess, the action has the text$context.response.data.textSummary in it rather than having used the +VARIABLE button next to the input to insert a variable.
The text should be a blue color if it’s using a variable as shown in the example we discussed on Facebook:
When you have your cursor inside the field for editing, you should see that the raw version is actually wrapped in double squiggly brackets: {{$context.response.data.textSummary}}
Now its working, many many thanks, you were right, I should have used the VARIABLE button.
Thanks Josh,
By the way, Do you have any idea why one device is missing from the list and shown as offline in my app ? it’s a temp device, I have few others and they are ok
Maybe sharing some screenshots of what you’re seeing would help?
As mentioned above, this labs endpoint queries all of the devices in the SmartThings API for their reported health status and checks for their offline status. If the status is exactly'OFFLINE', then its added to the list of offline devices.
You could query the status of that individual device directly as shown in the following thread to see what the SmartThings API is reporting for it. It’s a bit more of a pain to test as you can’t do it in your browser and instead have to put some headers together.