Hi,
I have had the same problem for nearly a year now
Our company asked me to write some code to generate reports on all of a client’s smartthings device telemetry. I did this by reading the capability status of the devices on a loop via https://api.smartthings.com/v1/devices/{{deviceID}}/status and recording in a dB, then graphing that.
The API only provides the latest status of the device, though. This is insufficient as the status changes too often for the loop to catch all statuses before they change, e.g. a quickly open and then closed medicine cabinet door.
I asked the community before how to get historic events for a device or for all devices in a locations or preferably in an account and I was told I should “subscribe” to the events and was pointed at GitHub https://github.com/SmartThingsCommunity/smartthings-core-sdk/blob/master/src/endpoint/subscriptions.ts#L339
However I could never figure out how to actually do this, and had to move onto something else. I am back to this issue now and I have tried to find documentation and all links to https://smartthings.developer.samsung.com now point to the “We’ve moved” landing page which is a dead end, i.e. doesn’t seem to forward you onto the moved document.
My questions are as follow:
-
Does the api.smartthings.com API allow me to get the statuses of a device for the last x mins?
If not (and it doesn’t look like it), why ever not? I can see the events of a device in the smartthings account when I sign in so the data exists. Why can’t I query it via api? -
Is there a step by step tutorial on how to get device data sent to my end point via subscription as the events occur? I’m sure there is I just can’t find it. Can these subscriptions be created dynamically?
-
When I researched before I found (but cannot find again) statements that claimed there is a limit on how many subscriptions I can create. I think it was 20 devices. I need to be sure that if I go down the route of subscriptions I don’t end up hitting a limit. My client might have 50 devices. It could be that I can subscribe to a capability rather than a device, might that be possible?
I would appreciate any help with this.
Seamus