I am picking up track position, track length and track remaining from two different places in a REST sensor, and I display it like this:
This is in Norwegian, so it means “2:25 of 2:46, 0:21 remaining”. It’s exactly what I want, but one thing: When I stop the track it shows “Live” for both, and I have removed that. But then I get this:
What I would like, is for the " av , igjen" to be removed. But I can’t seem to find out how to do a replace of that in the full sensor code.
This is how the code looks:
- name: "JRMC-posisjon"
unique_id: jrmc_posisjon
value_template: >
{{ ((value_json['Response']['Item']|selectattr('@Name','==','PositionDisplay')|first)['#text'].split('/')[0]) }} av {{ ((value_json['Response']['Item']|selectattr('@Name','==','PositionDisplay')|first)['#text'].split('/')[1])|replace(' Live', '') }}, {{ (value_json['Response']['Item']|selectattr('@Name','==','RemainingTimeDisplay')|first)['#text']|replace('Live', '')|replace('-', '') }} igjen
I would assume that there has to be some combination of brackets or paranthesis to replace the text in the final outcome, but I can’t find out what. Can somebody please help me out?