Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {% 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) %}
- {% set hr = (sec / 3600) | int %}
- {% set min = sec / 60 - hr * 60%}
- Time remaining: {% if hr > 0 and is_state(player, 'playing' ) %}
- {{"%d:%02d" % (hr, min + 1)}}
- {% elif sec | round(1, default=0) <0 %}
- -:--
- {%elif is_state(player, 'playing' )%}
- {{"%d:%02d" % (hr, min + 1)}}
- {%else%}
- -:--
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement