How to Extract number from template

hi,
i am trying to extract a number from template.
{{ state_attr(‘timer.egg’, ‘remaining’) }} and it give me : 00:25:00
i need to extract only the number 25
please advise

Thanx

I think this is the one:
{{ states.timer.egg.attributes.remaining.split(":")[1] }}

Great !! That did the trick
thank you @argykaraz

1 Like

If you ever need the hour, minutes, and seconds, this will also work:

{% set h, m, s = state_attr('timer.egg', 'remaining').split(':') %}
{{ m }}

Then you just need to use h | int, m | int, or s | int to perform math.

1 Like

Good to know !!
thank you @petro