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

51 lines
1.7 KiB
YAML

template: esios
covers: [esios-tariff-api]
products:
- brand: REE
requirements:
evcc: ["skiptest"]
description:
generic: "Spain PVPC tariff extracted from [api.esios.ree.es](https://api.esios.ree.es). It is possible to create grid and feed-in tariffs. You need a token in order to be able to use the API"
group: price
countries: ["ES"]
params:
- name: securitytoken
description:
generic: "Esios personal Security token"
help:
en: Request your token at <a href="mailto:consultasios@ree.es?subject=Personal token request">consultasios@ree.es</a>
required: true
- name: indicator
description:
generic: "Indicator to retrieve from the API."
help:
en: 1001 = Grid Tariff, 1739 = Feed-in Tariff
example: 1001
type: choice
choice: [1001, 1739]
required: true
- name: region
example: Península
type: choice
choice: ["Península", "Canarias", "Baleares", "Ceuta", "Melilla"]
required: true
- preset: tariff-base
render: |
type: custom
{{ include "base" . }}
forecast:
source: http
uri: https://api.esios.ree.es/indicators/{{ .indicator }}?start_date={{ now | date "2006-01-02" }}T00:00&end_date={{ (now.AddDate 0 0 1) | date "2006-01-02" }}T23:59
method: GET
headers:
x-api-key: "{{ .securitytoken }}"
Accept: "application/json"
jq: |
[.indicator.values[]
| select(.geo_name == {{ if eq .indicator "1739" }} "España" {{ else }}"{{.region}}"{{ end }})
| {
start: .datetime_utc,
end: (.datetime_utc | strptime ("%FT%TZ") | mktime + 3600 | strftime("%FT%TZ")),
value: (.value | tonumber) / 1000
}
] | tostring