[Custom Component] Battery Notes

You can’t, I don’t want to provide that as someone will abuse it and keep pulling the library on an automation and get GitHub annoyed with me.
Just restarted my dev instance to pull the library and I’m not getting an error.

makes sense!! totally sense!

will restart my HA now (again) and observe …
=> worked like a charme! Apologies for the false alarm.

No problem, good to get these sort of odd things reported.
I’ll change it to a warning and give a bit more info on why it could be happening.

2 Likes

Version 2.1.2 released yesterday adds a handy new event.
You can now get reports when Battery Notes devices have not reported their battery state in a while to track down those dead devices.

Details of how to use this are in the Battery Notes Community, there’s also a handy blueprint further down if you prefer that than writing your own automations.

Thanks much for this integration, I’ve installed and like it very much.
I have a question that presented itself this morning after my smoke-detector woke me this mornig with the chirping reminder to replace my 9-volt battery. Is there a means to add a manual entry for a battery of a device that Home Assistant is not aware of? Offline?
My home has (7) smoke alarms that I need to replace batteries every so often and it would be neat to track the replacement date and quantity .
PLease direct me to a solution for this.
Thanks

Glad you like it. No it’s only possible to have the last replaced associated with a HA device I’m afraid.
There are smoke alarms that integrate with HA, I use Frient zigbee ones myself which seem good.

Just to clarify question. Can I make a dummy sensor in HA or your integration as a place holder, so I can maintain a entry of date and the type of battery used ?
ex. sensor.garage_fire_battery and then be able to say It was replaced today.
Much like you other battery replacement sensor options
Just a thought so to maintain 1 place to go for battery notes :slight_smile:

A sensor must be part of a device for battery notes to work so you wouldn’t be able to do that with a template sensor.

Thanks again

Have a few devices that where not in the database. Can these be added

{
    "manufacturer": "Aqura",
    "model": "Aqura Cube T1 Pro",
    "battery_type": "CR2450",
    "battery_quantity": 1
},
{
    "manufacturer": "First Alert",
    "model": "1044807",
    "battery_type": "AA",
    "battery_quantity": 2
},

Thanks for the great work

There is a fairly new HACS integration which allows you to add template sensors to existing devices, or group them together to make a “virtual” device. I’ve added several of these to Battery notes successfully. When creating the template sensors you have to give them unique ids so that they can appear in the UI.

2 Likes

That’s a really interesting project, I did wonder if that could be possible but haven’t had the time to investigate.

I have added these, but corrected spelling of Aqara.

There is a submission form for adding new devices to make it really easy in future.

Hi there.
When I add this automation:

I get an error in my trace of the automation:
“Error: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘event’”

https://andrew-codechimp.github.io/HA-Battery-Notes/community/#battery-not-reported

Obviously I get the same when installing the Blueprint:

What should I do to solve this please?

That automation only works when it responds to event triggers, you can’t run it manually as it’s looking at the event data.

Create the daily check automation here and run that automation manually, it will kick off your existing automation ok then.

I need to put a note about this in the docs.

1 Like

Thanks, will do.

Another question. With this automation (https://andrew-codechimp.github.io/HA-Battery-Notes/community/#battery-replaced) it gives you a device id. But how to find this device id in our server? Would it be possible to let the automation give you the device name instead?

Thanks again!

1 Like

The Battery Increased event data has numerous fields, including device_name which you can use, see the docs here.

If you want to create a notification or similar you would do something like this.

alias: Battery Increased Notification
description: Battery Increased Notification
trigger:
  - platform: event
    event_type: battery_notes_battery_increased
condition: []
action:
  - service: persistent_notification.create
    data:
      title: |
        {{ trigger.event.data.device_name }} Battery Increased
      message: >
        The device has increased its battery level, you probably want to mark it as replaced
mode: queued
1 Like

Thank you, I thought I’ve read it good enough, but seems that I did not :sunglasses:
Will change my automation with your input.

No problem, you don’t come across events as often as other types of automation so it was a big learning curve for me as well.

I’ll add this example to the community as well, it all helps anyone else looking at this in future.

A new release of Battery Notes went live just now.
This release added a service to allow you to re-fire events on devices with low batteries. Ideal if you prefer to look at this on a weekly maintenance schedule rather than when the device first goes low.

There’s some examples of how to use it here