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
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] }}
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.