Howto create battery alert without creating a template for every device

Thanks for the quick updates.

Any idea why HASS mite be throwing the following error?

ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.battery_sensor_from_attributes. Unknown error for call_service at pos 1:

EDIT: No Error after downgrading to 0.88.0

Downgrade from which version? Iā€™m running 0.88.2 without a problem.

From 0.88.2

Plus tons of Automation Errors.

Apologies for late feedback. This issue is not related to your pack. This issue is a core HA issue.

I see the same error here on 0.89.1
Itā€™s repeated once a minute.
Itā€™s currently the entry that is put in the home-assistant.log in the config folder.

How can I tell if itā€™s working at all? I can see the battery icon at the top, and a card on the overview, but thatā€™s it.

Hmm, Iā€™ve followed the instructions in the latest release.
Iā€™ve activated the internal MQTT.
But I just see the error in the logfile, where do I find out if itā€™s working.

2019-03-12 18:00:00 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: UndefinedError: 'None' has no attribute 'attributes'
2019-03-12 18:00:00 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.update_battery_status_group_members. Invalid data for call_service at pos 1: Entity ID  is an invalid entity id for dictionary value @ data['entities']
2019-03-12 18:01:00 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.update_battery_status_group_members. Invalid data for call_service at pos 1: Entity ID  is an invalid entity id for dictionary value @ data['entities']

Although it works, the browser performance becomes very poor when Battery Alert group is shown. Browser memory usage keeps increasing. I tried both Chrome and Firefox.

Hi everyone, Iā€™m using latest 89.2, trying to setup this package.

Iā€™m getting this error when I try to CHECK SETTINGS in Configuration->General

Configuration invalid
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/

As it is now, it seems to fail for me. I verified that my config works without it.
I also made sure to follow all steps 1 through 5 in the battery_alert.yaml setup

Has anyone else experienced issues?

I am seeing something odd on my battery alert, thereā€™s an item which is listed 3 times on the list but I canā€™t see the item listed on MQTT at all.
Where that is coming from?

@NotoriousBDG - Thanks for investing your time developing this. I installed it yesterday on my RPi hassio 0.89.2 instance as I have a number of battery based sensors I want to keep an eye on. However I am seeing some strange resultsā€¦

The yale lock sensor is the only one reporting correcty however, the heating battery (a thermostat) should read 80% as can be seen here;

The Entrance, Kitchen, Patio are all contact sensors and should report in the same format battery level (100%);

And the Landing motion sensor (also 100%);

Iā€™m fairly new to HA and hoping there is something obvious / dumb that Iā€™ve missed. Please advise.

I seem to have a problem with IKEA controllers.
They are shown as sensors, and do present a battery_level in the states, so Iā€™m not sur why itā€™s not being picked up?

IKEA would really be nice to have - and since it does list battery_level probably just needs some tweakingā€¦ Couldnā€™t manage it myself tooā€¦

1 Like

I actually see the switch twice, both as a sensor and as a switch


Only the IKEA switches are shown like this, twice, one as a sensor, and once as a switch.
The dampers are shown only as sensors.

Using the raw link on github to copy/paste from may help.

Can you post a screenshot of the entities from the states page? The attributes should help identify if they are created from the package and where the came from.

Itā€™s likely because the battery_level attribute has a ā€œ%ā€, when it should just be a number without a unit. What component is creating those entities?

Thatā€™s because the Ikea component is creating battery sensors without setting device_class and creating a redundant battery_level attribute. The ideal fix is to get the Ikea component updated to set the device_class correctly.

Like I said above, the ideal fix would be to the Ikea component itself.

Hi NotoriousBDG, sure things, here it is:

Hi @NotoriousBDG, In my case, they are generated from the Hive component and are either battery levels for Window/Door sensors or the heating thermostat.

Those arenā€™t coming from this package. Since the magic cube is a zigbee device, itā€™s likely created by whichever component that manages that device.

I think the issue is due to these lines pyhiveapi/pyhiveapi/pyhiveapi.py at 3e849fcde43683b495c0cdcdd20189b16cbf27d5 Ā· Rendili/pyhiveapi Ā· GitHub and pyhiveapi/pyhiveapi/pyhiveapi.py at 3e849fcde43683b495c0cdcdd20189b16cbf27d5 Ā· Rendili/pyhiveapi Ā· GitHub. The % needs to be removed.

1 Like

And you are absolutely right, sir, that was it, thanks!

Thanks @NotoriousBDG. You will have to forgive my ignorance as it is not clear to me where or how do I make this change. Iā€™m running hassio and I tried copying and updating the pyhiveapi.py script in my the custom_components folder, but this does not seem to have worked.

Thankyou very much for the great feedback @NotoriousBDG! It makes perfect sense to correct this the right way. I just went through my configs, I donā€™t import the IKEA anywhere, so maybe they were auto discovered??? Where do I make an enhancement request to fix this?

A whole other matter, I see in the 0.92 update notes:

MQTT - Pass Message object to MQTT message callbacks instead of topic , message and qos . Users of custom components please take note, these values are now available on the passed in message object: msg.topic , msg.message , msg.qos . The old method will continue to work for now but will print warnings.

Will this affect the battery warning in future versions?