Meaning of the StateChangeOnly field in Device Subscriptions

According to the API, https://smartthings.developer.samsung.com/docs/api-ref/st-api.html#operation/saveSubscription, you can specify stateChangeOnly (boolean).

I can guess what this means. But what does it mean?

true: trigger only when state changes
false: trigger all the… :thinking: wait maybe I don’t know what it means…

for a Temperature Measurement, is it periodic? If so what period? And will it still trigger if there is a change?

Hello @wtsang01

For the subscription configuration, the difference between the values of ‘stateChangeOnly’ is as follows:

  • True: the events are received only when their attribute values have changed.
  • False: the events are received whenever they are sent.

Note: Take into consideration that some devices might only send events when the values change.

For the Temperature Measurement, the refresh period depends on the device and, as mentioned above, if its value changes.

1 Like

The device is a Samsung Motion Sensor IM6001-MTP. How is the update period determined? Is it factory set (and to what value)? Can it be user set?

Hello @wtsang01,

There is a capability named healthCheck, it has a “checkInterval” static value, this means that the device reports the current status (online/offline,etc.) in that period, and it cannot be modified.
For example, a SmartThings multipurpose sensor has an interval value of 300 seconds

"healthCheck": {
    "checkInterval": {
        "value": 300,
        "unit": "s",
        "data": {
            "protocol": "zigbee", ...
        }
    }, ...
}

To see the value of other devices, you need to make a GET request to device status URL, https://api.smartthings.com/v1/devices/device-id/status.

Despite the static interval, you can implement a rule (using the Rules API) to refresh the status.

You would use the rules endpoint, below you can find an example, and the workflow is:

  1. EVERY n quantity of minutes
  2. Send the command REFRESH to the specified device(s)
{
    "name":"Refresh device status",
    "actions":[
        {
            "every": {
                "interval": {
                  "value": {"integer":5},
                  "unit": "Minute"
                },
                "actions": [
                    {
                        "command": {
                            "devices": [
                                "device-ID"
                            ],
                            "commands": [
                                {
                                    "component": "main",
                                    "capability": "refresh",
                                    "command": "refresh",
                                    "arguments": []
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
}

You just need to replace the device ID that you get from the device list.

Note: to create the rule, you can use your Personal Access Token and any API testing tool, such as Postman.

1 Like