evcc-io/templates/definition/tariff/pstryk.yaml

53 lines
1.4 KiB
YAML

template: pstryk
products:
- brand: Pstryk.pl
requirements:
description:
en: "Get your API token from the Pstryk App."
de: "Hol dir deinen API-Token aus der Pstryk App."
evcc: ["skiptest"]
group: price
countries: ["PL"]
params:
- name: token
type: string
required: true
description:
en: "API token (e.g. sk-...)."
de: "API-Token (z.B. sk-...)."
- name: plan
type: choice
default: pricing
choice: ["pricing", "prosumer-pricing"]
required: true
description:
en: "Tariff source"
de: "Tarifquelle"
- preset: tariff-base
- name: interval
default: 1h
advanced: true
render: |
type: custom
{{ include "base" . }}
forecast:
source: http
uri: https://api.pstryk.pl/integrations/meter-data/unified-metrics/?metrics=pricing&resolution=hour&window_start={{ `{{ now.UTC | mustDateModify "-24h" | date "2006-01-02" }}` }}:00:00Z&window_end={{ `{{ now.UTC | mustDateModify "+72h" | date "2006-01-02" }}` }}:00:00Z
headers:
Authorization: {{ .token }}
Accept: application/json
jq: |
[(.frames // [])[]
| select(.metrics?.pricing? != null)
| {
start: (.start | sub("\\+00:00$"; "Z")),
end: (.end | sub("\\+00:00$"; "Z")),
value: .metrics.pricing.{{ if eq .plan "prosumer-pricing" }}price_prosumer_gross{{ else }}price_gross{{ end }}
}
] | tostring
interval: {{ .interval }}