rianadon / timer-bar-card

A progress bar display for Home Assistant timers
Other
392 stars 15 forks source link

Media player? #162

Open ishioni opened 3 months ago

ishioni commented 3 months ago

I'd like to try and add a progress bar to my Kodi instance, but am unsure how to get the desired effect. I see media_player entities have media_position and media_duration attributes that would allow the calculation but not sure how to plug them in?

media_position: 2.488
media_duration: 241
rianadon commented 2 months ago

Hey, I'm not sure the timer bar card is the best fit for this problem. Since media_position updates on its own, something like bar card would be a better fit, even though it won't look the same as this card.

That said, since the player is progressing with time you could probably force the card to work with the media player. The way I'd do it is to use templates to subtract media_position from media_duration to calculate the "media time remaining". Then, you can use media_duration configured as the duration together with "media time remaining" as the remain_time to configure the card. Hope that helps!