Rules Device Action commands

In a device action there are four choices: on off refresh ping
I clearly know what on and off do, but can’t firgure out what refresh and ping do.

Also, I have created two custom presence sensors in Smaprthings, one for me and one for my wife. I have a rule that determines our presence based on our phones, which works perfectly, and I want to set these to present or not present but the only choice is ping. How do I accomplish this?

Welcome to the community and thanks for posting!

SharpTools doesn’t hardcode a list of commands and instead asks SmartThings (or your connected hub) what commands are available for a device. In other words, your hub has reported that your particular device has those refresh() and ping() commands.

Those commands were popular in Groovy DTHs.

  • A refresh() command should try to send a command to the device asking to make sure the hub has the latest state. This generally isn’t needed as devices automatically report their state when it changes, but this command was common in Groovy DTHs for various legacy reasons (including Lutron Patents preventing ‘instant status’ reports in older Z-wave devices, thus requiring some form of polling).

  • The ping() command is part of the healthCheck capability and could be implemented in various ways. The general idea was to ‘ping’ a device by sending it a message to make sure it’s awake. Sometimes the DTH would wait for a response (sometimes called a ‘pong’… ping→pong) and othertimes it was just blindly sent without awaiting a response… for example as an attempt to wake a device.

I’m not totally understanding what you’re trying to accomplish because I’m not sure what the “these” are that you are trying to set. But if you want to display presence in a tile in a dashboard, for example, then create two virtual presence sensors (I use TAustin’s) in SmartThings. Create two routines for each, setting the sensor to present or not present based upon the SmartThings presence. Then add that virtual presence sensor to the dashboard.

My apologies, I guess I got so caught-up in responding to the first question that I missed this one.

If these are legacy Groovy DTHs for Virtual Presence devices, that’s likely the issue. The new SmartThings APIs require that any custom commands like arrived() and departed() must be defined within a Custom Capability. Most of the legacy Groovy DTHs didn’t do this, so those commands aren’t exposed in the new SmartThings APIs.

There’s a variety of community developed Edge Drivers for virtual devices that you could switch to. SmartThings will shut down Groovy DTHs soon anyway, so it’s probably worth looking at your options for switching anyway!