I’m trying to copy all values of my electricity pricing sensor (Nordpool) and subtract 1.12 on each value.
Reason for this is that EV-charging is tax exempt so I would like to have a graph for that pricing as well, and be able to use it in the Energy-module as well.
Same trick would be great for electricity export pricing.
Anyway this is the attributes of my Nordpool-sensor:
current_price: 3.678
average: 3.522666666666667
off_peak_1: 3.757375
off_peak_2: 2.654
peak: 3.4375
min: 1.879
max: 4.62
unit: kWh
currency: DKK
country: Denmark
region: DK2
low price: false
tomorrow_valid: false
today:
- 3.678
- 3.66
- 3.623
- 3.554
- 3.54
- 3.644
- 4.084
- 4.276
- 4.242
- 4.074
- 3.894
- 3.741
- 3.186
- 3.162
- 3.149
- 3.146
- 3.148
- 3.726
- 4.62
- 3.781
- 3.162
- 2.828
- 2.747
- 1.879
tomorrow: []
raw_today:
- start: '2022-03-16T00:00:00+01:00'
end: '2022-03-16T01:00:00+01:00'
value: 3.678
- start: '2022-03-16T01:00:00+01:00'
end: '2022-03-16T02:00:00+01:00'
value: 3.66
- start: '2022-03-16T02:00:00+01:00'
end: '2022-03-16T03:00:00+01:00'
value: 3.623
- start: '2022-03-16T03:00:00+01:00'
end: '2022-03-16T04:00:00+01:00'
value: 3.554
- start: '2022-03-16T04:00:00+01:00'
end: '2022-03-16T05:00:00+01:00'
value: 3.54
- start: '2022-03-16T05:00:00+01:00'
end: '2022-03-16T06:00:00+01:00'
value: 3.644
- start: '2022-03-16T06:00:00+01:00'
end: '2022-03-16T07:00:00+01:00'
value: 4.084
- start: '2022-03-16T07:00:00+01:00'
end: '2022-03-16T08:00:00+01:00'
value: 4.276
- start: '2022-03-16T08:00:00+01:00'
end: '2022-03-16T09:00:00+01:00'
value: 4.242
- start: '2022-03-16T09:00:00+01:00'
end: '2022-03-16T10:00:00+01:00'
value: 4.074
- start: '2022-03-16T10:00:00+01:00'
end: '2022-03-16T11:00:00+01:00'
value: 3.894
- start: '2022-03-16T11:00:00+01:00'
end: '2022-03-16T12:00:00+01:00'
value: 3.741
- start: '2022-03-16T12:00:00+01:00'
end: '2022-03-16T13:00:00+01:00'
value: 3.186
- start: '2022-03-16T13:00:00+01:00'
end: '2022-03-16T14:00:00+01:00'
value: 3.162
- start: '2022-03-16T14:00:00+01:00'
end: '2022-03-16T15:00:00+01:00'
value: 3.149
- start: '2022-03-16T15:00:00+01:00'
end: '2022-03-16T16:00:00+01:00'
value: 3.146
- start: '2022-03-16T16:00:00+01:00'
end: '2022-03-16T17:00:00+01:00'
value: 3.148
- start: '2022-03-16T17:00:00+01:00'
end: '2022-03-16T18:00:00+01:00'
value: 3.726
- start: '2022-03-16T18:00:00+01:00'
end: '2022-03-16T19:00:00+01:00'
value: 4.62
- start: '2022-03-16T19:00:00+01:00'
end: '2022-03-16T20:00:00+01:00'
value: 3.781
- start: '2022-03-16T20:00:00+01:00'
end: '2022-03-16T21:00:00+01:00'
value: 3.162
- start: '2022-03-16T21:00:00+01:00'
end: '2022-03-16T22:00:00+01:00'
value: 2.828
- start: '2022-03-16T22:00:00+01:00'
end: '2022-03-16T23:00:00+01:00'
value: 2.747
- start: '2022-03-16T23:00:00+01:00'
end: '2022-03-17T00:00:00+01:00'
value: 1.879
raw_tomorrow: []
unit_of_measurement: DKK/kWh
icon: mdi:flash
friendly_name: Elpris
I can get the state edited quite easily with a template-sensor:
- name: "Nordpool -refusion"
unique_id: nordpool_refusion
unit_of_measurement: DKK/kWh
icon: mdi:flash
friendly_name: Elpris uden afgift
state: >-
{{
states('sensor.nordpool_kwh_dk2_dkk_3_10_025')|float - 1.12
}}
And I can get the “today” array added by adding:
attributes:
today: >-
{{
state_attr('sensor.nordpool_kwh_dk2_dkk_3_10_025', 'today')
}}
But I can’t figure out how to deduct 1.12 from the individual values of the array.
It get even worse with the “today_raw” that completely messes up date-formatting when I try the same method as today.
What am I doing wrong and can someone point me in a direction?