Template variable warning: ‘mappingproxy object’ has no attribute

Hello, I have been having the following issue. Do you know whats wrong?

Template variable warning: ‘mappingproxy object’ has no attribute ‘battery_icon’ when rendering ‘{{ states.vacuum.marla.attributes.battery_icon }}’

battery_icon: mdi:battery-charging-80

marla_battery: 
        friendly_name: Marla Battery Level
        value_template: "{{ state_attr('vacuum.marla', 'battery_level') }}"
        unit_of_measurement: '%'
        icon_template: '{{ states.vacuum.marla.attributes.battery_icon }}'

Does the vacuum entity actually have an attribute called “battery_icon”?

Hi,

It does:

battery_icon: mdi:battery-charging-100

I’m wondering then if there is some point that the attribute doesn’t exist - like at restart maybe?

Or maybe you have a spelling error in the template?

A little more info, around 3 AM this shows in my error log every day for my vacuums.

icon_template is gets the batter_icon from the entity attribute as it is dynamic, it will changed based upon the current level of battery for the entity.

Any ideas?