Converting states of history_stats sensors

I am using this sensor to check the amount of time my SkyQ decoder worked last 24 hours:

- platform: history_stats
  name: SkyQ ON Ieri
  entity_id: media_player.sky_q
  state: "playing"
  type: time
  end: "{{ now().replace(hour=0, minute=0, second=0) }}"
  duration:
    hours: 24

And before upgrading to the latest release of HA (2022.5.2) the sensor had also an attribute showing the real hours and minutes while the state were showing an absolute number like 9.89.
Now, with the latest release the attribute disappeared and the state actually shows 9.89 hours.
How to convert this state to real hours and minutes? Or how to have back the attribute?
P.S. Hope you understand what i mean due to my poor english…

See here:

1 Like

Thanks, but how to add that template in my sensor statement?

You can’t, you make a separate template sensor, or use that template wherever you were using the attribute before.

Hmmm… in my case i was using this card:

              - type: attribute
                entity: sensor.skyq_on_ieri
                name: Sky Q Acceso Ieri
                icon: phu:sky-q-logo
                attribute: value

… and now?

you make a template sensor

exactly like you did in this post from 2 years ago

1 Like

Wow… I feel like being spied on by the CIA or the FSB! :slight_smile:
BTW Thanks always for your precious support…

Just trying to get you to combine skills you already have :wink: I remember helping you in the past.

2 Likes