Wenn bei einem HTTP request zu OpenWeatherAPI (temporär) keine Verbindung aufgebaut werden kann, führt das dazu, dass sich die Anzahl der Requests in jedem Zyklus verdoppeln.
Nach kurzer Zeit werden damit extrem viele Requests ausgelöst, das dann sehr schnell zu hohen kosten führen könnte.
Ich vermute, dass _CallWeatherCallbackFn zweimal aufgerufen wird, wenn die Verbindung fehlschlägt
Ich verwende folgende OpenWeather Settings:
location=xxx,yyy interval=600 apikey=zzz API=OpenWeatherMapAPI lang=de apioptions=cachemaxage:3600 endpoint=weather
Was genau soll eigentlich dieses "endpoint" sein? Wo hast Du diese define Zeile her?
Kannst Du mir bitte einmal einen Screenshot anpingen wo man diese extrem vielen Requests sieht. Verstehe gerade den Zusammenhang nicht so ganz.
Danke
Ich habe den Code ein wenig instrumentiert ...
und fhem mit einer ungültigen URL gestartet, um das Phenomen zu simulieren.
Beim ersten mal waren es zwei Requests
2026.07.31 18:08:46 0: OpenWeather request:https://api.openweathermap1.org/data/2.5/weather?lat=...
2026.07.31 18:08:46 0: OpenWeather request:https://api.openweathermap1.org/data/2.5/forecast?lat=...
Eine zweiten mal waren es schon vier
2026.07.31 18:09:46 0: OpenWeather request:https://api.openweathermap1.org/data/2.5/weather?lat=...
2026.07.31 18:09:46 0: OpenWeather request:https://api.openweathermap1.org/data/2.5/forecast?lat=...
2026.07.31 18:09:46 0: OpenWeather request:https://api.openweathermap1.org/data/2.5/weather?lat=...
2026.07.31 18:09:46 0: OpenWeather request:https://api.openweathermap1.org/data/2.5/forecast?lat=...
Da ich letzte Nacht einen längeren Ausfall hatte, ist die Anzahl der Anfragen exponentiel gestiegen und FHEM lief bei 100% CPU load und hatte nicht mehr reagiert. Es half nur noch ein kill -9.
Ok da muss ich mal schauen wie ich das simulieren kann.
Ist Dein FHEM aktuell?
Das "endpoint" ist dennoch falsch.
Bei der Analyse vom Code hatte ich eine Vermutung, dass dies mit der Endpoint Variable zu tun hat.
Dies hatte aber keinen Änderung zezeigt, ich hatte nur vergessen es wieder zu entfernen.
Ich verwende Version 6.4.
Es lässt sich relativ einfach simulieren, wenn man im Code eine nicht erreichbare URL verwendet.
Version 6.4? Damit meinst Du FHEM Version?
Hast Du jemals mittels FHEM ein Update gemacht?
Zeig mal bitte ein
list vom Weather Device. Irgendwie sieht die Ausgabe seltsam aus.
Hast Du das API Modul angepasst?
Da ich fhem als rpm package verwende, habe ich bis jetzt kein Update gemacht.
6.4. ist das letzte fhem Release.
59_Weather.pm:v2.2.35-s29619/2025-02-04
Wie geschrieben, habe ich OpenWeatherMapAPI.pm etwas instrumentiert. Ich habe vor "::HttpUtils_NonblockingGet" eine Log Message eingebaut, um eine Vermutung zu bestätigen.
Ich habe jetzt auch mal ein Update gemacht und den zusätzlichen Log und die korrupte URL wieder reingepacht.
Das Ergebnis ist dasselbe.
Beim ersten Request 2 HTTP Anfrage,
Beim zweiten Request (1min später) sind es 4 HTTP Anfragen,
Beim fritten Request (wieder 1min später) sind es 8 HTTP Anfragen,
Kannst Du den Patch hier einmal bitte anhängen? Danke
--- OpenWeatherMapAPI.pm.orig 2026-07-31 19:59:37.065866335 +0200
+++ OpenWeatherMapAPI.pm 2026-07-31 20:00:59.547387538 +0200
@@ -120,7 +120,7 @@
## use critic
# Readonly my $URL => 'https://api.openweathermap.org/data/2.5/';
-Readonly my $URL => 'https://api.openweathermap.org/data/';
+Readonly my $URL => 'https://api.openweathermap2.org/data/';
## URL . 'weather?' for current data
## URL . 'onecall?' for current,forecast data
@@ -362,6 +362,7 @@
. 'exclude='
. _CreateExcludeString( $self->{forecast}, $self->{alerts} );
+ ::Log(0, "HttpUtils_NonblockingGet: ".$paramRef->{url});
::HttpUtils_NonblockingGet($paramRef);
}
Ich habe Deine Änderungen mal bei mir eingepflegt und bekomme als log Ausagbe
2026.07.31 21:18:00 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/3.0/onecall?lat=51.73524&lon=10.8135&APPID=XXXXXXXXXXXXXXXXXXXXXX&units=metric&lang=de&exclude=alerts,minutely
Aber sowas wie
2026.07.31 18:09:46 0: OpenWeather request:https://api.openweathermap1.org/data/2.5/weather?lat=...
habe ich nicht bekommen.
Als ich das Update eingespielt habe, wurde mein hinzugefügter Log überschrieben.
Also musste ich den Log neu hinzufügen, dabei habe ich wohl ein anderes Pattern verwendet als im Text oben.
Ist das Aufdoppeln der Requests sichtbar?
Ich sehe mit dem Patch folgende Messages im Log:
2026.07.31 20:01:33 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/weather?lat=
2026.07.31 20:01:33 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/forecast?lat=
2026.07.31 20:02:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/weather?lat=
2026.07.31 20:02:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/forecast?lat=
2026.07.31 20:02:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/weather?lat=
2026.07.31 20:02:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/forecast?lat=
2026.07.31 20:03:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/weather?lat=
2026.07.31 20:03:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/forecast?lat=
2026.07.31 20:03:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/weather?lat=
2026.07.31 20:03:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/forecast?lat=
2026.07.31 20:03:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/weather?lat=
2026.07.31 20:03:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/forecast?lat=
2026.07.31 20:03:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/weather?lat=
2026.07.31 20:03:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/forecast?lat=
2026.07.31 20:04:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/weather?lat=
2026.07.31 20:04:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/forecast?lat=
2026.07.31 20:04:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/weather?lat=
2026.07.31 20:04:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/forecast?lat=
2026.07.31 20:04:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/weather?lat=
2026.07.31 20:04:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/forecast?lat=
2026.07.31 20:04:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/weather?lat=
2026.07.31 20:04:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/forecast?lat=
2026.07.31 20:04:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/weather?lat=
2026.07.31 20:04:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/forecast?lat=
2026.07.31 20:04:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/weather?lat=
2026.07.31 20:04:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/forecast?lat=
2026.07.31 20:04:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/weather?lat=
2026.07.31 20:04:34 0: HttpUtils_NonblockingGet: https://api.openweathermap2.org/data/2.5/forecast?lat=
Interessant, bei onecall mit 3.0 scheint es das nicht zu geben. Ich muss da mal die Definition ändern und dann schauen.
Ich schaue mir das morgen weiter an.