Howto create battery alert without creating a template for every device

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…

@RolfKoenders
did you just install the package?
the battery sensor only gets created or updated every time the original entity gets updated.
So for your Xiaomi Sensors you should force them to update by opening the door/window so that the sensor has to send an updated status.
I had the same problem when I started (same sensors) and some even took about 1-2 days to finally get created, but after that it has worked very well.

If with installed the package you mean thats its inside my Package folder? Yes, i have also the battery view tab which doesn’t show my door sensor after opening a couple times now. Is my template correct because also for my switches and smoke detectors i’m currently not seeing them, maybe i could force a refresh?

thank you.

You actually dont need to create such a template. Its all done by the package.
Can you post a screenshot from the entity in question form the states page?

Oke, i will remove the template. Here are the screenshots.