Integration to add battery notes to a device, with automatic discovery via a growing battery library for devices.
Track both the battery type and also when the battery was replaced.
Please ⭐ this repo if you find it useful
This integration will set up the following platforms.
Platform | Name | Description |
---|---|---|
sensor |
Battery Type | Show battery type. |
sensor |
Battery last replaced | Date & Time the battery was last replaced. |
button |
Battery replaced | Update Battery last replaced to now. |
service |
Set battery replaced | Update Battery last replaced to now. |
Or
Search for Battery Notes
in HACS and install it under the "Integrations" category.
Important
Add the following entry to your configuration.yaml
battery_notes:
Restart Home Assistant In the HA UI go to Settings -> Integrations click "+" and search for "Battery Notes"
More Details
- Using your tool of choice open the folder for your HA configuration (where you find
configuration.yaml
). - If you do not have a
custom_components
folder there, you need to create it. - In the
custom_components
folder create a new folder calledbattery_notes
. - Download all the files from the
custom_components/battery_notes/
folder in this repository. - Place the files you downloaded in the new folder you created.
- Add the following entry to your
configuration.yaml
battery_notes:
- Restart Home Assistant
- In the HA UI go to Settings -> 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.
-
Does a device have to be in the library?
No, you can always add a device manually by going to Settings -> Integrations -> Battery Notes screen add a new device where you can enter the battery details manually. -
Why is my device not being discovered?
It could be missing from the library or does not exactly match the name that your integration has. ZHA and Z2M for example have different manufacturers/models for the same device, you can still add it manually or contribute to the library. -
When is the library updated?
It updates when Home Assistant is restarted and approximately every 24 hours after that.
It will pull the latest devices that have been merged into the main branch, if you have recently submitted a pull request for a new device it will not appear until it has been manually reviewed and merged. -
How do I remove a battery note on a device?
Go into the Settings -> Integrations -> Battery Notes, use the menu on the right of a device and select Delete, this will only delete the battery note, not the whole device. -
Why does the device icon change?
Unfortunately where there are multiple integrations associated with a device Home Assistant seems to choose an icon at random, I have no control over this. -
Can I edit a battery note?
Go into Settings -> Integrations -> Battery Notes and click Configure on the device you want to edit. -
Why am I only able to see some of my devices when adding manually?
By default Battery Notes filters the device list to only devices with a battery, if you want to add a battery note to a random device then you can disable this filtering by adding the following configuration to yourconfiguration.yaml
and restart Home Assistant to see all devices.
battery_notes:
show_all_devices: true
- I only want to add notes to a few devices, can I disable auto discovery?
If you want to disable this functionality you can add the following to yourconfiguration.yaml
, after a restart of Home Assistant you will not see discovered battery notes.
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"
- If a device shouldn't be discovered because there are multiple revisions with the same model number but different battery types or it's optionally mains powered, it can be added to the library with a
"battery_type": "MANUAL"
to note it is a device that shouldn't have a battery definition added to the library to save removal/re-add because people don't realise there are variants.
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.