I have a sensor, and want to create a template to show the charging state in my dashboard
jono_hunt_battery_charging_true:
value_template: "{{ states.device_tracker.jono_hunt.attributes.battery_charging }}
"
I had to create another template in order to show ‘Charging’ or ‘Not Charging’ in my dashboard, instead of ‘True’ or ‘False’.
jono_hunt_battery_charging:
value_template: "{% if is_state('sensor.jono_hunt_battery_charging_true', 'True') %}Charging{% else %}Not Charging{% endif %}"
I’m guessing it can be done from the original sensor without having to create another one, but my templating skills aren’t great. How could I create one sensor that returns ‘Charging’ or ‘Not Charging’ from this?
states.device_tracker.jono_hunt.attributes.battery_charging