Hallo Leute,
ich habe folgende Herausforderung mit dem Weather-Modul:
Der Betreiber meiner abgerufenen Station dürfte seine Anlage zwischen Mitternacht und 5 Uhr in der Früh abdrehen oder sonst irgendwas machen.
Daher bekomme ich beim Abrufen der Station in dieser Zeit den Fehler "HTTP response code 204" (= No Content).
Bei einem Fehler ruft das Modul nun die Station nicht mehr stündlich ab (so wie von mir definiert), sondern jede Minute (minütlich 5 Stunden lang = 300 sinnlose Abfragen).
Nachdem beim Abrufen keine Daten zurück kommen, erzeugt dies zusätzlich eine PERL WARNING im Log-File.
Meine Definition:
Internals:
API wundergroundAPI
APIKEY XXX
APIOPTIONS stationId:IWENDL6
DEF API=wundergroundAPI,stationId:IWENDL6 apikey=XXX interval=3600 lang=de
FUUID 68fcc9cb-f33f-3e1e-cf8a-1ad139421cfc99c1
FVERSION 59_Weather.pm:v2.3.3-s30437/2025-10-23
INTERVAL 3600
LANG de
MODEL wundergroundAPI
NAME myWeather
NOTIFYDEV global
NR 564
NTFY_ORDER 50-myWeather
STATE T: 26.3 °C F: 58 % W: 4.0 km/h P: 962.5 hPa
TYPE Weather
VERSION v2.3.3
eventCount 268
READINGS:
2026-08-19 16:05:54 apiMaintainer Julian Pawlowski (loredo)
2026-08-19 16:05:54 apiVersion v1.3.0
2026-08-19 16:05:54 cloudCover 24
2026-08-19 16:05:54 code 47
2026-08-19 15:05:53 codeDay 30
2026-08-19 16:05:54 codeExtend 6200
2026-08-19 16:05:54 condition Zunächst Gewitter
2026-08-19 16:05:54 current_date_time Mi, 19 Aug 2026 16:05
2026-08-19 16:05:54 current_forecast_date_time Mi, 19 Aug 2026 16:05
2026-08-19 16:05:54 dewPoint 17.4
2026-08-19 16:05:54 fc1_cloudCover 24
2026-08-19 16:05:54 fc1_code 47
2026-08-19 15:05:53 fc1_codeDay 30
2026-08-19 16:05:54 fc1_codeExtend 6200
2026-08-19 16:05:54 fc1_condition Zunächst Gewitter
2026-08-19 16:05:54 fc1_day_of_week Mittwoch
2026-08-19 16:05:54 fc1_high_c 0
2026-08-19 16:05:54 fc1_icon scatteredshowers
2026-08-19 16:05:54 fc1_iconAPI 47
2026-08-19 16:05:54 fc1_low_c 19
2026-08-19 16:05:54 fc1_moonPhase erstes Viertel
2026-08-19 16:05:54 fc1_moonPhaseCode FQ
2026-08-19 16:05:54 fc1_moonPhaseDay 7
2026-08-19 16:05:54 fc1_moonriseTime Mi, 19 Aug 2026 14:09
2026-08-19 16:05:54 fc1_moonsetTime Mi, 19 Aug 2026 22:33
2026-08-19 16:05:54 fc1_narrative Morgens Gewitter. Tiefsttemperatur 19C.
2026-08-19 16:05:54 fc1_precipProbability 0.56
2026-08-19 16:05:54 fc1_precipProbabilitySnow 0
2026-08-19 16:05:54 fc1_sunriseTime Mi, 19 Aug 2026 06:04
2026-08-19 16:05:54 fc1_sunsetTime Mi, 19 Aug 2026 20:11
2026-08-19 16:05:54 fc1_tempHigh 0
2026-08-19 16:05:54 fc1_tempLow 19
2026-08-19 16:05:54 fc1_temperature 0
2026-08-19 15:05:53 fc1_uvIndex 6
2026-08-19 16:05:54 fc2_cloudCover 53
2026-08-19 16:05:54 fc2_code 38
2026-08-19 16:05:54 fc2_codeDay 38
2026-08-19 16:05:54 fc2_codeExtend 7203
2026-08-19 16:05:54 fc2_condition Nachm. Gewitter
2026-08-19 16:05:54 fc2_day_of_week Donnerstag
2026-08-19 16:05:54 fc2_high_c 26
2026-08-19 16:05:54 fc2_icon scatteredthunderstorms
2026-08-19 16:05:54 fc2_iconAPI 38
2026-08-19 16:05:54 fc2_low_c 17
2026-08-19 16:05:54 fc2_moonPhase erstes Viertel
2026-08-19 16:05:54 fc2_moonPhaseCode FQ
2026-08-19 16:05:54 fc2_moonPhaseDay 7
2026-08-19 16:05:54 fc2_moonriseTime Do, 20 Aug 2026 15:18
2026-08-19 16:05:54 fc2_moonsetTime Do, 20 Aug 2026 23:04
2026-08-19 16:05:54 fc2_narrative Nachmittags Gewitter. Höchsttemperaturen 25 bis 27C und Tiefsttemperaturen 16 bis 18C.
2026-08-19 16:05:54 fc2_precipProbability 8.99
2026-08-19 16:05:54 fc2_precipProbabilitySnow 0
2026-08-19 16:05:54 fc2_sunriseTime Do, 20 Aug 2026 06:06
2026-08-19 16:05:54 fc2_sunsetTime Do, 20 Aug 2026 20:10
2026-08-19 16:05:54 fc2_tempHigh 26
2026-08-19 16:05:54 fc2_tempLow 17
2026-08-19 16:05:54 fc2_temperature 26
2026-08-19 16:05:54 fc2_uvIndex 6
2026-08-19 16:05:54 fc3_cloudCover 80
2026-08-19 16:05:54 fc3_code 4
2026-08-19 16:05:54 fc3_codeDay 4
2026-08-19 16:05:54 fc3_codeExtend 400
2026-08-19 16:05:54 fc3_condition Gewitter
2026-08-19 16:05:54 fc3_day_of_week Freitag
2026-08-19 16:05:54 fc3_high_c 23
2026-08-19 16:05:54 fc3_icon thunderstorm
2026-08-19 16:05:54 fc3_iconAPI 4
2026-08-19 16:05:54 fc3_low_c 13
2026-08-19 16:05:54 fc3_moonPhase zunehmender Halbmond
2026-08-19 16:05:54 fc3_moonPhaseCode WXG
2026-08-19 16:05:54 fc3_moonPhaseDay 8
2026-08-19 16:05:54 fc3_moonriseTime Fr, 21 Aug 2026 16:21
2026-08-19 16:05:54 fc3_moonsetTime Fr, 21 Aug 2026 23:45
2026-08-19 16:05:54 fc3_narrative Gewitter. Höchsttemperaturen 22 bis 24C und Tiefsttemperaturen 12 bis 14C.
2026-08-19 16:05:54 fc3_precipProbability 13.54
2026-08-19 16:05:54 fc3_precipProbabilitySnow 0
2026-08-19 16:05:54 fc3_sunriseTime Fr, 21 Aug 2026 06:07
2026-08-19 16:05:54 fc3_sunsetTime Fr, 21 Aug 2026 20:08
2026-08-19 16:05:54 fc3_tempHigh 23
2026-08-19 16:05:54 fc3_tempLow 13
2026-08-19 16:05:54 fc3_temperature 23
2026-08-19 16:05:54 fc3_uvIndex 6
2026-08-19 16:05:54 fc4_cloudCover 27
2026-08-19 16:05:54 fc4_code 30
2026-08-19 16:05:54 fc4_codeDay 30
2026-08-19 16:05:54 fc4_codeExtend 3000
2026-08-19 16:05:54 fc4_condition Wolkig
2026-08-19 16:05:54 fc4_day_of_week Samstag
2026-08-19 16:05:54 fc4_high_c 23
2026-08-19 16:05:54 fc4_icon partly_cloudy
2026-08-19 16:05:54 fc4_iconAPI 30
2026-08-19 16:05:54 fc4_low_c 14
2026-08-19 16:05:54 fc4_moonPhase zunehmender Halbmond
2026-08-19 16:05:54 fc4_moonPhaseCode WXG
2026-08-19 16:05:54 fc4_moonPhaseDay 9
2026-08-19 16:05:54 fc4_moonriseTime Sa, 22 Aug 2026 17:17
2026-08-19 16:05:54 fc4_moonsetTime Mi, 19 Aug 2026 16:05
2026-08-19 16:05:54 fc4_narrative Teilweise bedeckt. Höchsttemperaturen 22 bis 24C und Tiefsttemperaturen 13 bis 15C.
2026-08-19 16:05:54 fc4_precipProbability 0
2026-08-19 16:05:54 fc4_precipProbabilitySnow 0
2026-08-19 16:05:54 fc4_sunriseTime Sa, 22 Aug 2026 06:08
2026-08-19 16:05:54 fc4_sunsetTime Sa, 22 Aug 2026 20:06
2026-08-19 16:05:54 fc4_tempHigh 23
2026-08-19 16:05:54 fc4_tempLow 14
2026-08-19 16:05:54 fc4_temperature 23
2026-08-19 16:05:54 fc4_uvIndex 6
2026-08-19 16:05:54 fc5_cloudCover 26
2026-08-19 16:05:54 fc5_code 34
2026-08-19 16:05:54 fc5_codeDay 34
2026-08-19 16:05:54 fc5_codeExtend 3400
2026-08-19 16:05:54 fc5_condition Meist sonnig
2026-08-19 16:05:54 fc5_day_of_week Sonntag
2026-08-19 16:05:54 fc5_high_c 24
2026-08-19 16:05:54 fc5_icon mostly_sunny
2026-08-19 16:05:54 fc5_iconAPI 34
2026-08-19 16:05:54 fc5_low_c 14
2026-08-19 16:05:54 fc5_moonPhase zunehmender Halbmond
2026-08-19 16:05:54 fc5_moonPhaseCode WXG
2026-08-19 16:05:54 fc5_moonPhaseDay 10
2026-08-19 16:05:54 fc5_moonriseTime So, 23 Aug 2026 18:01
2026-08-19 16:05:54 fc5_moonsetTime So, 23 Aug 2026 00:36
2026-08-19 16:05:54 fc5_narrative Meistens klar. Höchsttemperaturen 23 bis 25C und Tiefsttemperaturen 13 bis 15C.
2026-08-19 16:05:54 fc5_precipProbability 2.65
2026-08-19 16:05:54 fc5_precipProbabilitySnow 0
2026-08-19 16:05:54 fc5_sunriseTime So, 23 Aug 2026 06:10
2026-08-19 16:05:54 fc5_sunsetTime So, 23 Aug 2026 20:04
2026-08-19 16:05:54 fc5_tempHigh 24
2026-08-19 16:05:54 fc5_tempLow 14
2026-08-19 16:05:54 fc5_temperature 24
2026-08-19 16:05:54 fc5_uvIndex 6
2026-08-19 16:05:54 heatIndex 26.5
2026-08-19 16:05:54 humidity 58
2026-08-19 16:05:54 icon scatteredshowers
2026-08-19 16:05:54 iconAPI 47
2026-08-19 16:05:54 lastError
2026-08-19 16:05:54 lat lat-zuHause
2026-08-19 16:05:54 long long-zuHause
2026-08-19 16:05:54 precipProbability 0.56
2026-08-19 16:05:54 precipRate 0
2026-08-19 16:05:54 precipTotal 7.59
2026-08-19 16:05:54 pressure 962.5
2026-08-19 16:05:54 pubDate Mi, 19 Aug 2026 16:05
2026-08-19 16:05:54 pwsCountry AT
2026-08-19 16:05:54 pwsElevation 128.3
2026-08-19 16:05:54 pwsLat 48.248186
2026-08-19 16:05:54 pwsLon 13.677952
2026-08-19 16:05:54 pwsNeighborhood Zupfing
2026-08-19 16:05:54 pwsQcStatus 1
2026-08-19 16:05:54 pwsSoftwareType EasyWeatherV1.5.2
2026-08-19 16:05:54 pwsStationID IWENDL6
2026-08-19 16:05:54 solarRadiation 499.6
2026-08-19 16:05:54 state T: 26.3 °C F: 58 % W: 4.0 km/h P: 962.5 hPa
2026-08-19 16:05:54 status ok
2026-08-19 16:05:54 temp_c 26.3
2026-08-19 16:05:54 temperature 26.3
2026-08-19 16:05:54 uvIndex 4
2026-08-19 16:05:54 validity up-to-date
2026-08-19 16:05:54 wind 4.0
2026-08-19 16:05:54 windGust 5.5
2026-08-19 16:05:54 wind_chill 26.3
2026-08-19 16:05:54 wind_condition Wind: WNW 4.0 km/h
2026-08-19 16:05:54 wind_direction 282
2026-08-19 16:05:54 wind_direction_name OSO
2026-08-19 16:05:54 wind_speed 4.0
fhem:
LOCATION lat-zuHause,long-zuHause
allowCache 1
interfaces temperature;humidity;wind
Attributes:
devStateIcon {
if( AttrVal( $name,'disable','0' ) == 1 ) {
"<span style='color:red;font-weight:bold'>disabled</span>"
}
else {
"<span style='color:red'>Temperatur: ".formatiere_zahl( ReadingsNum( $name,'temperature',0 ) )." (".formatiere_zahl( ReadingsNum( $name,'wind_chill',0 ) ).") °C</span>"
."<span style='color:limegreen;padding-left:1em'>Druck: ".formatiere_zahl( ReadingsNum( $name,'pressure',0 ) )." mBar</span>"
."<span style='color:mediumorchid;padding-left:1em'>Feuchtigkeit: ".formatiere_zahl( ReadingsNum( $name,'humidity',0 ) )." %</span>"
."<span style='color:darkgrey;padding-left:1em'>Strahlung: ".formatiere_zahl( ReadingsNum( $name,'solarRadiation',0 ) )." W/m² (UV: ".ReadingsNum( $name,'uvIndex',0 ).")</span>"
."<br/>"
."<span style='color:blue'>WindGust: ".formatiere_zahl( ReadingsNum( $name,'windGust',0 ) )." (".formatiere_zahl( ReadingsNum( $name,'wind',0 ) )." - ".ReadingsVal( $name,'wind_direction_name','-' ).") km/h</span>"
."<span style='color:black;padding-left:1em'>Regen: ".formatiere_zahl( ReadingsNum( $name,'precipTotal',0 ) )." mm/Tag</span>"
."<span style='font-weight:bold;padding-left:1em'>(".ReadingsVal( $name,'pubDate','Invalid-Time' ).")</span>"
}
}
forecast daily
group WeatherStation
icon time_graph
room Wetter
sortby 51
userReadings wind_direction_name { windDirName( ReadingsVal( $name,'wind_direction',0 ) - 180 ) }
Log-File mit Verbose 5:
2026.08.19 01:05:03 5: HttpUtils url=https://api.weather.com/v3/wx/forecast/daily/5day?geocode=lat-zuHause,long-zuHause&format=json&units=m&language=de-DE&apiKey=XXX NonBlocking via https
2026.08.19 01:05:03 4: IP: api.weather.com -> 151.101.193.91
2026.08.19 01:05:03 5: HttpUtils request header:
GET /v3/wx/forecast/daily/5day?geocode=lat-zuHause,long-zuHause&format=json&units=m&language=de-DE&apiKey=XXX HTTP/1.0
Host: api.weather.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
2026.08.19 01:05:03 4: https://api.weather.com/v3/wx/forecast/daily/5day?geocode=lat-zuHause,long-zuHause&format=json&units=m&language=de-DE&apiKey=XXX: HTTP response code 200
2026.08.19 01:05:03 5: HttpUtils https://api.weather.com/v3/wx/forecast/daily/5day?geocode=lat-zuHause,long-zuHause&format=json&units=m&language=de-DE&apiKey=XXX: Got data, length: 6093
2026.08.19 01:05:03 5: HttpUtils response header:
HTTP/1.1 200 OK
Connection: close
Content-Length: 1866
Content-Type: application/json;charset=UTF-8
Access-Control-Allow-Origin: *
Content-Encoding: gzip
Content-Language: de-DE
Expires: Tue, 18 Aug 2026 23:09:39 GMT
X-Region: eu-west-1
Akamai-GRN: FS-f635de7c-ee1d-45bb-bfa0-cfb0adef234e
X-Content-Type-Options: nosniff
Content-Security-Policy: default-src 'none'
Date: Tue, 18 Aug 2026 23:05:03 GMT
Cache-Control: s-maxage=698,max-age=275
vary: Accept-Encoding
Strict-Transport-Security: max-age=86400
2026.08.19 01:05:03 5: HttpUtils url=https://api.weather.com/v2/pws/observations/current?stationId=IWENDL6&format=json&units=m&numericPrecision=decimal&apiKey=XXX NonBlocking via https
2026.08.19 01:05:03 4: IP: api.weather.com -> 151.101.193.91
2026.08.19 01:05:03 5: HttpUtils request header:
GET /v2/pws/observations/current?stationId=IWENDL6&format=json&units=m&numericPrecision=decimal&apiKey=XXX HTTP/1.0
Host: api.weather.com
User-Agent: fhem
Accept-Encoding: gzip,deflate
2026.08.19 01:05:03 4: https://api.weather.com/v2/pws/observations/current?stationId=IWENDL6&format=json&units=m&numericPrecision=decimal&apiKey=XXX: HTTP response code 204
2026.08.19 01:05:03 1: PERL WARNING: Use of uninitialized value in concatenation (.) or string at FHEM/HttpUtils.pm line 1098.
2026.08.19 01:05:03 1: stacktrace:
2026.08.19 01:05:03 1: main::__ANON__ called by FHEM/HttpUtils.pm (1098)
2026.08.19 01:05:03 1: main::HttpUtils_ParseAnswer called by FHEM/HttpUtils.pm (783)
2026.08.19 01:05:03 1: main::__ANON__ called by fhem.pl (785)
2026.08.19 01:05:03 5: HttpUtils https://api.weather.com/v2/pws/observations/current?stationId=IWENDL6&format=json&units=m&numericPrecision=decimal&apiKey=XXX: Got data, length:
2026.08.19 01:05:03 5: HttpUtils response header:
HTTP/1.1 204 No Content
Connection: close
X-Region: eu-west-1
Content-Encoding: gzip
Expires: Tue, 18 Aug 2026 23:08:02 GMT
X-Trace-Token: 70d6f2da-bed5-433b-96f2-dabed5d33be0
Akamai-GRN: FS-5eeeadfc-3d1b-4ea8-a585-d51adc6b4708
X-Content-Type-Options: nosniff
Content-Security-Policy: default-src 'none'
Access-Control-Allow-Origin: *
Date: Tue, 18 Aug 2026 23:05:03 GMT
Cache-Control: max-age=179
vary: Accept-Encoding
Strict-Transport-Security: max-age=86400
2026.08.19 01:05:03 5: Starting notify loop for myWeather, 11 event(s), first is lastError: No Data Found for specific PWS
2026.08.19 01:05:03 5: End notify loop for myWeather
2026.08.19 01:05:03 4: Weather myWeather: Rearm new Timer
Vielleicht kann man den Spezialfall "HTTP response code 204" (= No Content) abfangen oder ein "disabledForIntervals" ins Modul einbauen?
Danke für die Unterstützung
Robert
Zitat von: bertl am 19 August 2026, 17:48:00oder ein "disabledForIntervals" ins Modul einbauen?
Probier mal:
attr <deviceName> userattr disabledForIntervals
attr <deviceName> disabledForIntervals 18:00-19:00
Das Perl-Gemeckere kommt aus dem Debugging in FHEM/HttpUtils.pm.
Kannst du bitte mal dafür sorgen, dass es weiter Anlass zu Gemecker gibt, und dann die beiden Zeilen ab Zeile 1098
Log3 $hash, $hash->{loglevel}+1,
"HttpUtils $hash->{displayurl}: Got data, length: ". length($ret);
durch
my $length = ( defined($ret) ? length($ret) : "no return value" );
Log3 $hash, $hash->{loglevel}+1,
"HttpUtils $hash->{displayurl}: Got data, length: ". $length;
ersetzen? FHEM neustarten und beobachten, ob das Perl-Gemecker dem Fehler 204 immer noch nachläuft?
Notiz an mich selbst:
fhem/lib/FHEM/Core/Weather.pm, Zeile 318
my $next = 60; # $next= $hash->{INTERVAL};
_RearmTimer( $hash, gettimeofday() + $next );
In einer früheren Version hat er einfach die Aktualisierung übersprungen. Aktuell versucht er es nach jedem Fehler schon nach einer Minute erneut.
Idee: Zähler consecutiveErrorCount einbauen und exponentielle Verzögerung (1, 2, 4, 8, 16, 32, ..., mit $hash->{INTERVAL} als Obergrenze) einbauen. $next als Reading nextUpdateTime exponieren.
Kann ich gerne mal einbauen und heute Nacht beobachten.
Das Perl-Gemeckere ist dann mit Sicherheit weg.
Das mit dem "Zähler consecutiveErrorCount einbauen und exponentielle Verzögerung" finde ich gut!
Zusätzlich wäre ich über einen Log-Eintrag sehr froh!
Zitat von: betateilchen am 19 August 2026, 18:08:45Probier mal:
attr <deviceName> userattr disabledForIntervals
attr <deviceName> disabledForIntervals 18:00-19:00
... danke für den Hinweis - probiert und funktioniert!
Das ist die einfachste und schnellste Lösung für diesen speziellen Fall.