Howto create battery alert without creating a template for every device

I have a Aqara hub and battery powered sensors and would like to get a notification when power drops beneath 10%, is this possible?

Might be in the topic but its pretty long, how do you set your settings and update the file (automaticly if possible) ?

I know you can update some components/love lace cards with a addon/script wonder if it is also for this. As in use some templates for the default settings and just set those things somewhere else.

Other then that, been using it for a long time now, always happy to see an alert :slight_smile:

1 Like

Try using the raw link to copy/paste.

Click on the battery sensor you want to delete, copy the value of “delete_battery_sensor” attribute, and paste it into the “Delete a Battery Sensor” input text box.

Twilio isn’t supported natively because it has a unique inputs. Give this automation a try:

- alias: battery_notification_twilio
  initial_state: 'on'
  trigger:
    - platform: time
      at: '10:00:00'
    - platform: time
      at: '18:00:00'
    - platform: state
      entity_id:
        - input_number.battery_alert_threshold_min
        - input_number.battery_alert_threshold_max
  action:
    - condition: template
      value_template: *low_battery_check
    - service: notify.twilio_sms
      data_template:
        message: *message
        target:
          - '+1234567890'

That’s doable too. You’ll need to add another trigger for arriving at Walmart to the automation above.

Yes

I don’t know of an automated way to update packages. If you know of one, please let me know and I’ll check it out.

Super work from The Notorious!

My deleted batteries are being rediscovered.

I am running Xiaomi Aqara hub and sensors. The temp sensors also have humidity in them whilst it’s only one unit and one battery they are being discovered twice (humidity battery/temp battery) as seen in screeny.

This is my flow

  1. Click on one of the Sensors from the Battery status list that I want to delete.
  2. Copy the line to the right of ‘delete battery sensor’ which for one of the sensors is homeassistant/sensor/humidity_158d00020f24ec_battery
  3. Paste the copied text into the Delete a Batte… field and wait a couple of seconds and then the battery deletes and replace with yellow ‘entity not available’ line which disappears after a couple of seconds.
  4. After a few minutes (not sure maybe 15mins) they crawl back out and into the list again.
  5. I did add them to the customize list as below but then I realised this is only for ‘alert suppression’ and not removing them from list suppression.
customize:
  sensor.humidity_158d00020f24ec:
    battery_alert_disabled: true

Any advice would be much appreciated

ps paying it forward any starting out on Notorious’s battery project struggling to add to lovelace.
*1. You need to install the group card from github look at readme.md here if you don’t know how to install a custom card like the group-card.
2. You need to add 2 manual cards in lovelace - 1 for Battery status (list of batterys) and 2 for Battery alert (the settings for the alerts).
3. You first custom card for Battery status has this code.

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

4. The second custom card for battery alert looks like this

type: 'custom:group-card'
card:
  type: entities*
  title: Battery Alert*
  show_header_toggle: false*
group: group.battery_alert*
4 Likes

Change your customize line to this instead, restart Home Assistant, then delete the sensor one more time. After that, it shouldn’t come back.

customize:
  sensor.humidity_158d00020f24ec:
    battery_sensor_creation_disabled: true
1 Like

Great I added that under the section you mentioned in the battery_alert.yaml file and deleted again and it’s been 12 hours now and they haven’t returned. Your a champ :partying_face:

1 Like

So I just upgraded from 0.84 and OMG what a mess :smiley:

Can someone give me the short version of what I have to do to make everything look neat?

Thank you

Can you provide more details? What’s “a mess”? Maybe a screenshot would help…

Apologies.

I mean lots of entities “not available”
and all the sensors are showing in little sensor circles up top, it never used to be like that

That sounds like it might be related to the migration to Lovelace. It doesn’t like when your groups refer to entities that don’t exist. You’ll need to remove them from your groups to fix those.

The automation that adds battery entities to the group runs once a minute now instead of at startup. It’s possible that if you view the UI before the first time the automation runs, your battery entities will not be in the group yet. Refreshing the page in your browser should fix that.

Thank you, All is working now with your latest code

Hi,
it seems great but I don’t know how to install this …

Is the first post is up to date with the latest code ?

Is there an howto that I missed ?

I can’t update the OP anymore. You can find the latest on GitHub at:

Not sure when it changed, but I’m able to edit the OP. I’ve added a link to GitHub in the OP to make it easier for people to find the latest version.

1 Like

Sorry! ive been playing with this and read a load of topics, but im still stuck!

im seeing this log error

Wed May 15 2019 10:40:33 GMT+0100 (British Summer Time)

Error while executing automation automation.battery_sensor_from_attributes. Service not found for call_service at pos 1: (ServiceNotFound(…), ‘Service mqtt.publish not found’)

  1. what card should i be using to show all batteries that are “low” (ive set min to 97 and max to 100 just to give me some results). Note: notifications seem to be working, but i cant work out the card to use?

Running HassIO: 0.92.2 - system health below.
Running Mosquitto broker, where I have enabled the add-on with the following settings.

{
“logins”: ,
“anonymous”: false,
“quiet_logs”: true,
“customize”: {
“active”: true,
“folder”: “mosquitto”
},
“certfile”: “fullchain.pem”,
“keyfile”: “privkey.pem”
}

  • have disabled everything within the network card.
  • i have setup the ACCESS CONTROL LISTS (ACLS)
  • i have added the following to confg.yaml, even though it mentioned this wasnt needed in the mosquitto notes
 mqtt:
   discovery: true
   discovery_prefix: homeassistant
  • i have added the following to automations.yaml, which also works ok.
  • alias: Home Assistant Startup
    id: Home_Assistant_Startup
    trigger:
    • platform: homeassistant
      event: start
      action:
    • service: notify.notify
      data:
      message: Home Assistant is up

RPi info

System Health

arch armv7l
dev false
docker true
hassio true
os_name Linux
python_version 3.7.3
timezone Europe/London
version 0.92.2
virtualenv false

Lovelace

mode storage
resources 0
views 9

hey, how did you add this “low battery levels” card?

That suggests that MQTT isn’t working. Check your logs to see if you can figure out why MQTT isn’t working

That is the persistent notification that’s automatically created by the package.

Thanks for the reply

so MQTT seems to be working ok now.

Sorry, for the 2nd item - i want to show a card, that has all the “low” battery levels shown only - how do i do that?

[NotoriousBDG] do you have plans to add your wonderful work into custom updater? So everyone can automatically have the latest version.

I have the same problem, and I did use the raw link to copy/paste the content of the battery_alert.yaml file. Also tried to download the file from Github and use that one.

Invalid config for [automation]: required key not provided @ data['action']. Got None
required key not provided @ data['trigger']. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/automation/

First lines of the configuration.yaml:

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: !secret home_latitude
  longitude: !secret home_longitude
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: !secret home_elevation
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: !secret timezone
  customize: !include customize.yaml
  packages: !include_dir_named packages
  auth_providers:
    - type: homeassistant

Thanks! :smile: