Would like to check device every XX minutes for offline status

I have tried searching the forum and have come up short if this is possible. On WebCoRE, I currently have a piston that runs every 15 minutes and checks to see if one particular device is offline (and then power cycles it). I have tried to setup a SharpTools rule to do this if the offline state occurs, but as I’ve read in a few posts (here and other forums), this method almost never works for SmartThings (subscribing to the ST event). However, “requesting” the healthStatus or device status seems to be a reliable method, however once a day is the most it seems the rules engine allows.

1 Like

I agree once a day is not enough, for a Rule Engine not to have an Every X option is quite strange. I think they don’t have the resources, so we would need to make a request, as they would classify this request as a “feature request”, then depending on how many people up vote this “feature” request, it gets higher priority to implement. At the moment it seems they are working on the new ST API and transition tools. Even though an “Every X” should of been done on Sharptools years ago. The workaround Sharptools have to do at the moment is make the rule http executable, sign up to an online cron job website, and then call it every X you want. Very convoluted and time consuming for something so simple.

1 Like

Another approach is to use a variable changing to true as your trigger. Then flip it to false at the start of the rule, run your actions, delay for your duration and then flip it back to true.

2 Likes

That might work. I’ll have to try that when I get home and have a chance.

1 Like

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