My problem is that I have a lot of Tado thermostats and they don’t provide a percentage value. They don’t have a battery+ attribute. I think the only attribute that can be used to show the battery condition is the battery_plus_low.
But I haven’t manage to get that value yet.
This is my code:
type: custom:auto-entities
card:
type: vertical-stack
card_param: cards
filter:
template: |
{% for state in states.sensor if "battery_plus" in state.entity_id
or ("tado" in state.entity_id and "battery" in state.entity_id and "T" not in state.state) -%}
{{
{
"type": "custom:bubble-card",
"card_type": "button",
"button_type": "slider",
"entity": state.entity_id,
"name": state.attributes.friendly_name.split(' Battery')[0],
"icon": "mdi:battery" if "tado" in state.entity_id else None,
"show_last_changed": false,
"show_state": false if "tado" in state.entity_id else true,
"read_only_slider": true,
"scrolling_effect": false,
"styles": ".bubble-range-fill { \n background-color: rgba(${state > 50.0 ? '39, 174, 96' : state > 20.0 ? '243, 156, 18' : '192, 57, 43'}, 0.4) !important;\n}",
"sub_button": [
{
"show_state": true,
"show_state": true if "tado" in state.entity_id else None,
"show_icon": false,
"state_background": false,
"show_background": false,
},
{
"show_state": false,
"show_icon": false,
"state_background": false,
"show_background": false,
"show_attribute": true,
"attribute": "battery_type_and_quantity",
},
],
"modules": [
"default"
]
}
}},
{%- endfor %}
sort:
method: state
numeric: true
reverse: false
show_empty: true
I’m happy with everything else but it won’t help if Tados don’t show the battery condition, which should be Normal or Low.
Hopefully, someone can help me to fix that.
I found this in the documentation:
Battery Low Template#
This is for advanced use where a device does not have a typical battery percentage or battery low boolean (or it is innacurate) but still provides an indication of the level, such as a string, boolean or voltage.
You can specify a template that must return true when the battery is deemed low.
Example templates
{{ states('sensor.mysensor_battery_low') }}
{{ states('sensor.mysensor_battery_level') == "Low" }}
{{ states('sensor.mysensor_battery_voltage') | float(5) < 1 }}
But not sure how to implement that.