Add Nordpool tariff api (#17628)
This commit is contained in:
parent
0f5ad83750
commit
93210dd021
3 changed files with 84 additions and 0 deletions
79
templates/definition/tariff/nordpool.yaml
Normal file
79
templates/definition/tariff/nordpool.yaml
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
template: nordpool
|
||||||
|
products:
|
||||||
|
- brand: Nordpool spot prices
|
||||||
|
requirements:
|
||||||
|
description:
|
||||||
|
de: "Nordpool Spot Preise im Day-Ahead-Markt für alle Märkte in der Nordpool-Region."
|
||||||
|
en: "Nordpool spot prices in day-ahead market for all markets in the Nordpool region."
|
||||||
|
evcc: ["skiptest"]
|
||||||
|
group: price
|
||||||
|
params:
|
||||||
|
- name: region
|
||||||
|
example: GER
|
||||||
|
validvalues:
|
||||||
|
[
|
||||||
|
"EE",
|
||||||
|
"LT",
|
||||||
|
"LV",
|
||||||
|
"AT",
|
||||||
|
"BE",
|
||||||
|
"FR",
|
||||||
|
"GER",
|
||||||
|
"NL",
|
||||||
|
"PL",
|
||||||
|
"DK1",
|
||||||
|
"DK2",
|
||||||
|
"FI",
|
||||||
|
"NO1",
|
||||||
|
"NO2",
|
||||||
|
"NO3",
|
||||||
|
"NO4",
|
||||||
|
"NO5",
|
||||||
|
"SE1",
|
||||||
|
"SE2",
|
||||||
|
"SE3",
|
||||||
|
"SE4",
|
||||||
|
"TEL",
|
||||||
|
"SYS",
|
||||||
|
]
|
||||||
|
- name: currency
|
||||||
|
default: EUR
|
||||||
|
validvalues: ["DKK", "EUR", "NOK", "PLN", "RON", "SEK"]
|
||||||
|
- preset: tariff-base
|
||||||
|
render: |
|
||||||
|
type: custom
|
||||||
|
forecast:
|
||||||
|
source: go
|
||||||
|
script: |
|
||||||
|
// concat today and tomorrow
|
||||||
|
"[" + strings.Trim(strings.Trim(today, "[]") + "," + strings.Trim(tomorrow, "[]"), ",") + "]"
|
||||||
|
in:
|
||||||
|
- name: today
|
||||||
|
type: string
|
||||||
|
config:
|
||||||
|
source: http
|
||||||
|
uri: https://dataportal-api.nordpoolgroup.com/api/DayAheadPrices?market=DayAhead&date={{ `{{ now.Local | date "2006-01-02" }}` }}&deliveryArea={{ .region }}¤cy={{ .currency }}
|
||||||
|
jq: |
|
||||||
|
.multiAreaEntries | [
|
||||||
|
.[] |
|
||||||
|
{
|
||||||
|
"start": .deliveryStart,
|
||||||
|
"end": .deliveryEnd,
|
||||||
|
"price": .entryPerArea.{{ .region }}
|
||||||
|
}
|
||||||
|
] | tostring
|
||||||
|
- name: tomorrow
|
||||||
|
type: string
|
||||||
|
config:
|
||||||
|
source: http
|
||||||
|
uri: https://dataportal-api.nordpoolgroup.com/api/DayAheadPrices?market=DayAhead&date={{ `{{ addDate (now.Local) 0 0 1 | date "2006-01-02" }}` }}&deliveryArea={{ .region }}¤cy={{ .currency }}
|
||||||
|
jq: |
|
||||||
|
.multiAreaEntries | [
|
||||||
|
.[] |
|
||||||
|
{
|
||||||
|
"start": .deliveryStart,
|
||||||
|
"end": .deliveryEnd,
|
||||||
|
"price": .entryPerArea.{{ .region }}
|
||||||
|
}
|
||||||
|
] | tostring
|
||||||
|
{{ include "tariff-base" . }}
|
||||||
|
|
@ -53,6 +53,7 @@ func ReplaceFormatted(s string, kv map[string]interface{}) (string, error) {
|
||||||
Funcs(sprig.TxtFuncMap()).
|
Funcs(sprig.TxtFuncMap()).
|
||||||
Funcs(map[string]any{
|
Funcs(map[string]any{
|
||||||
"timeRound": timeRound,
|
"timeRound": timeRound,
|
||||||
|
"addDate": addDate,
|
||||||
}).Parse(s)
|
}).Parse(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return s, err
|
return s, err
|
||||||
|
|
|
||||||
|
|
@ -12,3 +12,7 @@ func timeRound(d time.Duration, round string) time.Duration {
|
||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func addDate(ts time.Time, y, m, d int) time.Time {
|
||||||
|
return ts.AddDate(y, m, d)
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue