Problem with template data to format

Hi all,
i need your help.
I have this sensor output:

    {"Data": { "CardNo": "c612612b"}}	

that i read with
value_template: {{value_json.Data.CardNo}}
and return: c612612b

how can i format ( inside the value_template ) the original text
c612612b
to
C6-12-61-2B
??

You could set the string to a variable and template it this way:

I can’t copy it from the phone. It just doesn’t work… but you get the idea from the image.

i have find this way

{{'{}{}-{}{}-{}{}-{}{}'.format(*value_json.Data.CardNo)|upper}}
1 Like