Integration to add battery notes to a device, with automatic discovery via a growing battery library for devices
Please ⭐ this repo if you find it useful
This integration will set up the following platforms.
Platform | Description |
---|---|
sensor |
Show battery type. |
Or
Search for Battery Notes
in HACS and install it under the "Integrations" category.
Restart Home Assistant
Important
Add the following entry to your configuration.yaml
battery_notes:
Restart Home Assistant a final time In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Battery Notes"
Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml
).
If you do not have a custom_components
directory (folder) there, you need to create it.
In the custom_components
directory (folder) create a new folder called battery_notes
.
Download all the files from the custom_components/battery_notes/
directory (folder) in this repository.
Place the files you downloaded in the new directory (folder) you created.
Restart Home Assistant
Add the following entry to your configuration.yaml
battery_notes:
Restart Home Assistant a final time In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Battery Notes"
On the "Configuration" -> "Integrations" -> "Battery Notes" screen add a new device, pick your device with a battery and add the battery type. The battery type will then be displayed as a diagnostic sensor on the device.
Battery Notes will automatically discover devices (as long as you have followed the installation instructions above) that it has in its library and create a notification to add a battery note.
If you wish to disable this functionality then change your configuration.yaml
to set enable_autodiscovery to false
battery_notes:
enable_autodiscovery: false
Fork the repository, add your device details to the JSON document custom_components/battery_notes/data/library.json
, and then submit a pull request.
- The manufacturer and model should be exactly what is displayed on the Device screen within Home Assistant.
- The make & model names may be different between integrations such as Zigbee2MQTT and ZHA, if you see a similar device please duplicate the entry rather than changing it.
- Please keep devices in alphabetical order by manufacturer/model.
- The
battery_quantity
data is numeric (no quotes) and optional. If a device only requires a single battery, it should be omitted. - The
battery_type
data should follow the most common naming for general batteries (ex. AAA, D) and the IEC naming for battery cells according to Wikipedia (ex. CR2032, 18650) - If a device has a bespoke rechargeable battery you can use
"battery_type": "Rechargeable"
- For devices like smoke alarms where the battery is not replaceable you can use
"battery_type": "Irreplaceable"
For the example image below, your JSON entry will look like this:
{
"manufacturer": "Philips",
"model": "Hue motion sensor (9290012607)",
"battery_type": "AAA",
"battery_quantity": 2
},
If you want to contribute to this please read the Contribution guidelines.
A lot of the inspiration for this integration came from the excellent PowerCalc by bramstroker, without adapting code from PowerCalc I'd never have worked out how to add additional sensors to a device.
Thanks to everyone who has submitted devices to the library.