Would like to check device every XX minutes for offline status

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

If you hate JSON as much as I do, you can parse the CLI output:

smartthings devices:status > foo.csv

Open the csv in Excel and do a Text to Columns using │ as the delimiter. It’ll wind up like this:

That’s a good idea. I haven’t messed with the CLI too much, as I’ve been primarily focused on being sure I was in good shape for the groovy deprecation. Just as an aside, I parsed the JSON output from the GET request in Excel as well using Data | Get Data | From File | From JSON. It made the process simple.

I’ll have to try that! Parsing the output is often the biggest pain!

They are also available in SharpTools.

  1. Open your User Page
  2. Tap the … next to your location
  3. Scroll down and tap on your device
  4. Flip the advanced toggle on and review the Device ID field*

*One exception here is multicomponent devices which show in the format deviceId:componentId

1 Like

It’s very quick and simple to do in Excel, although if you’re new to parsing JSON this way it might not be entirely intuitive. This video might help.

1 Like

I set this method up for a loop. This seems to be exactly what I was looking for. Thanks!

1 Like

Our example is we have a hot water circulation pump, we turn it on every 20 minutes for 5 minutes.

1 Like

It sounds like those are your two events. Or at least one event with delays in the rule.

trigger - circ pump turns off
flow - wait 20 minutes, turn circ pump on, wait 5 minutes, turn circ pump off

Sounds kind of important though, so I might add a separate rule as a backup. Maybe triggers on the circ pump staying on or off longer than you expect as a failsafe. Or use a daily check at a certain time with an if condition to see if it’s stayed on or off for too long and restart things.

I would easily pay DOUBLE the premium subscription for ability to execute every X minutes.

I tried putting WGET into CRON jobs on our linux server with HTTP triggers and it resulted in more failures.

Use case:

Every 30 minutes turn on hot water re-circulation pump for 5 minutes.
Every 2 hours, reset the garage temp back to 50 degrees, regardless of what it was set at.
Every 4 hours, turn off the fireplace for 10 minutes (resets it).

This could easily be a revenue driver this platform.

Yeah, I don’t really want a bunch of triggers to monitor if something does or not happen. Just turn on the pump every 30 minutes for 5 minutes.

Technology based solutions are much more fun. But maybe an old fashioned wall timer with those little plastic tabs for on/off might be simpler? :wink:

https://www.walmart.ca/en/ip/stanley-timeit-twin-2-outlet-grounded-indoor-mechanical-timer-white/6000197240881

Anyone interested in testing a Labs feature that lets you make a single HTTP request and returns the offline status of all your devices in a single request? Send me a PM. :smiley:

Human Readable Format:

Motion Elliot, Corner Outlet, Aeon Multisensor

JSON Format:

{
  "items": [
    {
      "deviceId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX1",
      "name": "Motion Elliot"
    },
    {
      "deviceId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX2",
      "name": "Corner Outlet"
    },
    {
      "deviceId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX3",
      "name": "Aeon Multisensor"
    }
  ]
}

Edit: Just wanted to clarify that this is something of an ‘extra’ for SharpTools premium members as it requires the HTTP Action within the Rule Engine.