notoriousbdg / Home-AssistantConfig

Apache License 2.0
180 stars 49 forks source link

Template Warnings under 2021.10.x #36

Open dmzimmerman opened 2 years ago

dmzimmerman commented 2 years ago

The following warning appears (many times) under 2021.10, and says that the template will no longer work under 2021.12:

Template warning: 'float' got invalid input 'Not Charging' when rendering template '{% macro battery_level() %} {% for entity_id in states.group.battery_status.attributes.entity_id if ( not is_state_attr(entity_id, 'battery_alert_disabled', true) and states(entity_id) is not none and ( ( ( states(entity_id) is number or states(entity_id) | length == states(entity_id)| int | string | length or states(entity_id) | length == states(entity_id)| float | string | length ) and states(entity_id) | int < states.input_number.battery_alert_threshold_max.state | int and states(entity_id) | int > states.input_number.battery_alert_threshold_min.state | int ) or states(entity_id) | lower == 'low' or states(entity_id) | lower == 'unknown' or states(entity_id) | lower == 'unavailable' ) ) -%} {{ state_attr(entity_id, "friendly_name") }} ({{ states(entity_id) }}) {% endfor -%} {% endmacro %} {{ battery_level() | trim == "" }}' but no default was specified. Currently 'float' will return '0', however this template will fail to render in Home Assistant core 2021.12

zawias commented 2 years ago

I have the same problem in version 2021.11.4. Anyone know how to solve it?