Howto create battery alert without creating a template for every device

Yes, or just comment them out

1 Like

So I finally had one of my batteries drop below the level I set. Everything worked perfectly. Notifications and all. I put new batteries in the device today though and the battery sensor has not updated so I keep getting the same notifications. I have a modified version as I don’t use MQTT to generate the sensors. Any ideas @NotoriousBDG?

Does anyone have any idea how to do this?

Would it be possible to post this non-MQTT version?

It is just the regular version minus the two mqtt automations. It works very well except for updating the battery sensors. I don’t think there is a trigger to update them outside of a Home assistant restart.

If I, or someone else, could figure that part out, it would be very beneficial for me.

1 Like

Im seeing potential errors from the package in my installation - errors originally raised at Error doing job: Task exception was never retrieved - TypeError

Any suggestions on where to start investigating?

Ha ha ha…I get that error also. Had no idea where it was coming from. Get it at every start-up

hi @NotoriousBDG

Thanks for your battery sensor package, I 'm using the latest version from your github (v1.1.2)
Very easy to add to my home assistant and It’s working well.

Cheers
Kiwi

1 Like

Hello,

Anyone have done some node-red conversion? I’m looking to create a telegram notification flow (as I can’t use the same bot twice in HA and node-red). I’m not sure to fully understand how the telegram automation, especially the action part of the rule:

action:
- condition: template
value_template: *low_battery_check
- service: notify.telegram
data_template:
title: “Low Battery Levels”
message: *message

especially the *low_battery_check and *message. So I don’t know yet how to recreate this is node-red.

@NotoriousBDG,

Hi, I finally installed mosquitto and re-installed your code. But it dont creating sesors for my xiaomi devices… I can see only my iphone battery in the group.
Any suggestions?

Thanks a lot!

Naor

Could it be possible using the “homeassistant.update_entity” service?
" Please note that you must be on v0.81.1 or later. v0.81.0 did not allow the use of a list for the service data for homeassistant.update_entity"

See post below.

i’m not a code ninja but am using this low battery tool.

so if we were to modify this low battery automation, would we leave the template sensors in place and just change our automation to use this homeassistant.update_entity service?

My bad… MQTT discovery was not activated.

Works like a charm!

Things has been working swimmingly for months without a hiccup. Wonderful code work!
However, since the mqtt fiasco, things are back running but I’ve got some orphan battery sensors out there who’s names have changed and I cannot figure out how to get rid of them.
Question: Is there a place where I can just get rid of the past and rebuild it (just the battery sensors)?

I wanted to try this out, can the first post be updated with the latest package? I tried to scroll through the 400+ posts to find the latest package, but not sure I got it

1 Like

Hey I was just implementing your awesome script. I have the same thermostat like @Nightcat and encounter the same problem. Any way I can support?

First of all, Thanks! This is a great pacakge! The scripts works nicely for some of my battery levels like phones and so on. I also have a bunch of binary sensors which are xiaomi devices which are not showing up by default. (MQTT, and discovery is turned on).

I tried to add a battery_template like the following:

binary_sensor.door_window_sensor_158d000183ff71:
  friendly_name: Front door
  device_class: door
  battery_template: "{{ state_attr('binary_sensor.door_window_sensor_158d000183ff71', 'battery_level') | int }}"

but that doesn’t give me any result? Anyone knows how to get that to work? Thanks in advance.

@Dixey
you need to clear the retained config messages from your mqtt broker.
Check in your states screen if the battery sensors show you the mqtt topic of their config message and then go ahead and send an empty retained message at that topic to clear them.

I hope this helps

1 Like

@PixelJonas
I dont think @NotoriousBDG has done anything about that bug yet, he hasnt updated the project in a while…
So far I still have the same bug, I will try and have a look into the code to see if I can find any solution…