Question value_template

Hi,

Im trying to format the tibber pricing so that I can use it for switing devices according to the pricelevel.
To do so, I need to change the output a little but I can’t get that working properly.

Bsic value_template:
value_template: ‘{{ state_attr(‘sensor.tibber_electricity_price_nordpool’, ‘today’) }}’

The raw output then is:
value_template: ‘[{‘total’: 0.4946}, {‘total’: 0.4057}, {‘total’: 0.3588}, {‘total’: 0.3353}, {‘total’: 0.3317}, {‘total’: 0.3407}, {‘total’: 0.2959}, {‘total’: 0.2934}, {‘total’: 0.3165}, {‘total’: 0.348}, {‘total’: 0.3435}, {‘total’: 0.3111}, {‘total’: 0.295}, {‘total’: 0.3202}, {‘total’: 0.3257}, {‘total’: 0.337}, {‘total’: 0.348}, {‘total’: 0.4185}, {‘total’: 0.4167}, {‘total’: 0.3261}, {‘total’: 0.2913}, {‘total’: 0.2533}, {‘total’: 0.2366}, {‘total’: 0.2063}]’

Using this value template:
value_template: ‘{{ state_attr(‘sensor.tibber_electricity_price_nordpool’, ‘today’) | replace(’{’, “”)| replace(’}’, “”)| replace(‘total’, “”)|replace(’:’, “”) }}’

ends up in still having ‘’ with every value.
value_template: ‘[’’ 0.4946, ‘’ 0.4057, ‘’ 0.3588, ‘’ 0.3353, ‘’ 0.3317, ‘’ 0.3407, ‘’ 0.2959, ‘’ 0.2934, ‘’ 0.3165, ‘’ 0.348, ‘’ 0.3435, ‘’ 0.3111, ‘’ 0.295, ‘’ 0.3202, ‘’ 0.3257, ‘’ 0.337, ‘’ 0.348, ‘’ 0.4185, ‘’ 0.4167, ‘’ 0.3261, ‘’ 0.2913, ‘’ 0.2533, ‘’ 0.2366, ‘’ 0.2063]’

I may use split function to only get the value behind the :
But I did not find the right syntax so far.

Any suggestions?

The text above uses non acceptable comme-alike quotes to I assume these will be ’ instead
Then try this in devtools > templates

{% set value= [{'total': 0.4946}, {'total': 0.4057}, {'total': 0.3588}, {'total': 0.3353}, {'total': 0.3317}, {'total': 0.3407}, {'total': 0.2959}, {'total': 0.2934}, {'total': 0.3165}, {'total': 0.348}, {'total': 0.3435}, {'total': 0.3111}, {'total': 0.295}, {'total': 0.3202}, {'total': 0.3257}, {'total': 0.337}, {'total': 0.348}, {'total': 0.4185}, {'total': 0.4167}, {'total': 0.3261}, {'total': 0.2913}, {'total': 0.2533}, {'total': 0.2366}, {'total': 0.2063}] %}
{% for x in value %}{{x.total}},{%endfor%}

Thanks for replying so quickly.
Your code works perfectly fine,

however, the raw output is generated by a rest sensor pulling it from an tibber api.
Therefore the values are changing. It may be possible to correct this in the same script pulling the data.

Can put the code here but better to do that in a readable format like you did.
Is there an easy way to do that? (just cut/paste removes the layout)