Advertisement
Guest User

Untitled

a guest
Apr 1st, 2024
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. {% set sec = (state_attr(player, 'media_duration') - (state_attr(player, 'media_position') + as_timestamp(now()) - as_timestamp(state_attr(player, 'media_position_updated_at'))) | int) %}
  2. {% set hr = (sec / 3600) | int %}
  3. {% set min = sec / 60 - hr * 60%}
  4.  
  5. Time remaining: {% if hr > 0 and is_state(player, 'playing' ) %}
  6. {{"%d:%02d" % (hr, min + 1)}}
  7. {% elif sec | round(1, default=0) <0 %}
  8. -:--
  9. {%elif is_state(player, 'playing' )%}
  10. {{"%d:%02d" % (hr, min + 1)}}
  11. {%else%}
  12. -:--
  13. {% endif %}
  14.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement