Sensor Card showing wrong timestamp

I made a history stat template for displaying time spent at work.

Entity card showing correct timestamp as below.

But when I try to display same data a sensor card, it displays minutes over “60”

4,83 minutes ? What can it be done to show correct timestamp ?

Minutes are showed in decimal of an hour… so 83% of one hour is 49 minutes and 48 seconds…
Can you share the content of your entity you want to display ?

image

It’s a new duration sensor. It’s a sensor with the main state as hours, minutes, or seconds and a corresponding unit_of_measurement. Some places in the UI will show it as hh:mm:ss, this is a ‘translated’ state. I.e. it’s translated into a friendly manner so people can understand it instead of it being 83947298437329 seconds. A history graph needs a single base number, so it’s going to use the main state, not the translated state.

Thanks for the explanation. Is there a way to change that ?

My content entity is History Stats of the time I have spent in certain places.

  - platform: history_stats
    name: Berkan işte
    entity_id: person.berkan_sezer
    state: "work"
    type: time
    start: "{{ now().replace(hour=0, minute=0, second=0) }}"
    end: "{{ now() }}"

No, the history needs a number in order to graph it. HH:MM:SS is not a number

So the only possible scenario left for checking the history stats on graphs are entities I guess. Or maybe I might have a look at Grafana.

I’m not sure what you mean. All I’m telling you is that the graph will always show the state, which will be in the unit of measurement that it is. In your case, it will be hours. If you put that sensor into an entities card, it will display as a time, HH:MM:SS.

1 Like

Ok petro thank you very much. I clearly get it now.

May I ask you another question about history stats. I want to track netflix usage.

  - platform: history_stats
    name: Netflix Today
    entity_id: media_player.fire_tv_192_168_x_xx
    state: "Netflix"
    type: time
    start: "{{ now().replace(hour=0, minute=0, second=0) }}"
    end: "{{ now() }}"

This my code. But I think I have to enter attribute or app_id to the code which don’t allow me. With the current setup it doesn’t track usage and always stays at 0. My media player doesn’t show which app is currently playing on state instead it is only on ıdle or playing status. I have to enter app_id or attribute Is there another way to achieve this ?