- Use the
properties.onlineproperty of thedeviceobject. - Use the
device.connectedanddevice.disconnectedevents.
Get Device Status Using Device Properties
Seam polls connected devices and accounts every ten minutes and updates the Booleandevice.properties.online property accordingly. Use a Get Device request to retrieve the current online/offline status of a device. Then, display the device status in your app.
You can also use the prebuilt device details Seam
Component,
which includes a device status display.
- JavaScript
- cURL
- Python
- Ruby
- PHP
- C#
Request:Response:
Get Device Status Using Connection-Related Events
When a device connection or disconnection occurs, Seam generates adevice.connected or device.disconnected event, respectively. You can retrieve these events using a List Events request or through webhooks and then display the corresponding status in your app.
To help you test your app against events—like device disconnection or
removal—that are difficult to orchestrate in a QA environment using real
devices, Seam provides a suite of
simulate endpoints that you can use in a
sandbox workspace. See Testing Your App
Against Device Disconnection and
Removal.Get Connection-Related Events Using a List Events Request
When issuing a List Events request to retrievedevice.connected or device.disconnected events for a specific device, include the following parameters:
| Parameter | Type | Description |
|---|---|---|
device_id | String (UUID) | ID of the device for which you want to retrieve
device.connected or device.disconnected events |
event_type | String | Event type that you want to retrieve, that is,
device.connected or device.disconnected |
since | String | Desired starting event generation date and time You must include since or between. |
between | Set of two strings | Desired starting and ending event generation dates and times For example: [“2024-01-01T00:00:00Z”, “2024-02-01T00:00:00Z”]You must include between or since. |
device.connected events for a specific device since January 1, 2024:
- JavaScript
- cURL
- Python
- Ruby
- PHP
- C#
Request:Response:
Receive Connection-Related Events Using a Webhook
You can set up webhook endpoints to receivedevice.connected and device.disconnected events. Then, you can use the receipt of these events to display the corresponding device status in your app. For more information about configuring webhooks, see Webhooks.
