Is it possible to show sensor badge as icon instead of sensor value?
My custom command line sensor catch state in String form. I have created a template sensor to change icons depending on the state.
But when I put sensor in the frontend badges, only a string state is visible.
Is there any way to change the badge to show an icon instead of value using customUI?
Current code:
- platform: template
sensors:
prediction:
value_template: >
{{ states('sensor.preassureprediction') }}
friendly_name: 'Prediction'
icon_template: "{% if is_state('sensor.preassureprediction' , 'Stable') %}
mdi:wave
{% elif is_state('sensor.preassureprediction' , 'Unstable') %}
mdi:weather-partly-lightning
{% elif is_state('sensor.preassureprediction' , 'Sun') %}
mdi:weather-sunny
{% elif is_state('sensor.preassureprediction' , 'Storm') %}
mdi:weather-lightning-rainy
{% elif is_state('sensor.preassureprediction' , 'Rain') %}
mdi:weather-rainy
{% else %}
mdi:wave
{% endif %}"