Battery_alert.yaml

Hi Guys,

Hope you can help, I am getting a tremendous amount of these alerts in the logs about icon issues, I have read that it was going to be detected and complain if it was not there, I like the feature. I only have one yaml that complains and that’s the battery_alert.yaml from External link to battery_alert.yaml

Template variable warning: 'mappingproxy object' has no attribute 'icon' when rendering '{%- for item in states.sensor if ( not is_state_attr(item.entity_id, 'hidden', true) and ( is_state_attr(item.entity_id, 'device_class', 'battery') or 'battery' in item.attributes.icon | lower or (item.entity_id | lower).endswith('_bat') or (item.name | lower).endswith('_bat') ) or ( ( 'battery' in item.entity_id | lower or 'battery' in item.name | lower ) and ( item.attributes.icon is not defined ) and ( not is_state_attr(item.entity_id, 'battery_alert_disabled', true) ) and ( not is_state_attr(item.entity_id, 'restored', true) ) ) ) -%} {{ item.entity_id }}{% if not loop.last %}, {% endif %} {%- endfor -%}'

Could someone tell me what and where I need to fix something to get rid of the constant logging of this. :slight_smile:

Thanks in advance.
Johnni

see Howto create battery alert without creating a template for every device - #950 by walaj

Thanks Jon,

That fixed my 18K+ counter of the same alert since yesterday :slight_smile:

now it just complains about some other section with missing attribute in the battery_alert.yaml file. Do you know if someone re-wamped the whole file to fix these bugs in some other thread.? Seems like the author notoriousbdg didn’t update the file for quite a long time.

NotoriousBDG:

Joined: Jan 27, '17
Last Post: Jun 17, '19
Last Seen: Sep 21, '19

re the missing attribute - what error do you get? there was a push on the github that might be what you need…