HTTP request for offline devices

Hi,

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:

  1. why I dont get an email
  2. why not all of my devices are shown when I run the URL with my token.
    Screen Shot 2023-02-03 at 9.12.24 PM
    Screen Shot 2023-02-03 at 9.11.51 PM

Thereā€™s a few things I would check with your rule configuration:

  1. 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 ā€˜ā€™

  2. 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.
    https://lab.sharptools.dev/smartthings/healthcheck?token=YOUR-TOKEN
    

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).

1 Like

I did what you told me to do.
See attached mail I have received.

Regarding section 2, I have offline temp sensor which is not in the list

Screen Shot 2023-02-03 at 9.52.26 PM

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}}

chrome_CP5QA31yqC

1 Like

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.