diff --git a/fhem/CHANGED b/fhem/CHANGED index 212f48ef3..0d0f7a980 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - bugfix: 55_DWD_OpenData: updateAlertsCache causing "not a HASH reference" + error on some platforms (forum #83097) - change: 98_dewpoint: Don't manipulate STATE of target device if has stateFormat defined. - new: 55_DWD_OpenData: weather and alerts from DWD diff --git a/fhem/FHEM/55_DWD_OpenData.pm b/fhem/FHEM/55_DWD_OpenData.pm index 9ae692871..e44f47eb9 100644 --- a/fhem/FHEM/55_DWD_OpenData.pm +++ b/fhem/FHEM/55_DWD_OpenData.pm @@ -1024,7 +1024,7 @@ sub DWD_OpenData_GetAlertsBlockingFn($) # get communion (5, 8) or district (1, 9) alerts for Germany from DWD server my $communeUnion = DWD_OpenData_IsCommuneUnionWarncellId($warncellId); my $alertLanguage = AttrVal($name, 'alertLanguage', 'DE'); - my $url = 'https://opendata.dwd.de/weather/alerts/cap/'.($communeUnion? 'COMMUNEUNION' : 'DISTRICT').'_CELLS_STAT/Z_CAP_C_EDZW_LATEST_PVW_STATUS_PREMIUMCELLS_'.($communeUnion? 'COMMUNEUNION' : 'DISTRICT').'_'.$alertLanguage.'.zip'; + my $url = 'https://opendata.dwd.de/weather/alerts/cap/'.($communeUnion? 'COMMUNEUNION' : 'DISTRICT').'_CELLS_STAT/Z_CAP_C_EDZW_LATEST_PVW_STATUS_PREMIUMCELLS_'.($communeUnion? 'COMMUNEUNION' : 'DISTRICT').'_'.$alertLanguage.'.zip'; my $param = { url => $url, method => "GET", @@ -1216,10 +1216,10 @@ sub DWD_OpenData_ProcessAlerts($$$) Log3 $name, 3, "$name: DWD_OpenData_ProcessAlerts error: temp file name not defined"; } } - + # get rid of newlines and commas because of Blocking InformFn parameter restrictions - $errorMessage =~ s/\n/; /g; - $errorMessage =~ s/,/;/g; + $errorMessage =~ s/\n/; /g; + $errorMessage =~ s/,/;/g; Log3 $name, 5, "$name: DWD_OpenData_ProcessAlerts END"; @@ -1304,8 +1304,8 @@ sub DWD_OpenData_GetAlertsFinishFn(;$$$$) readingsSingleUpdate($hash, 'state', "alerts error: result file name not defined", 1); Log3 $name, 3, "$name: DWD_OpenData_GetAlertsFinishFn error: temp file name not defined"; } - - $hash->{ALERTS_IN_CACHE} = scalar(keys(%{$dwd_alerts[0]})) + scalar(keys(%{$dwd_alerts[1]})); + + $hash->{ALERTS_IN_CACHE} = (ref($dwd_alerts[0]) eq 'HASH'? scalar(keys(%{$dwd_alerts[0]})) : 0) + (ref($dwd_alerts[1]) eq 'HASH'? scalar(keys(%{$dwd_alerts[1]})) : 0); Log3 $name, 5, "$name: DWD_OpenData_GetAlertsFinishFn END"; } else { @@ -1460,6 +1460,9 @@ sub DWD_OpenData_Timer($) CHANGES + 13.05.2018 jensb + bugfix: total alerts in cache + 06.05.2018 jensb feature: detect empty alerts zip file bugfix: preprocess exception messages from ProcessAlerts because Blocking FinishFn parameter content may not contain commas or newlines @@ -1537,6 +1540,8 @@ sub DWD_OpenData_Timer($)
{$ENV{LANG}} into the FHEM command line to verify.
If nothing is displayed or you see an unexpected language setting, add export LANG=de_DE.UTF-8 or something similar to your FHEM start script, restart FHEM and check again. If you get a locale warning when starting FHEM the required language pack might be missing. It can be installed depending on your OS and your preferences (e.g. dpkg-reconfigure locales, apt-get install language-pack-de or something similar).