Sign inSign up

dododuke/forecastcollector

By dododuke

•Updated 6 days ago

Service that periodically fetches a PV production forecast and forwards to SunnyHome

Image
0

143

dododuke/forecastcollector repository overview

⁠Forecast Collector

🇨🇿 Česky⁠ | 🇬🇧 English⁠


⁠Česky

Malá konzolová služba, která v pravidelných intervalech stahuje předpověď výroby FVE (fotovoltaické elektrárny) pro danou polohu a pošle denní součty do InfoDat / SunnyHome přes externí kolektor (/externalcollector/).

Do InfoDat odesílá dvě hodnoty v kWh:

KlíčVýznam
fve_forecast_todayPředpokládaná výroba dnes
fve_forecast_tomorrowPředpokládaná výroba zítra

Prefix fve_forecast jde změnit parametrem DataKeyPrefix.

⁠Zdroje předpovědi
  • ForecastSolar (forecast.solar⁠): vrací hotovou předpověď výroby v kWh.
  • OpenMeteo (open-meteo.com⁠): vrací sluneční záření na nakloněnou plochu a výroba se dopočítá jako součet záření × kWp × PerformanceRatio.

Zdroj se vybírá parametrem Source.

⁠Instalace
  1. Vytvoř adresář pro konfiguraci, např. /opt/forecastcollector.
  2. Vytvoř v něm soubor config.ini (viz níže).
  3. Spusť kontejner:
docker run -d --restart unless-stopped --name forecastcollector \
  -v /opt/forecastcollector:/config \
  dododuke/forecastcollector:arm64

Konfigurace se čte ze souboru config.ini ve složce připojené do /config. Soubor musí být čitelný pro ostatní uživatele (chmod 644 config.ini), protože kontejner běží pod neprivilegovaným uživatelem.

Po úpravě konfigurace kontejner restartuj:

docker restart forecastcollector

Log zobrazíš příkazem:

docker logs -f forecastcollector

Tag arm64 je určen pro linux/arm64 (např. Raspberry Pi 3/4/5 s 64bitovým systémem).

⁠Konfigurace (config.ini)

Řádky začínající # nebo ; jsou komentáře. Desetinná čárka i tečka jsou povoleny.

ParametrPovinnýVýchozíPopis
Latitude, LongitudeanoZeměpisná šířka a délka elektrárny
TiltanoSklon panelů ve stupních (0 = vodorovně, 90 = svisle)
AzimuthanoAzimut: 0 = jih, -90 = východ, 90 = západ, 45 = jihozápad
KwpanoInstalovaný výkon v kWp
IntervalMinutesanoJak často se ptát (minuty). Minimum je 5. Veřejné Forecast.Solar API povoluje 12 dotazů za hodinu
SourceneForecastSolarForecastSolar nebo OpenMeteo
PerformanceRatione0.80Jen pro OpenMeteo: účinnost systému, typicky 0.75 až 0.85
ApiKeyneAPI klíč placeného plánu Forecast.Solar
TimeZonenečasová zóna kontejneru (UTC)IANA název (např. Europe/Prague) pro určení "dnes" a "zítra". Doporučuji nastavit
InfoDatUrlanoCelá adresa kolektoru včetně /externalcollector/
InfoDatUser, InfoDatPasswordnePřihlašovací údaje (basic auth). Pokud je InfoDatUser prázdný, hlavička se neposílá
InfoDatCertThumbprintneSHA-256 otisk certifikátu serveru (viz níže)
DataKeyPrefixnefve_forecastPrefix klíčů odesílaných do InfoDat
ValidTimeSecondsne2,5 × intervalJak dlouho InfoDat považuje hodnotu za platnou (sekundy)
⁠Příklad config.ini
# Konfigurace ForecastCollector
# Radky zacinajici # nebo ; jsou komentare.

# --- Poloha a panely ---
Latitude=49.1947967
Longitude=16.6085803

# Sklon panelu ve stupnich (0 = vodorovne, 90 = svisle)
Tilt=30

# Azimut: 0 = jih, -90 = vychod, 90 = zapad, 45 = jihozapad
Azimuth=45

# Instalovany vykon v kWp
Kwp=5.4

# Jak casto se ptat (v minutach), minimum 5
IntervalMinutes=10

# Casova zona pro urceni "dnes" / "zitra" (IANA nazev)
TimeZone=Europe/Prague

# --- Zdroj predpovedi: ForecastSolar nebo OpenMeteo ---
Source=OpenMeteo

# Jen pro OpenMeteo: ucinnost systemu, typicky 0.75 - 0.85
PerformanceRatio=0.75

# Volitelne: API klic placeneho planu Forecast.Solar
#ApiKey=

# --- InfoDat / SunnyHome ---
# IP adresa a port, kde bezi SunnyHome
InfoDatUrl=https://192.168.1.113:8802/externalcollector/

# Prihlaseni je volitelne: kdyz je InfoDatUser prazdny, basic auth se neposila
InfoDatUser=
InfoDatPassword=

# SHA-256 otisk certifikatu serveru (pro self-signed certifikat)
InfoDatCertThumbprint=AB:CD:EF:...

# Prefix klicu: vzniknou fve_forecast_today a fve_forecast_tomorrow
DataKeyPrefix=fve_forecast

# Platnost dat v InfoDat v sekundach (vychozi: 2,5x interval)
ValidTimeSeconds=1800
⁠Certifikát SunnyHome (InfoDatCertThumbprint)

Pokud SunnyHome používá vlastní (self-signed) certifikát, což je typické při přístupu přes IP adresu, spojení by jinak selhalo s chybou ověření certifikátu. Nastav proto InfoDatCertThumbprint na SHA-256 otisk (fingerprint) certifikátu serveru. Program pak přijme právě tento certifikát.

Otisk zjistíš:

  • ve webovém prohlížeči: otevři adresu SunnyHome, klikni na ikonu zámku, zobraz detail certifikátu a zkopíruj pole SHA-256 fingerprint (dvojtečky a mezery nevadí),
  • nebo příkazem:
openssl s_client -connect 192.168.1.113:8802 </dev/null 2>/dev/null | openssl x509 -noout -fingerprint -sha256

Přihlašování je na certifikátu nezávislé: pokud SunnyHome přihlášení nevyžaduje, nech InfoDatUser a InfoDatPassword prázdné.

⁠Zdroje dat a licence

Data z Open-Meteo jsou licencována CC BY 4.0, atribuce: Weather data by Open-Meteo.com⁠. Bezplatné API Open-Meteo je určeno pro nekomerční použití. Podmínky Forecast.Solar a Open-Meteo si ověř na jejich webech.


⁠English

A small console service that periodically fetches a photovoltaic (PV) production forecast for a given location and pushes the daily totals to InfoDat / SunnyHome through its external collector API (/externalcollector/).

It sends two values in kWh:

KeyMeaning
fve_forecast_todayExpected production today
fve_forecast_tomorrowExpected production tomorrow

The fve_forecast prefix can be changed with the DataKeyPrefix parameter.

⁠Forecast sources
  • ForecastSolar (forecast.solar⁠): returns a ready-made production forecast in kWh.
  • OpenMeteo (open-meteo.com⁠): returns solar irradiance on a tilted plane, and production is calculated as sum of irradiance × kWp × PerformanceRatio.

The source is selected with the Source parameter.

⁠Installation
  1. Create a directory for the configuration, e.g. /opt/forecastcollector.
  2. Create a config.ini file in it (see below).
  3. Run the container:
docker run -d --restart unless-stopped --name forecastcollector \
  -v /opt/forecastcollector:/config \
  dododuke/forecastcollector:arm64

The configuration is read from the config.ini file in the folder mounted to /config. The file must be readable by other users (chmod 644 config.ini), because the container runs as an unprivileged user.

After changing the configuration, restart the container:

docker restart forecastcollector

View the log with:

docker logs -f forecastcollector

The arm64 tag is built for linux/arm64 (e.g. Raspberry Pi 3/4/5 running a 64-bit OS).

⁠Configuration (config.ini)

Lines starting with # or ; are comments. Both decimal comma and decimal point are accepted.

ParameterRequiredDefaultDescription
Latitude, LongitudeyesPlant coordinates
TiltyesPanel tilt in degrees (0 = horizontal, 90 = vertical)
AzimuthyesAzimuth: 0 = south, -90 = east, 90 = west, 45 = southwest
KwpyesInstalled power in kWp
IntervalMinutesyesPolling interval in minutes. Minimum is 5. The public Forecast.Solar API allows 12 requests per hour
SourcenoForecastSolarForecastSolar or OpenMeteo
PerformanceRationo0.80OpenMeteo only: system efficiency, typically 0.75 to 0.85
ApiKeynoAPI key of a paid Forecast.Solar plan
TimeZonenocontainer time zone (UTC)IANA name (e.g. Europe/Prague) used to decide "today" and "tomorrow". Recommended to set
InfoDatUrlyesFull collector URL including /externalcollector/
InfoDatUser, InfoDatPasswordnoCredentials (basic auth). If InfoDatUser is empty, no auth header is sent
InfoDatCertThumbprintnoSHA-256 fingerprint of the server certificate (see below)
DataKeyPrefixnofve_forecastPrefix of the keys sent to InfoDat
ValidTimeSecondsno2.5 × intervalHow long InfoDat treats a value as valid (seconds)
⁠Example config.ini
# ForecastCollector configuration
# Lines starting with # or ; are comments.

# --- Location and panels ---
Latitude=49.1947967
Longitude=16.6085803

# Panel tilt in degrees (0 = horizontal, 90 = vertical)
Tilt=30

# Azimuth: 0 = south, -90 = east, 90 = west, 45 = southwest
Azimuth=45

# Installed power in kWp
Kwp=5.4

# Polling interval in minutes, minimum 5
IntervalMinutes=10

# Time zone used to decide "today" / "tomorrow" (IANA name)
TimeZone=Europe/Prague

# --- Forecast source: ForecastSolar or OpenMeteo ---
Source=OpenMeteo

# OpenMeteo only: system efficiency, typically 0.75 - 0.85
PerformanceRatio=0.75

# Optional: API key of a paid Forecast.Solar plan
#ApiKey=

# --- InfoDat / SunnyHome ---
# IP address and port where SunnyHome runs
InfoDatUrl=https://192.168.1.113:8802/externalcollector/

# Login is optional: if InfoDatUser is empty, basic auth is not sent
InfoDatUser=
InfoDatPassword=

# SHA-256 fingerprint of the server certificate (for a self-signed certificate)
InfoDatCertThumbprint=AB:CD:EF:...

# Key prefix: produces fve_forecast_today and fve_forecast_tomorrow
DataKeyPrefix=fve_forecast

# Validity of the values in InfoDat in seconds (default: 2.5x interval)
ValidTimeSeconds=1800
⁠SunnyHome certificate (InfoDatCertThumbprint)

If SunnyHome uses its own (self-signed) certificate, which is typical when accessed by IP address, the connection would otherwise fail with a certificate validation error. Set InfoDatCertThumbprint to the SHA-256 fingerprint of the server certificate. The program then accepts exactly that certificate.

To find the fingerprint:

  • in a web browser: open the SunnyHome address, click the lock icon, open the certificate details and copy the SHA-256 fingerprint field (colons and spaces are ignored),
  • or with a command:
openssl s_client -connect 192.168.1.113:8802 </dev/null 2>/dev/null | openssl x509 -noout -fingerprint -sha256

Login is independent of the certificate: if SunnyHome does not require a login, leave InfoDatUser and InfoDatPassword empty.

⁠Data sources and licence

Open-Meteo data is licensed under CC BY 4.0, attribution: Weather data by Open-Meteo.com⁠. The free Open-Meteo API is for non-commercial use. Check the terms of Forecast.Solar and Open-Meteo on their websites.

Tag summary

Content type

Image

Digest

sha256:218799a14…

Size

75 MB

Last updated

6 days ago

docker pull dododuke/forecastcollector:arm64