BatteryV1 Trait
Information regarding device that uses battery as sole or one of the power source.
Trait Type: Standard
Reported States
Note: See Overview: Device Reported State for more information on reported state flows.
State Definitions
batteryLevel State
Indicates the battery level based on the reporting done by the device. Does not communicate the percentage the device considers to enter each state.
Data Type: Enum
Valid Values
Enumerated String | Description |
UNSUPPORTED | Device does not report data for this state. |
NORMAL | batteryLevel is sufficient for normal device operation. |
LOW | batteryLevel is getting low, consider replacing batteries soon to prevent loss of device functionality. |
CRITICAL | batteryLevel is critical, replace batteries immediately to prevent loss of device functionality. |
Device State Query GQL Examples
Request Example
query Device {
device(deviceId: "9a8f6104-6c50-476e-90ee-16b9a2dafc8d") {
id
traits {
... on BatteryV1DeviceTrait{
name
state {
batteryLevel{
reported {
value
}
}
}
}
}
}
}Response Example
{
"data": {
"device": {
"id": "9a8f6104-6c50-476e-90ee-16b9a2dafc8d",
"traits": [
{
"name": "BatteryV1",
"state": {
"batteryLevel": {
"reported": {
"value": "NORMAL"
}
} }
}
]
}
}
}Notification Events
Note: See Overview: Device Notifications for more information on notfication event flows.
infoBatteryPercentage
Information on the battery percentage.
Details Fields
Field Name | Description | Data Type |
percentage | Battery percentage as an integer. | int |
Event Example
{
"eventType": "DEVICE_NOTIFICATION_REPORTED",
"notifications": [
{
"category": "notification",
"notificationName": "infoBatteryPercentage",
"notificationType": "INFO",
"type": "notification reported",
"createdAt": "2024-12-20T14:49:55.000Z",
"sampledAt": "2024-12-20T14:49:39.663Z",
"installationId": "819cd607-aede-482e-9aa0-8b65d420e300",
"deviceId": "9a8f6104-6c50-476e-90ee-16b9a2dafc8d",
"traitName": "batteryV1",
"message": "Current battery level is at 90%",
"id": "92197db2-63a4-4832-9a20-59dd188b6504",
"details": {
"percentage": 90
}
}
]
}warningBatteryLevel
Warning on battery level reaching low or critical.
Details Fields
Field Name | Description | Data Type |
status | Reported battery level. | LOW, CRITICAL |
Event Example
{
"eventType": "DEVICE_NOTIFICATION_REPORTED",
"notifications": [
{
"category": "notification",
"notificationName": "warningBatteryLevel",
"notificationType": "WARNING",
"type": "notification reported",
"createdAt": "2024-12-20T14:49:55.000Z",
"sampledAt": "2024-12-20T14:49:39.663Z",
"installationId": "819cd607-aede-482e-9aa0-8b65d420e300",
"deviceId": "9a8f6104-6c50-476e-90ee-16b9a2dafc8d",
"traitName": "batteryV1",
"message": "Device battery level is CRITICAL",
"id": "92197db2-63a4-4832-9a20-59dd188b6504",
"details": {
"batteryLevel": “CRITICAL”
}
}
]
}What made this section unhelpful for you?
On this page
- BatteryV1 Trait