Display a value on an icon

Hello,

I would like to display the number of heating vtherm on an icon badge. But I not not able to find the right syntax.
It’s sensor.nb_device_active_for_boiler.

Can i have sone help?

Thanks a lot

type: custom:mushroom-template-card
features_position: bottom
grid_options:
  columns: 3
  rows: 1
vertical: true
multiline_secondary: false
color: >-
  {% if
  state_attr('binary_sensor.chaudiere_chaudiere_centrale','central_boiler_state')
  == 'on' %} orange {% endif %}
icon: >-
  {% if
  state_attr('binary_sensor.chaudiere_chaudiere_centrale','central_boiler_state')
  == 'on' %} mdi:water-boiler {% elif
  state_attr('binary_sensor.chaudiere_chaudiere_centrale','central_boiler_state')
  == 'off' %} mdi:water-boiler-off {% endif %}
badge_text: {{ 'sensor.nb_device_active_for_boiler' }}

Try this code at last row

badge_text: '{{ 'sensor.nb_device_active_for_boiler' }}'

I think you’re missing “states”

badge_text: "{{ states('sensor.nb_device_active_for_boiler') }}"

1 Like

Thank you! I missed “states”.