Howto create battery alert without creating a template for every device

That worked great, thanks!
Now time to try appdaemon, worse comes to worst and I have difficulties with it, I can install this package every few months to get an update on my sensor batteries then remove again :slight_smile:

The Xiaomi and Hue sensors seem to last for ever!

Hello, first off all, thanks NotoriousBDG for the work.
This battery thing is something very usefull into HA.
I tried to install but i didnā€™t succeed.

What is did:
Iā€™m using Hassio

  • Install the official addon: Mosquitto broker
  • Start it.
  • Created a user for mqtt
  • Added it with ā€œIntegrateā€ (i did not have to full in the username and password)
  • Added the battery_alert.yaml to the packages folder
  • Restart

This i what happened in HA:
A group created.

Nothing else happened, i donā€™t have the sensors in HA now that wil show the battery level from my devices.
Did i do something wrong?
Is my mqtt not working as it should be?

Scrolled back in this topic but i did not find the answer.

Thanks

Lovelace wont automatically add the items.

look into ā€œgroup-cardā€ - Howto create battery alert without creating a template for every device

Can someone help me?

Only you would be able to figure out which devices are which, but if I had to guess, you might have tried the Home Assistant iOS beta app on one or more devices. The iOS beta app uses the ā€œBattery Levelā€ name by default unless you change it.

You can rename this easily from the UI. Go to Configuration -> Integrations -> Mobile App: Stefanoā€™s iPhone (or whatever it might be called). Find the ā€œsensor.battery_levelā€ and then rename it like this:

Then it should not show up as duplicated. Hope this helps.

Created the group-card.js.
And added it to my lovelace page.
The battery sensors, should they be created automatically now?

Tnx

card:
  show_header_toggle: false
  title: Battery Status
  type: entities
group: group.battery_status
type: 'custom:group-card'

Itā€™s working! Had to wait a little for the battery entities to show up one by one.

Tnx!! :smile:

Thanks a lot for your help!!
Sorry for my late response but iā€™m In vacancy!! :slight_smile:
I have also other duplicated sensor how can I hide or delete the other sensor?
Itā€™s seems that the script have make the battery sensor for all my devices so can read the Battery value from my sensor and the battery value from sensor created by the scriptā€¦

Low Battery Levels

Pulsante Faro Parcheggio (87) ( battery from my sensor)

Pulsante Faro Parcheggio Battery (87) (Created by the script)

Is it still working for you with hass 0.98.x ?
My battery levels stop updating after upgrade.

Iā€™m on 0.98.1 and as far as i can tell, it still works as with previous versions (although my devices somehow are reporting the same level for moths, but that is both through this code as well as directly when viewing the devices/entities/attributes)ā€¦

I use google_maps component and it reports my phone battery level.
And since 0.98 itā€™s stuck at 52% (few days ago since I use 0.98 since first beta).

Donā€™t know how to debug that.

Are you using the latest version of the code for google_maps? See for instance Google Maps Location tracker - #2 by eggman .

It looks like youā€™re right.
Sorry about that but I was sure I had checked the value in the device_tracker and it was correct.
Iā€™ve updated my cookie and now it looks fine.
Iā€™ll continue monitoring this.

I manually installed this as a package. Can somebody please point me to the code I need to add to my lovelace to get this view?

Thanks @NotoriousBDG for this great package. A few people have asked about the issue with the Xiaomi Temp sensors and how they create 3 sensors per device (temp, pressure and humidity) which results in 3 battery entities. The advice has been to use the ā€œbattery_sensor_creation_disabledā€ flag to remove the excess.

Trouble is for me I have a lot of these and some others that have 2 sensors so the inhibit list is way bigger that the list of actual batteries I want to monitor which kind of defeats the purpose of this script.

My question is - Is it possible to wildcard the list so it gets smaller. For example I would like to go from this (which is not my complete list!)

sensor.air_quality_sensor_pms_70_0_0:
battery_sensor_creation_disabled: true
sensor.air_quality_sensor_pms_70_0_1:
battery_sensor_creation_disabled: true
sensor.air_quality_sensor_pms_70_0_2:
battery_sensor_creation_disabled: true
sensor.pressure_158d0001f505f1:
battery_sensor_creation_disabled: true
sensor.pressure_158d0001fa38b3:
battery_sensor_creation_disabled: true
sensor.pressure_158d0001fa38df:
battery_sensor_creation_disabled: true
sensor.pressure_158d0001b95353:
battery_sensor_creation_disabled: true
sensor.humidity_158d0001b95353:
battery_sensor_creation_disabled: true

to

sensor.air_quality_sensor_:
battery_sensor_creation_disabled: true
sensor.pressure_:
battery_sensor_creation_disabled: true
sensor.humidity_:
battery_sensor_creation_disabled: true

I was hoping to get this working too, but at the moment, I donā€™t believe this is compatible with LoveLace. At least, I canā€™t get the configuration screen either :frowning:

@Simon_Funnell

This is the card for the control panel.

type: entities
entities:
  - input_boolean.low_batteries
  - input_number.battery_alert_threshold_min
  - input_number.battery_alert_threshold_max
  - input_text.delete_battery_sensor
  - input_text.notifier_name
  - input_select.notifier_format
  - automation.battery_persistent_notification
  - automation.battery_persistent_notification_clear
  - automation.battery_notification_default
  - automation.battery_notification_slack
  - automation.battery_sensor_from_attributes
  - automation.update_battery_status_group_members
  - automation.delete_battery_sensor
title: Batterien Alarm
show_header_toggle: false

I got it like this

  • disable lovelace yaml in configuration
  • restart Home Assistant
  • (re-)enable customizing lovelace UI in browser
  • open raw editor
  • copy content to yaml file
  • re-enable lovelace yaml in configuration

Aha, Bingo! Thanks for that :smiley: Seems to be working with my Tradfri remotes nicely!

anyone have the lovelace conffiguration for this template?