# Battery status

A device which can report its battery level can do so in two ways:

1. Report when the battery is empty or low.
2. Report the precise battery level that is left.

Give your driver the `measure_battery` capability if it supports reporting precise battery levels on a certain numeric scale (e.g. 0-100%). Give your driver the `alarm_battery` capability if it supports alarm notifications when the battery level reaches a certain threshold (e.g. 'battery level less than 10%).

> Never give your driver both the `measure_battery` and the `alarm_battery` capabilities. This creates duplicate UI components and Flow cards.

Battery devices must specify an energy object with the `batteries` property. This should be set to an array of strings which represent the batteries in the device. For example, a device with 2 AAA batteries must specify the following energy object:

{% code title="/drivers/\<driver\_id>/driver.compose.json" %}

```javascript
{
  "name": { "en": "My Driver" },
  "images": {
    "small": "/drivers/my_driver/assets/images/small.png",
    "large": "/drivers/my_driver/assets/images/large.png"
  },
  "class": "sensor",
  "capabilities": ["measure_battery"],
  "energy": {
    "batteries": ["AAA", "AAA"]
  }
}
```

{% endcode %}

For more information check the [Energy documentation](/the-basics/devices/energy.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apps.developer.homey.app/the-basics/devices/best-practices/battery-status.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
