Solarprognose.de: fix gaps and undeprecate (#28642)
This commit is contained in:
parent
d42c79932b
commit
59c49e7ce1
1 changed files with 43 additions and 9 deletions
|
|
@ -1,5 +1,4 @@
|
|||
template: solarprognose
|
||||
deprecated: true
|
||||
products:
|
||||
- brand: Solarprognose
|
||||
requirements:
|
||||
|
|
@ -13,7 +12,7 @@ params:
|
|||
description:
|
||||
en: Access Token from User Profile
|
||||
de: Zugriffs-Schlüssel aus Benutzer-Profil
|
||||
advanced: true
|
||||
required: true
|
||||
- name: item
|
||||
choice: ["location", "plant", "inverter", "module_field"]
|
||||
description:
|
||||
|
|
@ -39,20 +38,55 @@ params:
|
|||
en: Forecasting Algorithm (mosmix, own-v1 or clearsky)
|
||||
de: Prognosealgorithmus (mosmix, own-v1 oder clearsky)
|
||||
advanced: true
|
||||
- name: forecast_days
|
||||
description:
|
||||
en: Number of additional days to forecast (1-6)
|
||||
de: Anzahl zusätzlicher Tage für die Prognose (1-6)
|
||||
help:
|
||||
en: "Number of additional days to forecast (1-6), excluding today. Remember: evcc calculates energy for today, tomorrow, and the day after tomorrow, effectively handling up to three days of solar forecast data, but the UI shows up to 96 hours."
|
||||
de: "Anzahl der zusätzlichen Tage für die Prognose (1-6), ohne den heutigen Tag. Bedenke: evcc berechnet die Energie für heute, morgen und übermorgen und verarbeitet dabei effektiv bis zu drei Tage Solarprognosedaten, zeigt jedoch bis zu 96 Stunden an."
|
||||
default: 4
|
||||
advanced: true
|
||||
- name: interval
|
||||
default: 1h
|
||||
advanced: true
|
||||
render: |
|
||||
type: custom
|
||||
tariff: solar
|
||||
features: ["cacheable"]
|
||||
forecast:
|
||||
source: http
|
||||
# Base URL with required params (format, type, algorithm, access token), then optional item-based parameters
|
||||
uri: https://www.solarprognose.de/web/solarprediction/api/v1?_format=json&type=hourly{{ if .algorithm }}&algorithm={{ .algorithm }}{{ end }}&access-token={{ .token }}{{ if .item }}&item={{ .item }}{{ if .id }}&id={{ .id }}{{ else }}&token={{ unquote .uniquetoken }}{{ end }}{{ end }}
|
||||
# Base URL with required params (format, type, access token), then optional item-based parameters
|
||||
uri: https://www.solarprognose.de/web/solarprediction/api/v1?_format=json&type=hourly&project=https://evcc.io&access-token={{ .token }}{{ if .item }}&item={{ .item }}{{ if .id }}&id={{ .id }}{{ else }}&token={{ unquote .uniquetoken }}{{ end }}{{ end }}{{ if .algorithm }}&algorithm={{ .algorithm }}{{ end }}{{ if .forecast_days }}&end_day={{ .forecast_days }}{{ end }}
|
||||
jq: |
|
||||
[ .data | to_entries.[] | {
|
||||
"start": (.key | tonumber | strftime("%FT%TZ") ),
|
||||
"end": (.key | tonumber + 3600 | strftime("%FT%TZ") ) ,
|
||||
"value": (.value.[0]*1000) # returned value unit is always kW
|
||||
} ] | tostring
|
||||
def step: 3600; # hourly interval
|
||||
|
||||
def lookup:
|
||||
(.data // {})
|
||||
| if type == "object" and length > 0 then
|
||||
to_entries
|
||||
| map({key, value: (.value[0] * 1000)})
|
||||
| from_entries
|
||||
else
|
||||
{}
|
||||
end;
|
||||
|
||||
. as $root
|
||||
| ($root | lookup) as $L
|
||||
| ($L | keys | map(tonumber) | sort) as $ts
|
||||
| ($ts[0]) as $min
|
||||
| ($ts[-1]) as $max
|
||||
| reduce range($min; $max + step; step) as $t
|
||||
( { last: null, out: [] };
|
||||
($L[($t|tostring)]?) as $v
|
||||
| .last = (if $v == null then .last else $v end)
|
||||
| .out +=
|
||||
[ {
|
||||
start: ($t | strftime("%FT%TZ")),
|
||||
end: (($t + step) | strftime("%FT%TZ")),
|
||||
value: (.last // 0)
|
||||
} ]
|
||||
)
|
||||
| .out
|
||||
| tostring
|
||||
interval: {{ .interval }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue