Esios: extend forecast range (#28326)

This commit is contained in:
cperal99 2026-03-19 21:36:15 +01:00 • committed by GitHub
parent a70a14001d
commit 40af84f87b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,9 +26,7 @@ params:
required: true
- name: region
description:
generic: "Retrieve 1 out of 5 regions from the API."
help:
en: Península, Canarias, Baleares, Ceuta, Melilla
generic: "Region"
example: Península
type: choice
choice: ["Península", "Canarias", "Baleares", "Ceuta", "Melilla"]
@ -39,13 +37,14 @@ render: |
{{ include "tariff-base" . }}
forecast:
source: http
uri: https://api.esios.ree.es/indicators/{{.indicator}}
auth:
type: bearer
token: {{ .securitytoken }}
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 == "{{.region}}")
| 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")),