Would like to check device every XX minutes for offline status

Do every xx minutes/seconds seems like a basic fundamental need. Tried to find the feaure request no luck.

If its outthere how do i find it. Thanks

Joe

I don’t believe there’s an existing feature request for trigger every XX minutes, but @Bry has you pointed in the right direction. :slight_smile:

The vast majority of time that we receive support messages for ‘every XX minutes’ rules, we’ve found that there’s a better event driven approach that can solve the need. Of course there’s exceptions to everything, so I’m happy to hear what you’re trying to accomplish to see if there’s a good way to do it today!

Essentially, I’m trying to recreate the “do” loop shown in the bottom part of this piston (the top never runs, as it never gets triggered).

Another use case for looping. A Halloween animitronic decoration. You want it to run for 2 minutes, turn off for 2 minutes, run for 2 minutes . . .

You can do something similar to what I showed above. Use a variable as the trigger for starting the automation. Then the first part of the flow is a check to see if the variable is enabled. I’ll come back to why in a second. Then have that delay 2 minutes, turn on the light, delay 2 minutes, then turn it off. Then add another trigger for the light turning off.

Now when the variable is set it starts the cycle: wait, on, wait, off > repeat as long as the variable is still true

I missed that the first time around. Never thought about a variable changing as the trigger. Looks like a loop to me!

1 Like

It works fine. I have been using the same process for several timed rules.

1 Like

There is a new API and subscription type for health status of devices (‘offline’ status) in the next-gen SmartThings platform. I suspect this would be the best way to query for this data going forward with SmartThings killing off Groovy and its associated way of checking health status.

I believe you could query the API endpoint directly in an HTTP Action, but of course that would require polling the endpoint. If there’s enough interest in it, I believe we could build the event driven version of it natively into SharpTools.

4 Likes

Not sure if others need it or not. I just have a flaky Z-Wave water valve (Watercop version) that drops off. I even tried to get a new faceplate, but “supply chain issues” they can’t help right now.

Thanks.

1 Like

I think this would be helpful. A lot of us use the Notify Me When(?) SmartThings app to check if something is offline and since it’s Groovy it’s probably going away. It would be nice to have a way to check offline status. If some of my devices go offline, it usually means that the breaker switch tripped in the garage and I need to check ASAP because otherwise the stuff in the freezer will melt! :laughing:

1 Like

You can use this Edge driver in ST for offline notifications.

That’s an option. However, it requires that another app be running all the time on a computer connected to the internet, something for which I can’t guarantee.

Yes, the inability of ST to send requests to non-local endpoints is frustrating and somewhat mystifying, and is the reason that driver requires the intermediate “edgebridge” running on a RPi or such.

For now, here’s a simple SharpTools flow to get the status of an individual device. You only need the DeviceID (which you can get from my.smarthings.com by clicking on an individual device in that window and an access token which you can get from https://account.smartthings.com/tokens

This flow can easily be looped to repeat at regular intervals.

ETA: I included the “Set Variable” action only to show the specific value for the $context.response.data variable. You don’t necessarily need to do this.

3 Likes

Great. Thanks for the rule. I’ve been messing a bit with the API (using Postman) to see what info I get and what it can do. This will be helpful.

2 Likes

Is it possible to turn a device on/off using this webhook

Yes, the general syntax is

https://api.smartthings.com/v1/devices/“my device ID”/command

1 Like

Thanks for this info!
Is there a way to pull a list of DevID’s or is it simply a manual (look at IDE / write it down / add to ST Rule’s GET) process, repeated for each device in the network?

You can make a GET request to https://api.smartthings.com/v1/devices (along with an Authorization header and Bearer token), which will give you detailed information about all of your devices, including the the deviceId and name for each of them (in JSON format).

You can then parse the JSON response however you choose to create a comprehensive list of IDs and names. I have way too many devices and am too lazy to get the IDs one at a time. :smirk:

1 Like