- Use the
properties.has_direct_power, andproperties.batteryproperties of thedeviceobject. - Use the
device.low_batteryanddevice.battery_status_changedevents.
Get Device Power Status Using Device Properties
Seam polls connected devices and accounts every ten minutes and updates the following device properties accordingly:| Property | Type | Description |
|---|---|---|
properties.has_direct_power | Boolean | Indicates whether the device has direct power, that is, whether the device is wired |
properties.battery | Object | Battery information, including level and
statusIf the device is offline, Seam does not return this property. |
properties.battery.level | Number (0-1) | Battery level of the device as a decimal value between 0 and 1,
inclusive If the device is offline, Seam does not return this property. |
properties.battery.status | Enum (string) | Current status of the battery charge level. Values are:
|
You can also use the prebuilt device details Seam
Component,
which includes a device power status display.
- JavaScript
- cURL
- Python
- Ruby
- PHP
- C#
Request:Response:
Get Device Power Status Using Battery-Related Events
Seam generates the following battery-related events:device.low_batterydevice.battery_status_changed
Get Battery-Related Events Using a List Events Request
When issuing a List Events request to retrievedevice.low_battery or device.battery_status_changed 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.battery_status_changed events for a specific device since January 1, 2024:
- JavaScript
- cURL
- Python
- Ruby
- PHP
- C#
Request:Response:
Retrieve Battery-Related Events Using a Webhook
You can set up webhook endpoints to receivedevice.battery_status_changed and device.low_battery 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.
