Value of template sensor shows correct value in developer tools (state) but wrong in dashboard

Hi,

I have a sensor for the total runtime of my heatpump. This counts the total uptime in minutes and I want to convert the minutes into days.

This, however, seems to work in the developer tools >>> states tab but when I implement the sensor into my dashboard, it again shows only the minutes, whereby the graph is rather shows the correct value but not the numbers shown:

Does someone have an idea how to solve this issue?

Thanks in advance

I’m sorry, friend, but there is no code. How are we supposed to help?

You’re running into the fact that duration sensors have a predefined format. There is an issue related to this, and a PR to address it in next month’s update, but I’m not sure if it will fix your exact issue.

You may need to override the device class to get the output you want.

Thanks already for the replies!

For the sake of completeness, this is the code I used for the template sensor:

template:
  - sensor:
      - name: "Z_Laufzeit WP TOTAL in Tagen"
        unique_id: "Z_TotalRuntimeHP"
        state_class: "total_increasing"
        device_class: "duration"
        unit_of_measurement: "d"
        state: >
          {% if states('sensor.boiler_uptimetotal') | float != 0 %}
            {{ (float(states('sensor.boiler_uptimetotal')) / 60 / 24) | round(1) }}
          {% else %}
            0
          {% endif %}

Bad to hear that it seems to be a general issue. Do you have some hints how to override the device type?

Remove the line device_class: "duration"

thanks for the advice!
(I am quite new in HA as you might have noticed)

It worked fine and the figures are now shown correctly