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?