2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

55_DWD_OpenData.pm: fix platform dependent error "not a HASH reference" when updating alerts cache (Forum #83097)

git-svn-id: https://svn.fhem.de/fhem/trunk@16739 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jensb 2018-05-14 19:36:11 +00:00
parent cf05dd5667
commit 6c8ffbea68
2 changed files with 13 additions and 7 deletions

View File

@ -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

View File

@ -1305,7 +1305,7 @@ sub DWD_OpenData_GetAlertsFinishFn(;$$$$)
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($)
<li>The weekday of the forecast will be in the language of your FHEM system. Enter <code>{$ENV{LANG}}</code> into the FHEM command line to verify.
If nothing is displayed or you see an unexpected language setting, add <code>export LANG=de_DE.UTF-8</code> 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. <code>dpkg-reconfigure locales</code>, <code>apt-get install language-pack-de</code> or something similar). </li><br>
<li>The digits in a warncell id of a communeunion or a district are mostly identical to an <i>Amtliche Gemeindekennziffer</i> if you strip of the 1st digit from the warncell id. You can lookup an Amtliche Gemeindekennziffer using the name of a communeunion or district e.g. at <a href="https://www.statistik-bw.de/Statistik-Portal/gemeindeverz.asp">Statistische &Auml;mter des Bundes und der L&auml;nder</a>. Then add 8 for a communeunion or 1 or 9 for a district at the beginning and try to find an exact or near match in the <a href="https://www.dwd.de/DE/leistungen/opendata/help/warnungen/cap_warncellids_csv.csv">Warncell-IDs for CAP alerts catalogue</a>. This approach is an alternative to <i>guessing</i> the right warncell id by the name of a communeunion or district. </li><br>
<li>Like some other Perl modules this module temporarily modifies the TZ environment variable for timezone conversions. This may cause unexpected results in multi threaded environments. </li><br>
<li>The forecast reading names do not contain absolute days or hours to keep them independent of summertime adjustments. Forecast days are counted relative to "today" of the timezone defined by the attribute of the same name or the timezone specified by the Perl TZ environment variable if undefined. </li><br>
@ -1741,4 +1746,3 @@ sub DWD_OpenData_Timer($)
=end html_DE
=cut