77_UWZ.pm 79 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214
  1. ####################################################################################################
  2. #
  3. # 77_UWZ.pm
  4. #
  5. # (c) 2015 Tobias D. Oestreicher
  6. #
  7. # Special thanks goes to comitters:
  8. # - Marko Oldenburg (leongaultier at gmail dot com)
  9. #
  10. # Storm warnings from unwetterzentrale.de
  11. # inspired by 59_PROPLANTA.pm
  12. #
  13. # Copyright notice
  14. #
  15. # This script is free software; you can redistribute it and/or modify
  16. # it under the terms of the GNU General Public License as published by
  17. # the Free Software Foundation; either version 2 of the License, or
  18. # (at your option) any later version.
  19. #
  20. # The GNU General Public License can be found at
  21. # http://www.gnu.org/copyleft/gpl.html.
  22. # A copy is found in the text file GPL.txt and important notices to the license
  23. # from the author is found in LICENSE.txt distributed with these scripts.
  24. #
  25. # This script is distributed in the hope that it will be useful,
  26. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  27. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  28. # GNU General Public License for more details.
  29. #
  30. # This copyright notice MUST APPEAR in all copies of the script!
  31. #
  32. #
  33. #
  34. # $Id: 77_UWZ.pm 12835 2016-12-19 20:11:33Z CoolTux $
  35. #
  36. ####################################################################################################
  37. # also a thanks goes to hexenmeister
  38. ##############################################
  39. package main;
  40. use strict;
  41. use feature qw/say switch/;
  42. use warnings;
  43. no if $] >= 5.017011, warnings => 'experimental::lexical_subs','experimental::smartmatch';
  44. my $missingModul;
  45. eval "use LWP::UserAgent;1" or $missingModul .= "LWP::UserAgent ";
  46. eval "use LWP::Simple;1" or $missingModul .= "LWP::Simple ";
  47. eval "use HTTP::Request;1" or $missingModul .= "HTTP::Request ";
  48. eval "use HTML::Parser;1" or $missingModul .= "HTML::Parser ";
  49. eval "use JSON;1" or $missingModul .= "JSON ";
  50. eval "use Encode::Guess;1" or $missingModul .= "Encode::Guess ";
  51. eval "use Text::Iconv;1" or $missingModul .= "Text::Iconv ";
  52. require 'Blocking.pm';
  53. require 'HttpUtils.pm';
  54. use vars qw($readingFnAttributes);
  55. use vars qw(%defs);
  56. my $MODUL = "UWZ";
  57. my $version = "1.4.7";
  58. my $countrycode = "DE";
  59. my $plz = "77777";
  60. my $uwz_alert_url = "http://feed.alertspro.meteogroup.com/AlertsPro/AlertsProPollService.php?method=getWarning&language=de&areaID=UWZ" . $countrycode . $plz;
  61. ########################################
  62. sub UWZ_Log($$$) {
  63. my ( $hash, $loglevel, $text ) = @_;
  64. my $xline = ( caller(0) )[2];
  65. my $xsubroutine = ( caller(1) )[3];
  66. my $sub = ( split( ':', $xsubroutine ) )[2];
  67. $sub =~ s/UWZ_//;
  68. my $instName = ( ref($hash) eq "HASH" ) ? $hash->{NAME} : $hash;
  69. Log3 $instName, $loglevel, "$MODUL $instName: $sub.$xline " . $text;
  70. }
  71. ########################################
  72. sub UWZ_Map2Movie($$) {
  73. my $uwz_movie_url = "http://www.meteocentrale.ch/uploads/media/";
  74. my ( $hash, $smap ) = @_;
  75. my $lmap;
  76. $smap=lc($smap);
  77. ## Euro
  78. $lmap->{'niederschlag-wolken'}=$uwz_movie_url.'UWZ_EUROPE_COMPLETE_niwofi.mp4';
  79. $lmap->{'stroemung'}=$uwz_movie_url.'UWZ_EUROPE_COMPLETE_stfi.mp4';
  80. $lmap->{'temperatur'}=$uwz_movie_url.'UWZ_EUROPE_COMPLETE_theta_E.mp4';
  81. ## DE
  82. $lmap->{'niederschlag-wolken-de'}=$uwz_movie_url.'UWZ_EUROPE_GERMANY_COMPLETE_niwofi.mp4';
  83. $lmap->{'stroemung-de'}=$uwz_movie_url.'UWZ_EUROPE_GERMANY_COMPLETE_stfi.mp4';
  84. ## CH
  85. $lmap->{'niederschlag-wolken-ch'}=$uwz_movie_url.'UWZ_EUROPE_SWITZERLAND_COMPLETE_niwofi.mp4';
  86. $lmap->{'stroemung-ch'}=$uwz_movie_url.'UWZ_EUROPE_SWITZERLAND_COMPLETE_stfi.mp4';
  87. ## AT
  88. $lmap->{'niederschlag-wolken-at'}=$uwz_movie_url.'UWZ_EUROPE_AUSTRIA_COMPLETE_niwofi.mp4';
  89. $lmap->{'stroemung-at'}=$uwz_movie_url.'UWZ_EUROPE_AUSTRIA_COMPLETE_stfi.mp4';
  90. ## UK
  91. $lmap->{'clouds-precipitation-uk'}=$uwz_movie_url.'UWZ_EUROPE_GREATBRITAIN_COMPLETE_niwofi.mp4';
  92. $lmap->{'currents-uk'}=$uwz_movie_url.'UWZ_EUROPE_GREATBRITAIN_COMPLETE_stfi.mp4';
  93. return $lmap->{$smap};
  94. }
  95. ########################################
  96. sub UWZ_Map2Image($$) {
  97. my $uwz_de_url = "http://www.unwetterzentrale.de/images/map/";
  98. my $uwz_at_url = "http://unwetter.wetteralarm.at/images/map/";
  99. my $uwz_ch_url = "http://alarm.meteocentrale.ch/images/map/";
  100. my $uwz_en_url = "http://warnings.severe-weather-centre.co.uk/images/map/";
  101. my $uwz_li_url = "http://alarm.meteocentrale.li/images/map/";
  102. my $uwz_be_url = "http://alarm.meteo-info.be/images/map/";
  103. my $uwz_dk_url = "http://alarm.vejrcentral.dk/images/map/";
  104. my $uwz_fi_url = "http://vaaratasot.saa-varoitukset.fi/images/map/";
  105. my $uwz_fr_url = "http://alerte.vigilance-meteo.fr/images/map/";
  106. my $uwz_lu_url = "http://alarm.meteozentral.lu/images/map/";
  107. my $uwz_nl_url = "http://alarm.noodweercentrale.nl/images/map/";
  108. my $uwz_no_url = "http://advarsler.vaer-sentral.no/images/map/";
  109. my $uwz_pt_url = "http://avisos.centrometeo.pt/images/map/";
  110. my $uwz_se_url = "http://varningar.vader-alarm.se/images/map/";
  111. my $uwz_es_url = "http://avisos.alertas-tiempo.es/images/map/";
  112. my ( $hash, $smap ) = @_;
  113. my $lmap;
  114. $smap=lc($smap);
  115. ## Euro
  116. $lmap->{'europa'}=$uwz_de_url.'europe_index.png';
  117. ## DE
  118. $lmap->{'deutschland'}=$uwz_de_url.'deutschland_index.png';
  119. $lmap->{'deutschland-small'}=$uwz_de_url.'deutschland_preview.png';
  120. $lmap->{'niedersachsen'}=$uwz_de_url.'niedersachsen_index.png';
  121. $lmap->{'bremen'}=$uwz_de_url.'niedersachsen_index.png';
  122. $lmap->{'bayern'}=$uwz_de_url.'bayern_index.png';
  123. $lmap->{'schleswig-holstein'}=$uwz_de_url.'schleswig_index.png';
  124. $lmap->{'hamburg'}=$uwz_de_url.'schleswig_index.png';
  125. $lmap->{'mecklenburg-vorpommern'}=$uwz_de_url.'meckpom_index.png';
  126. $lmap->{'sachsen'}=$uwz_de_url.'sachsen_index.png';
  127. $lmap->{'sachsen-anhalt'}=$uwz_de_url.'sachsenanhalt_index.png';
  128. $lmap->{'nordrhein-westfalen'}=$uwz_de_url.'nrw_index.png';
  129. $lmap->{'thueringen'}=$uwz_de_url.'thueringen_index.png';
  130. $lmap->{'rheinland-pfalz'}=$uwz_de_url.'rlp_index.png';
  131. $lmap->{'saarland'}=$uwz_de_url.'rlp_index.png';
  132. $lmap->{'baden-wuerttemberg'}=$uwz_de_url.'badenwuerttemberg_index.png';
  133. $lmap->{'hessen'}=$uwz_de_url.'hessen_index.png';
  134. $lmap->{'brandenburg'}=$uwz_de_url.'brandenburg_index.png';
  135. $lmap->{'berlin'}=$uwz_de_url.'brandenburg_index.png';
  136. ## AT
  137. $lmap->{'oesterreich'}=$uwz_at_url.'oesterreich_index.png';
  138. $lmap->{'burgenland'}=$uwz_at_url.'burgenland_index.png';
  139. $lmap->{'kaernten'}=$uwz_at_url.'kaernten_index.png';
  140. $lmap->{'niederoesterreich'}=$uwz_at_url.'niederoesterreich_index.png';
  141. $lmap->{'oberoesterreich'}=$uwz_at_url.'oberoesterreich_index.png';
  142. $lmap->{'salzburg'}=$uwz_at_url.'salzburg_index.png';
  143. $lmap->{'steiermark'}=$uwz_at_url.'steiermark_index.png';
  144. $lmap->{'tirol'}=$uwz_at_url.'tirol_index.png';
  145. $lmap->{'vorarlberg'}=$uwz_at_url.'vorarlberg_index.png';
  146. $lmap->{'wien'}=$uwz_at_url.'wien_index.png';
  147. ## CH
  148. $lmap->{'schweiz'}=$uwz_ch_url.'schweiz_index.png';
  149. $lmap->{'aargau'}=$uwz_ch_url.'aargau_index.png';
  150. $lmap->{'appenzell_ausserrhoden'}=$uwz_ch_url.'appenzell_ausserrhoden_index.png';
  151. $lmap->{'appenzell_innerrhoden'}=$uwz_ch_url.'appenzell_innerrhoden_index.png';
  152. $lmap->{'basel_landschaft'}=$uwz_ch_url.'basel_landschaft_index.png';
  153. $lmap->{'basel_stadt'}=$uwz_ch_url.'basel_stadt_index.png';
  154. $lmap->{'bern'}=$uwz_ch_url.'bern_index.png';
  155. $lmap->{'fribourg'}=$uwz_ch_url.'fribourg_index.png';
  156. $lmap->{'geneve'}=$uwz_ch_url.'geneve_index.png';
  157. $lmap->{'glarus'}=$uwz_ch_url.'glarus_index.png';
  158. $lmap->{'graubuenden'}=$uwz_ch_url.'graubuenden_index.png';
  159. $lmap->{'jura'}=$uwz_ch_url.'jura_index.png';
  160. $lmap->{'luzern'}=$uwz_ch_url.'luzern_index.png';
  161. $lmap->{'neuchatel'}=$uwz_ch_url.'neuchatel_index.png';
  162. $lmap->{'nidwalden'}=$uwz_ch_url.'nidwalden_index.png';
  163. $lmap->{'obwalden'}=$uwz_ch_url.'obwalden_index.png';
  164. $lmap->{'schaffhausen'}=$uwz_ch_url.'schaffhausen_index.png';
  165. $lmap->{'schwyz'}=$uwz_ch_url.'schwyz_index.png';
  166. $lmap->{'solothurn'}=$uwz_ch_url.'solothurn_index.png';
  167. $lmap->{'stgallen'}=$uwz_ch_url.'stgallen_index.png';
  168. $lmap->{'ticino'}=$uwz_ch_url.'ticino_index.png';
  169. $lmap->{'thurgau'}=$uwz_ch_url.'thurgau_index.png';
  170. $lmap->{'uri'}=$uwz_ch_url.'uri_index.png';
  171. $lmap->{'waadt'}=$uwz_ch_url.'waadt_index.png';
  172. $lmap->{'wallis'}=$uwz_ch_url.'wallis_index.png';
  173. $lmap->{'zug'}=$uwz_ch_url.'zug_index.png';
  174. $lmap->{'zuerich'}=$uwz_ch_url.'zuerich_index.png';
  175. ## LI
  176. $lmap->{'liechtenstein'}=$uwz_li_url.'liechtenstein_index.png';
  177. ## UK
  178. $lmap->{'unitedkingdom'}=$uwz_en_url.'unitedkingdom_index.png';
  179. $lmap->{'eastofengland'}=$uwz_en_url.'eastofengland_index.png';
  180. $lmap->{'eastmidlands'}=$uwz_en_url.'eastmidlands-index.png';
  181. $lmap->{'london'}=$uwz_en_url.'london-index.png';
  182. $lmap->{'northeastengland'}=$uwz_en_url.'northeastengland-index.png';
  183. $lmap->{'northernireland'}=$uwz_en_url.'northernireland-index.png';
  184. $lmap->{'northwestengland'}=$uwz_en_url.'northwestengland-index.png';
  185. $lmap->{'scotland'}=$uwz_en_url.'scotland-index.png';
  186. $lmap->{'southeastengland'}=$uwz_en_url.'southeastengland-index.png';
  187. $lmap->{'southwestengland'}=$uwz_en_url.'southwestengland-index.png';
  188. $lmap->{'wales'}=$uwz_en_url.'wales-index.png';
  189. $lmap->{'westmidlands'}=$uwz_en_url.'westmidlands-index.png';
  190. $lmap->{'yorkshireandthehumber'}=$uwz_en_url.'yorkshireandthehumber-index.png';
  191. ## BE
  192. $lmap->{'belgique'}=$uwz_be_url.'belgique_index.png';
  193. ## DK
  194. $lmap->{'denmark'}=$uwz_dk_url.'denmark_index.png';
  195. ## FI
  196. $lmap->{'finnland'}=$uwz_fi_url.'finnland_index.png';
  197. ## FR
  198. $lmap->{'france'}=$uwz_fr_url.'france_index.png';
  199. ## LU
  200. $lmap->{'letzebuerg'}=$uwz_lu_url.'letzebuerg_index.png';
  201. ## NL
  202. $lmap->{'nederland'}=$uwz_nl_url.'nederland_index.png';
  203. ## NO
  204. $lmap->{'norwegen'}=$uwz_no_url.'norwegen_index.png';
  205. ## PT
  206. $lmap->{'portugal'}=$uwz_pt_url.'portugal_index.png';
  207. ## SE
  208. $lmap->{'sverige'}=$uwz_se_url.'sverige_index.png';
  209. ## ES
  210. $lmap->{'espana'}=$uwz_es_url.'espana_index.png';
  211. ## Isobaren
  212. $lmap->{'isobaren1'}="http://www.unwetterzentrale.de/images/icons/UWZ_ISO_00.jpg";
  213. $lmap->{'isobaren2'}="http://www.wetteralarm.at/uploads/pics/UWZ_EURO_ISO_GER_00.jpg";
  214. $lmap->{'isobaren3'}="http://www.severe-weather-centre.co.uk/uploads/pics/UWZ_EURO_ISO_ENG_00.jpg";
  215. return $lmap->{$smap};
  216. }
  217. ###################################
  218. sub UWZ_Initialize($) {
  219. my ($hash) = @_;
  220. $hash->{DefFn} = "UWZ_Define";
  221. $hash->{UndefFn} = "UWZ_Undef";
  222. $hash->{SetFn} = "UWZ_Set";
  223. $hash->{GetFn} = "UWZ_Get";
  224. $hash->{AttrList} = "download:0,1 ".
  225. "savepath ".
  226. "maps ".
  227. "humanreadable:0,1 ".
  228. "htmlattr ".
  229. "htmltitle ".
  230. "htmltitleclass ".
  231. "htmlsequence:ascending,descending ".
  232. "lang ".
  233. "sort_readings_by:severity,start ".
  234. "localiconbase ".
  235. $readingFnAttributes;
  236. foreach my $d(sort keys %{$modules{UWZ}{defptr}}) {
  237. my $hash = $modules{UWZ}{defptr}{$d};
  238. $hash->{VERSION} = $version;
  239. }
  240. }
  241. ###################################
  242. sub UWZ_Define($$) {
  243. my ( $hash, $def ) = @_;
  244. my $name = $hash->{NAME};
  245. my $lang = "";
  246. my @a = split( "[ \t][ \t]*", $def );
  247. return "Error: Perl moduls ".$missingModul."are missing on this system" if( $missingModul );
  248. return "Wrong syntax: use define <name> UWZ <CountryCode> <PLZ> <Interval> " if (int(@a) != 5 and ((lc $a[2]) ne "search"));
  249. if ((lc $a[2]) ne "search") {
  250. $hash->{STATE} = "Initializing";
  251. $hash->{CountryCode} = $a[2];
  252. $hash->{PLZ} = $a[3];
  253. ## URL by CountryCode
  254. my $URL_language="en";
  255. if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
  256. $URL_language="de";
  257. }
  258. $hash->{URL} = "http://feed.alertspro.meteogroup.com/AlertsPro/AlertsProPollService.php?method=getWarning&language=" . $URL_language . "&areaID=UWZ" . $a[2] . $a[3];
  259. $hash->{fhem}{LOCAL} = 0;
  260. $hash->{INTERVAL} = $a[4];
  261. $hash->{VERSION} = $version;
  262. RemoveInternalTimer($hash);
  263. #Get first data after 12 seconds
  264. InternalTimer( gettimeofday() + 12, "UWZ_Start", $hash, 0 ) if ((lc $hash->{CountryCode}) ne "search");
  265. } else {
  266. $hash->{STATE} = "Search-Mode";
  267. $hash->{CountryCode} = uc $a[2];
  268. $hash->{VERSION} = $version;
  269. }
  270. return undef;
  271. }
  272. #####################################
  273. sub UWZ_Undef($$) {
  274. my ( $hash, $arg ) = @_;
  275. RemoveInternalTimer( $hash );
  276. BlockingKill( $hash->{helper}{RUNNING_PID} ) if ( defined( $hash->{helper}{RUNNING_PID} ) );
  277. return undef;
  278. }
  279. #####################################
  280. sub UWZ_Set($@) {
  281. my ( $hash, @a ) = @_;
  282. my $name = $hash->{NAME};
  283. my $reUINT = '^([\\+]?\\d+)$';
  284. my $usage = "Unknown argument $a[1], choose one of update:noArg " if ( (lc $hash->{CountryCode}) ne "search" );
  285. return $usage if ( @a < 2 );
  286. my $cmd = lc( $a[1] );
  287. given ($cmd)
  288. {
  289. when ("?")
  290. {
  291. return $usage;
  292. }
  293. when ("update")
  294. {
  295. UWZ_Log $hash, 4, "set command: " . $a[1];
  296. $hash->{fhem}{LOCAL} = 1;
  297. UWZ_Start($hash);
  298. $hash->{fhem}{LOCAL} = 0;
  299. }
  300. default
  301. {
  302. return $usage;
  303. }
  304. }
  305. return;
  306. }
  307. sub UWZ_Get($@) {
  308. my ( $hash, @a ) = @_;
  309. my $name = $hash->{NAME};
  310. if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
  311. my $usage = "Unknown argument $a[1], choose one of Sturm:noArg Schneefall:noArg Regen:noArg Extremfrost:noArg Waldbrand:noArg Gewitter:noArg Glaette:noArg Hitze:noArg Glatteisregen:noArg Bodenfrost:noArg Hagel:noArg ";
  312. return $usage if ( @a < 2 );
  313. if ($a[1] =~ /^Sturm/) { UWZ_GetCurrent($hash,2); }
  314. elsif ($a[1] =~ /^Schneefall/) { UWZ_GetCurrent($hash,3); }
  315. elsif ($a[1] =~ /^Regen/) { UWZ_GetCurrent($hash,4); }
  316. elsif ($a[1] =~ /^Extremfrost/) { UWZ_GetCurrent($hash,5); }
  317. elsif ($a[1] =~ /^Waldbrand/) { UWZ_GetCurrent($hash,6); }
  318. elsif ($a[1] =~ /^Gewitter/) { UWZ_GetCurrent($hash,7); }
  319. elsif ($a[1] =~ /^Glaette/) { UWZ_GetCurrent($hash,8); }
  320. elsif ($a[1] =~ /^Hitze/) { UWZ_GetCurrent($hash,9); }
  321. elsif ($a[1] =~ /^Glatteisregen/) { UWZ_GetCurrent($hash,10); }
  322. elsif ($a[1] =~ /^Bodenfrost/) { UWZ_GetCurrent($hash,11); }
  323. elsif ($a[1] =~ /^Hagel/) { UWZ_GetCurrentHail($hash); }
  324. else { return $usage; }
  325. }
  326. elsif ( (lc $hash->{CountryCode}) eq 'search' ) {
  327. my $usage = "Unknown argument $a[1], choose one of SearchAreaID ";
  328. return $usage if ( @a < 3 );
  329. if ($a[1] =~ /^SearchAreaID/) { UWZSearchLatLon($name, $a[2]); }
  330. elsif ($a[1] =~ /^AreaID/) { my @splitparam = split(/,/,$a[2]); UWZSearchAreaID($splitparam[0],$splitparam[1]); }
  331. else { return $usage; }
  332. } else {
  333. my $usage = "Unknown argument $a[1], choose one of storm:noArg snow:noArg rain:noArg extremfrost:noArg forest-fire:noArg thunderstorms:noArg glaze:noArg heat:noArg glazed-rain:noArg soil-frost:noArg hail:noArg ";
  334. return $usage if ( @a < 2 );
  335. if ($a[1] =~ /^storm/) { UWZ_GetCurrent($hash,2); }
  336. elsif ($a[1] =~ /^snow/) { UWZ_GetCurrent($hash,3); }
  337. elsif ($a[1] =~ /^rain/) { UWZ_GetCurrent($hash,4); }
  338. elsif ($a[1] =~ /^extremfrost/) { UWZ_GetCurrent($hash,5); }
  339. elsif ($a[1] =~ /^forest-fire/) { UWZ_GetCurrent($hash,6); }
  340. elsif ($a[1] =~ /^thunderstorms/) { UWZ_GetCurrent($hash,7); }
  341. elsif ($a[1] =~ /^glaze/) { UWZ_GetCurrent($hash,8); }
  342. elsif ($a[1] =~ /^heat/) { UWZ_GetCurrent($hash,9); }
  343. elsif ($a[1] =~ /^glazed-rain/) { UWZ_GetCurrent($hash,10); }
  344. elsif ($a[1] =~ /^soil-frost/) { UWZ_GetCurrent($hash,11); }
  345. elsif ($a[1] =~ /^hail/) { UWZ_GetCurrentHail($hash); }
  346. else { return $usage; }
  347. }
  348. }
  349. #####################################
  350. sub UWZ_GetCurrent($@) {
  351. my ( $hash, @a ) = @_;
  352. my $name = $hash->{NAME};
  353. my $out;
  354. my $curTimestamp = time();
  355. if ( ReadingsVal($name,"WarnCount", 0) eq 0 ) {
  356. $out = "inactive";
  357. } else {
  358. for(my $i= 0;$i < ReadingsVal($name,"WarnCount", 0);$i++) {
  359. if ( (ReadingsVal($name,"Warn_".$i."_Start","") le $curTimestamp) && (ReadingsVal($name,"Warn_".$i."_End","") ge $curTimestamp) && (ReadingsVal($name,"Warn_".$i."_Type","") eq $a[0]) ) {
  360. $out= "active";
  361. last;
  362. } else {
  363. $out = "inactive";
  364. }
  365. }
  366. }
  367. return $out;
  368. }
  369. #####################################
  370. sub UWZ_GetCurrentHail($) {
  371. my ( $hash ) = @_;
  372. my $name = $hash->{NAME};
  373. my $out;
  374. my $curTimestamp = time();
  375. if ( ReadingsVal($name,"WarnCount", 0) eq 0 ) {
  376. $out = "inactive";
  377. } else {
  378. for(my $i= 0;$i < ReadingsVal($name,"WarnCount", 0);$i++) {
  379. if ( (ReadingsVal($name,"Warn_".$i."_Start","") le $curTimestamp) && (ReadingsVal($name,"Warn_".$i."_End","") ge $curTimestamp) && (ReadingsVal($name,"Warn_".$i."_Hail","") eq 1) ) {
  380. $out= "active";
  381. last;
  382. } else {
  383. $out= "inactive";
  384. }
  385. }
  386. }
  387. return $out;
  388. }
  389. #####################################
  390. sub UWZ_JSONAcquire($$) {
  391. my ($hash, $URL) = @_;
  392. my $name = $hash->{NAME};
  393. return unless (defined($hash->{NAME}));
  394. UWZ_Log $hash, 4, "Start capturing of $URL";
  395. my $err_log = "";
  396. my $agent = LWP::UserAgent->new( env_proxy => 1, keep_alive => 1, protocols_allowed => ['http'], timeout => 10 );
  397. my $request = HTTP::Request->new( GET => $URL );
  398. my $response = $agent->request($request);
  399. $err_log = "Can't get $URL -- " . $response->status_line unless( $response->is_success );
  400. if ( $err_log ne "" ) {
  401. readingsSingleUpdate($hash, "lastConnection", $response->status_line, 1);
  402. UWZ_Log $hash, 1, "Error: $err_log";
  403. return "Error|Error " . $response->status_line;
  404. }
  405. UWZ_Log $hash, 4, length($response->content)." characters captured";
  406. return $response->content;
  407. }
  408. #####################################
  409. sub UWZ_Start($) {
  410. my ($hash) = @_;
  411. my $name = $hash->{NAME};
  412. return unless (defined($hash->{NAME}));
  413. if(!$hash->{fhem}{LOCAL} && $hash->{INTERVAL} > 0) { # set up timer if automatically call
  414. RemoveInternalTimer( $hash );
  415. InternalTimer(gettimeofday() + $hash->{INTERVAL}, "UWZ_Start", $hash, 1 );
  416. return undef if( AttrVal($name, "disable", 0 ) == 1 );
  417. }
  418. ## URL by CountryCode
  419. my $URL_language="en";
  420. if (AttrVal($hash->{NAME}, "lang", undef) ) {
  421. $URL_language=AttrVal($hash->{NAME}, "lang", "");
  422. } else {
  423. if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
  424. $URL_language="de";
  425. }
  426. }
  427. $hash->{URL} = "http://feed.alertspro.meteogroup.com/AlertsPro/AlertsProPollService.php?method=getWarning&language=" . $URL_language . "&areaID=UWZ" . $hash->{CountryCode} . $hash->{PLZ};
  428. if ( not defined( $hash->{URL} ) ) {
  429. UWZ_Log $hash, 3, "missing URL";
  430. return;
  431. }
  432. $hash->{helper}{RUNNING_PID} =
  433. BlockingCall(
  434. "UWZ_Run", # callback worker task
  435. $name, # name of the device
  436. "UWZ_Done", # callback result method
  437. 120, # timeout seconds
  438. "UWZ_Aborted", # callback for abortion
  439. $hash ); # parameter for abortion
  440. }
  441. #####################################
  442. sub UWZ_Aborted($) {
  443. my ($hash) = @_;
  444. delete( $hash->{helper}{RUNNING_PID} );
  445. }
  446. #####################################
  447. # asyncronous callback by blocking
  448. sub UWZ_Done($) {
  449. my ($string) = @_;
  450. return unless ( defined($string) );
  451. # all term are separated by "|" , the first is the name of the instance
  452. my ( $name, %values ) = split( "\\|", $string );
  453. my $hash = $defs{$name};
  454. return unless ( defined($hash->{NAME}) );
  455. # delete the marker for RUNNING_PID process
  456. delete( $hash->{helper}{RUNNING_PID} );
  457. UWZ_Log $hash, 4, "Delete old Readings";
  458. #CommandDeleteReading(undef, "$hash->{NAME} Warn_?_.*");
  459. # UnWetterdaten speichern
  460. readingsBeginUpdate($hash);
  461. if ( defined $values{Error} ) {
  462. readingsBulkUpdate( $hash, "lastConnection", $values{Error} );
  463. } else {
  464. while (my ($rName, $rValue) = each(%values) ) {
  465. readingsBulkUpdate( $hash, $rName, $rValue );
  466. UWZ_Log $hash, 5, "reading:$rName value:$rValue";
  467. }
  468. if (keys %values > 0) {
  469. my $newState;
  470. for my $Counter ($values{WarnCount} .. 9) {
  471. CommandDeleteReading(undef, "$hash->{NAME} Warn_${Counter}_.*");
  472. }
  473. if (defined $values{WarnCount}) {
  474. # Message by CountryCode
  475. $newState = "Warnings: " . $values{WarnCount};
  476. $newState = "Warnungen: " . $values{WarnCount} if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] );
  477. # end Message by CountryCode
  478. } else {
  479. $newState = "Error: Could not capture all data. Please check CountryCode and PLZ.";
  480. }
  481. readingsBulkUpdate($hash, "state", $newState);
  482. readingsBulkUpdate( $hash, "lastConnection", keys( %values )." values captured in ".$values{durationFetchReadings}." s" );
  483. UWZ_Log $hash, 4, keys( %values )." values captured";
  484. } else {
  485. readingsBulkUpdate( $hash, "lastConnection", "no data found" );
  486. UWZ_Log $hash, 1, "No data found. Check city name or URL.";
  487. }
  488. }
  489. readingsEndUpdate( $hash, 1 );
  490. }
  491. #####################################
  492. sub UWZ_Run($) {
  493. my ($name) = @_;
  494. my $ptext=$name;
  495. my $UWZ_download;
  496. my $UWZ_savepath;
  497. my $UWZ_humanreadable;
  498. return unless ( defined($name) );
  499. my $hash = $defs{$name};
  500. return unless (defined($hash->{NAME}));
  501. my $readingStartTime = time();
  502. my $attrdownload = AttrVal( $name, 'download','');
  503. my $attrsavepath = AttrVal( $name, 'savepath','');
  504. my $maps2fetch = AttrVal( $name, 'maps','');
  505. ## begin redundant Reading switch
  506. my $attrhumanreadable = AttrVal( $name, 'humanreadable','');
  507. ## end redundant Reading switch
  508. # preset download
  509. if ($attrdownload eq "") {
  510. $UWZ_download = 0;
  511. } else {
  512. $UWZ_download = $attrdownload;
  513. }
  514. # preset savepath
  515. if ($attrsavepath eq "") {
  516. $UWZ_savepath = "/tmp/";
  517. } else {
  518. $UWZ_savepath = $attrsavepath;
  519. }
  520. # preset humanreadable
  521. if ($attrhumanreadable eq "") {
  522. $UWZ_humanreadable = 0;
  523. } else {
  524. $UWZ_humanreadable = $attrhumanreadable;
  525. }
  526. if ( $UWZ_download == 1 ) {
  527. if ( ! defined($maps2fetch) ) { $maps2fetch = "deutschland"; }
  528. UWZ_Log $hash, 4, "Maps2Fetch : ".$maps2fetch;
  529. my @maps = split(' ', $maps2fetch);
  530. my $uwz_de_url = "http://www.unwetterzentrale.de/images/map/";
  531. foreach my $smap (@maps) {
  532. UWZ_Log $hash, 4, "Download map : ".$smap;
  533. my $img = UWZ_Map2Image($hash,$smap);
  534. if (!defined($img) ) { $img=$uwz_de_url.'deutschland_index.png'; }
  535. my $code = getstore($img, $UWZ_savepath.$smap.".png");
  536. if($code == 200) {
  537. UWZ_Log $hash, 4, "Successfully downloaded map ".$smap;
  538. } else {
  539. UWZ_Log $hash, 3, "Failed to download map (".$img.")";
  540. }
  541. }
  542. }
  543. # acquire the json-response
  544. my $response = UWZ_JSONAcquire($hash,$hash->{URL});
  545. UWZ_Log $hash, 5, length($response)." characters captured";
  546. my $converter = Text::Iconv->new("windows-1252","UTF-8");
  547. my $uwz_warnings = JSON->new->ascii->decode($response);
  548. my $enc = guess_encoding($uwz_warnings);
  549. my $uwz_warncount = scalar(@{ $uwz_warnings->{'results'} });
  550. UWZ_Log $hash, 4, "There are ".$uwz_warncount." warnings active";
  551. my $sortby = AttrVal( $name, 'sort_readings_by',"" );
  552. my @sorted;
  553. if ( $sortby ne "severity" ) {
  554. UWZ_Log $hash, 4, "Sorting by dtgStart";
  555. @sorted = sort { $a->{dtgStart} <=> $b->{dtgStart} } @{ $uwz_warnings->{'results'} };
  556. } else {
  557. UWZ_Log $hash, 4, "Sorting by severity";
  558. @sorted = sort { $a->{severity} <=> $b->{severity} } @{ $uwz_warnings->{'results'} };
  559. }
  560. my $message;
  561. my $i=0;
  562. my %typenames = ( "1" => "unknown", # <===== FIX HERE
  563. "2" => "sturm",
  564. "3" => "schnee",
  565. "4" => "regen",
  566. "5" => "temperatur",
  567. "6" => "waldbrand",
  568. "7" => "gewitter",
  569. "8" => "strassenglaette",
  570. "9" => "temperatur", # 9 = hitzewarnung
  571. "10" => "glatteisregen",
  572. "11" => "temperatur" ); # 11 = bodenfrost
  573. my %typenames_de_str= ( "1" => "unknown", # <===== FIX HERE
  574. "2" => "Sturm",
  575. "3" => "Schnee",
  576. "4" => "Regen",
  577. "5" => "Temperatur",
  578. "6" => "Waldbrand",
  579. "7" => "Gewitter",
  580. "8" => "Strassenglaette",
  581. "9" => "Hitze", # 9 = hitzewarnung
  582. "10" => "Glatteisregen",
  583. "11" => "Bodenfrost" ); # 11 = bodenfrost
  584. my %typenames_en_str= ( "1" => "unknown", # <===== FIX HERE
  585. "2" => "storm",
  586. "3" => "snow",
  587. "4" => "rain",
  588. "5" => "temperatur",
  589. "6" => "forest fire",
  590. "7" => "thunderstorms",
  591. "8" => "slippery road",
  592. "9" => "heat", # 9 = hitzewarnung
  593. "10" => "black ice rain",
  594. "11" => "soil frost" ); # 11 = bodenfrost
  595. my %severitycolor = ( "0" => "green",
  596. "1" => "unknown", # <===== FIX HERE
  597. "2" => "unknown", # <===== FIX HERE
  598. "3" => "unknown", # <===== FIX HERE
  599. "4" => "orange",
  600. "5" => "unknown", # <===== FIX HERE
  601. "6" => "unknown", # <===== FIX HERE
  602. "7" => "orange",
  603. "8" => "gelb",
  604. "9" => "gelb", # <===== FIX HERE
  605. "10" => "orange",
  606. "11" => "rot",
  607. "12" => "violett" );
  608. my @uwzmaxlevel;
  609. #foreach my $single_warning (@{ $uwz_warnings->{'results'} }) {
  610. foreach my $single_warning (@sorted) {
  611. push @uwzmaxlevel, UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'});
  612. UWZ_Log $hash, 4, "Warn_".$i."_EventID: ".$single_warning->{'payload'}{'id'};
  613. $message .= "Warn_".$i."_EventID|".$single_warning->{'payload'}{'id'}."|";
  614. my $chopcreation = substr($single_warning->{'payload'}{'creation'},0,10);
  615. $chopcreation = $chopcreation;
  616. UWZ_Log $hash, 4, "Warn_".$i."_Creation: ".$chopcreation;
  617. $message .= "Warn_".$i."_Creation|".$chopcreation."|";
  618. UWZ_Log $hash, 4, "Warn_".$i."_Type: ".$single_warning->{'type'};
  619. $message .= "Warn_".$i."_Type|".$single_warning->{'type'}."|";
  620. UWZ_Log $hash, 4, "Warn_".$i."_uwzLevel: ".UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'});
  621. $message .= "Warn_".$i."_uwzLevel|".UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'})."|";
  622. UWZ_Log $hash, 4, "Warn_".$i."_Severity: ".$single_warning->{'severity'};
  623. $message .= "Warn_".$i."_Severity|".$single_warning->{'severity'}."|";
  624. UWZ_Log $hash, 4, "Warn_".$i."_Start: ".$single_warning->{'dtgStart'};
  625. $message .= "Warn_".$i."_Start|".$single_warning->{'dtgStart'}."|";
  626. UWZ_Log $hash, 4, "Warn_".$i."_End: ".$single_warning->{'dtgEnd'};
  627. $message .= "Warn_".$i."_End|".$single_warning->{'dtgEnd'}."|";
  628. ## Begin of redundant Reading
  629. if ( $UWZ_humanreadable eq 1 ) {
  630. UWZ_Log $hash, 4, "Warn_".$i."_Start_Date: ".strftime("%d.%m.%Y", localtime($single_warning->{'dtgStart'}));
  631. $message .= "Warn_".$i."_Start_Date|".strftime("%d.%m.%Y", localtime($single_warning->{'dtgStart'}))."|";
  632. UWZ_Log $hash, 4, "Warn_".$i."_Start_Time: ".strftime("%H:%M", localtime($single_warning->{'dtgStart'}));
  633. $message .= "Warn_".$i."_Start_Time|".strftime("%H:%M", localtime($single_warning->{'dtgStart'}))."|";
  634. UWZ_Log $hash, 4, "Warn_".$i."_End_Date: ".strftime("%d.%m.%Y", localtime($single_warning->{'dtgEnd'}));
  635. $message .= "Warn_".$i."_End_Date|".strftime("%d.%m.%Y", localtime($single_warning->{'dtgEnd'}))."|";
  636. UWZ_Log $hash, 4, "Warn_".$i."_End_Time: ".strftime("%H:%M", localtime($single_warning->{'dtgEnd'}));
  637. $message .= "Warn_".$i."_End_Time|".strftime("%H:%M", localtime($single_warning->{'dtgEnd'}))."|";
  638. UWZ_Log $hash, 4, "Warn_".$i."_Creation_Date: ".strftime("%d.%m.%Y", localtime($chopcreation));
  639. $message .= "Warn_".$i."_Creation_Date|".strftime("%d.%m.%Y", localtime($chopcreation))."|";
  640. UWZ_Log $hash, 4, "Warn_".$i."_Creation_Time: ".strftime("%H:%M", localtime($chopcreation));
  641. $message .= "Warn_".$i."_Creation_Time|".strftime("%H:%M", localtime($chopcreation))."|";
  642. # Begin Language by AttrVal
  643. if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
  644. UWZ_Log $hash, 4, "Warn_".$i."_Type_Str: ".$typenames_de_str{ $single_warning->{'type'} };
  645. $message .= "Warn_".$i."_Type_Str|".$typenames_de_str{ $single_warning->{'type'} }."|";
  646. my %uwzlevelname = ( "0" => "Stufe Grün (keine Warnung)",
  647. "1" => "Stufe Dunkelgrün (Wetterhinweise)",
  648. "2" => "Stufe Gelb (Vorwarnung für Unwetterwarnung)",
  649. "3" => "Warnstufe Orange (Unwetterwarnung)",
  650. "4" => "Warnstufe Rot (Unwetterwarnung)",
  651. "5" => "Warnstufe Violett (Unwetterwarnung)");
  652. UWZ_Log $hash, 4, "Warn_".$i."_uwzLevel_Str: ".$uwzlevelname{ UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'}) };
  653. $message .= "Warn_".$i."_uwzLevel_Str|".$uwzlevelname{ UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'}) }."|";
  654. } else {
  655. UWZ_Log $hash, 4, "Warn_".$i."_Type_Str: ".$typenames_en_str{ $single_warning->{'type'} };
  656. $message .= "Warn_".$i."_Type_Str|".$typenames_en_str{ $single_warning->{'type'} }."|";
  657. my %uwzlevelname = ( "0" => "level green (no warnings)",
  658. "1" => "level dark green (weather notice)",
  659. "2" => "level yellow (severe weather watch)",
  660. "3" => "Alert level Orange",
  661. "4" => "Alert level Red",
  662. "5" => "Alert level Violet");
  663. UWZ_Log $hash, 4, "Warn_".$i."_uwzLevel_Str: ".$uwzlevelname{ UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'}) };
  664. $message .= "Warn_".$i."_uwzLevel_Str|".$uwzlevelname{ UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'}) }."|";
  665. }
  666. }
  667. ## End of redundant Reading
  668. UWZ_Log $hash, 4, "Warn_".$i."_levelName: ".$single_warning->{'payload'}{'levelName'};
  669. $message .= "Warn_".$i."_levelName|".$single_warning->{'payload'}{'levelName'}."|";
  670. UWZ_Log $hash, 4, "Warn_".$i."_AltitudeMin: ".$enc->decode($single_warning->{'payload'}{'altMin'});
  671. $message .= "Warn_".$i."_AltitudeMin|".$converter->convert($single_warning->{'payload'}{'altMin'})."|";
  672. UWZ_Log $hash, 4, "Warn_".$i."_AltitudeMax: ".$enc->decode($single_warning->{'payload'}{'altMax'});
  673. $message .= "Warn_".$i."_AltitudeMax|".$converter->convert($single_warning->{'payload'}{'altMax'})."|";
  674. my $uclang = "EN";
  675. if (AttrVal( $name, 'lang',undef) ) {
  676. $uclang = uc AttrVal( $name, 'lang','');
  677. } else {
  678. # Begin Language by AttrVal
  679. if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
  680. $uclang = "DE";
  681. } else {
  682. $uclang = "EN";
  683. }
  684. }
  685. UWZ_Log $hash, 4, "Warn_".$i."_LongText: ".$enc->decode($single_warning->{'payload'}{'translationsLongText'}{$uclang});
  686. $message .= "Warn_".$i."_LongText|".$converter->convert($single_warning->{'payload'}{'translationsLongText'}{$uclang})."|";
  687. UWZ_Log $hash, 4, "Warn_".$i."_ShortText: ".$enc->decode($single_warning->{'payload'}{'translationsShortText'}{$uclang});
  688. $message .= "Warn_".$i."_ShortText|".$converter->convert($single_warning->{'payload'}{'translationsShortText'}{$uclang})."|";
  689. ###
  690. if (AttrVal( $name, 'localiconbase',undef) ) {
  691. UWZ_Log $hash, 4, "Warn_".$i."_IconURL: ".AttrVal( $name, 'localiconbase',undef).$typenames{ $single_warning->{'type'} }."-".$single_warning->{'severity'}.".png";
  692. $message .= "Warn_".$i."_IconURL|".AttrVal( $name, 'localiconbase',undef).$typenames{ $single_warning->{'type'} }."-".UWZ_GetSeverityColor($hash, UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'} )).".png|";
  693. } else {
  694. UWZ_Log $hash, 4, "Warn_".$i."_IconURL: http://www.unwetterzentrale.de/images/icons/".$typenames{ $single_warning->{'type'} }."-".$single_warning->{'severity'}.".gif";
  695. $message .= "Warn_".$i."_IconURL|http://www.unwetterzentrale.de/images/icons/".$typenames{ $single_warning->{'type'} }."-".UWZ_GetSeverityColor($hash, UWZ_GetUWZLevel($hash,$single_warning->{'payload'}{'levelName'} )).".gif|";
  696. }
  697. ###
  698. ## Hagel start
  699. my $hagelcount = 0;
  700. # Begin Language by AttrVal
  701. if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
  702. $hagelcount = my @hagelmatch = $single_warning->{'payload'}{'translationsLongText'}{'DE'} =~ /Hagel/g;
  703. } else {
  704. $hagelcount = my @hagelmatch = $single_warning->{'payload'}{'translationsLongText'}{'EN'} =~ /Hail/g;
  705. }
  706. # end language by AttrVal
  707. if ( $hagelcount ne 0 ) {
  708. UWZ_Log $hash, 4, "Warn_".$i."_Hail: 1";
  709. $message .= "Warn_".$i."_Hail|1|";
  710. } else {
  711. UWZ_Log $hash, 4, "Warn_".$i."_Hail: 0";
  712. $message .= "Warn_".$i."_Hail|0|";
  713. }
  714. ## Hagel end
  715. $i++;
  716. }
  717. my $max=0;
  718. for (@uwzmaxlevel) {
  719. $max = $_ if !$max || $_ > $max
  720. };
  721. $message .= "WarnUWZLevel|";
  722. $message .= $max."|";
  723. UWZ_Log $hash, 4, "WarnUWZLevel_Color: ".UWZ_GetSeverityColor($hash, $max);
  724. $message .= "WarnUWZLevel_Color|".UWZ_GetSeverityColor($hash, $max)."|";
  725. ## Begin of redundant Reading
  726. if ( $UWZ_humanreadable eq 1 ) {
  727. if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
  728. my %uwzlevelname = ( "0" => "Stufe Grün (keine Warnung)",
  729. "1" => "Stufe Dunkelgrün (Wetterhinweise)",
  730. "2" => "Stufe Gelb (Vorwarnung für Unwetterwarnung)",
  731. "3" => "Warnstufe Orange (Unwetterwarnung)",
  732. "4" => "Warnstufe Rot (Unwetterwarnung)",
  733. "5" => "Warnstufe Violett (Unwetterwarnung)");
  734. UWZ_Log $hash, 4, "WarnUWZLevel_Str: ".$uwzlevelname{ $max };
  735. $message .= "WarnUWZLevel_Str|".$uwzlevelname{ $max }."|";
  736. } else {
  737. my %uwzlevelname = ( "0" => "level green (no warnings)",
  738. "1" => "level dark green (weather notice)",
  739. "2" => "level yellow (severe weather watch)",
  740. "3" => "Alert level Orange",
  741. "4" => "Alert level Red",
  742. "5" => "Alert level Violet");
  743. UWZ_Log $hash, 4, "WarnUWZLevel_Str: ".$uwzlevelname{ $max };
  744. $message .= "WarnUWZLevel_Str|".$uwzlevelname{ $max }."|";
  745. }
  746. }
  747. $message .= "durationFetchReadings|";
  748. $message .= sprintf "%.2f", time() - $readingStartTime;
  749. UWZ_Log $hash, 3, "Done fetching data";
  750. UWZ_Log $hash, 4, "Will return : "."$name|$message|WarnCount|$uwz_warncount" ;
  751. return "$name|$message|WarnCount|$uwz_warncount" ;
  752. }
  753. #####################################
  754. sub UWZAsHtml($;$) {
  755. my ($name,$items) = @_;
  756. my $ret = '';
  757. my $hash = $defs{$name};
  758. my $htmlsequence = AttrVal($name, "htmlsequence", "none");
  759. my $htmltitle = AttrVal($name, "htmltitle", "");
  760. my $htmltitleclass = AttrVal($name, "htmltitleclass", "");
  761. my $attr;
  762. if (AttrVal($name, "htmlattr", "none") ne "none") {
  763. $attr = AttrVal($name, "htmlattr", "");
  764. } else {
  765. $attr = 'width="100%"';
  766. }
  767. if (ReadingsVal($name, "WarnCount", 0) != 0 ) {
  768. $ret .= '<table><tr><td>';
  769. $ret .= '<table class="block" '.$attr.'><tr><th class="'.$htmltitleclass.'" colspan="2">'.$htmltitle.'</th></tr>';
  770. if ($htmlsequence eq "descending") {
  771. for ( my $i=ReadingsVal($name, "WarnCount", -1)-1; $i>=0; $i--){
  772. $ret .= '<tr><td class="uwzIcon" style="vertical-align:top;"><img src="'.ReadingsVal($name, "Warn_".$i."_IconURL", "").'"></td>';
  773. $ret .= '<td class="uwzValue"><b>'.ReadingsVal($name, "Warn_".$i."_ShortText", "").'</b><br><br>';
  774. $ret .= ReadingsVal($name, "Warn_".$i."_LongText", "").'<br><br>';
  775. $ret .= '<table '.$attr.'><tr><th></th><th></th></tr><tr><td><b>Start:</b></td><td>'.localtime(ReadingsVal($name, "Warn_".$i."_Start", "")).'</td>';
  776. # language by AttrVal
  777. if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
  778. $ret .= '<td><b>Ende:</b></td><td>'.localtime(ReadingsVal($name, "Warn_".$i."_End", "")).'</td>';
  779. } else {
  780. $ret .= '<td><b>End:</b></td><td>'.localtime(ReadingsVal($name, "Warn_".$i."_End", "")).'</td>';
  781. }
  782. # end language by AttrVal
  783. $ret .= '</tr></table>';
  784. $ret .= '</td></tr>';
  785. }
  786. } else {
  787. ###
  788. for ( my $i=0; $i<ReadingsVal($name, "WarnCount", 0); $i++){
  789. $ret .= '<tr><td class="uwzIcon" style="vertical-align:top;"><img src="'.ReadingsVal($name, "Warn_".$i."_IconURL", "").'"></td>';
  790. $ret .= '<td class="uwzValue"><b>'.ReadingsVal($name, "Warn_".$i."_ShortText", "").'</b><br><br>';
  791. $ret .= ReadingsVal($name, "Warn_".$i."_LongText", "").'<br><br>';
  792. $ret .= '<table '.$attr.'><tr><th></th><th></th></tr><tr><td><b>Start:</b></td><td>'.localtime(ReadingsVal($name, "Warn_".$i."_Start", "")).'</td>';
  793. # language by AttrVal
  794. if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
  795. $ret .= '<td><b>Ende:</b></td><td>'.localtime(ReadingsVal($name, "Warn_".$i."_End", "")).'</td>';
  796. } else {
  797. $ret .= '<td><b>End:</b></td><td>'.localtime(ReadingsVal($name, "Warn_".$i."_End", "")).'</td>';
  798. }
  799. # end language by AttrVal
  800. $ret .= '</tr></table>';
  801. $ret .= '</td></tr>';
  802. }
  803. }
  804. ###
  805. $ret .= '</table>';
  806. $ret .= '</td></tr>';
  807. $ret .= '</table>';
  808. } else {
  809. $ret .= '<table><tr><td>';
  810. $ret .= '<table class="block wide" width="600px"><tr><th class="'.$htmltitleclass.'" colspan="2">'.$htmltitle.'</th></tr>';
  811. $ret .= '<tr><td class="uwzIcon" style="vertical-align:top;">';
  812. # language by AttrVal
  813. if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
  814. $ret .='<b>Keine Warnungen</b>';
  815. } else {
  816. $ret .='<b>No Warnings</b>';
  817. }
  818. # end language by AttrVal
  819. $ret .= '</td></tr>';
  820. $ret .= '</table>';
  821. $ret .= '</td></tr>';
  822. $ret .= '</table>';
  823. }
  824. return $ret;
  825. }
  826. #####################################
  827. sub UWZAsHtmlLite($;$) {
  828. my ($name,$items) = @_;
  829. my $ret = '';
  830. my $hash = $defs{$name};
  831. my $htmlsequence = AttrVal($name, "htmlsequence", "none");
  832. my $htmltitle = AttrVal($name, "htmltitle", "");
  833. my $htmltitleclass = AttrVal($name, "htmltitleclass", "");
  834. my $attr;
  835. if (AttrVal($name, "htmlattr", "none") ne "none") {
  836. $attr = AttrVal($name, "htmlattr", "");
  837. } else {
  838. $attr = 'width="100%"';
  839. }
  840. if (ReadingsVal($name, "WarnCount", "") != 0 ) {
  841. $ret .= '<table><tr><td>';
  842. $ret .= '<table class="block" '.$attr.'><tr><th class="'.$htmltitleclass.'" colspan="2">'.$htmltitle.'</th></tr>';
  843. if ($htmlsequence eq "descending") {
  844. for ( my $i=ReadingsVal($name, "WarnCount", "")-1; $i>=0; $i--){
  845. $ret .= '<tr><td class="uwzIcon" style="vertical-align:top;"><img src="'.ReadingsVal($name, "Warn_".$i."_IconURL", "").'"></td>';
  846. $ret .= '<td class="uwzValue"><b>'.ReadingsVal($name, "Warn_".$i."_ShortText", "").'</b><br><br>';
  847. $ret .= '<table '.$attr.'><tr><th></th><th></th></tr><tr><td><b>Start:</b></td><td>'.localtime(ReadingsVal($name, "Warn_".$i."_Start", "")).'</td>';
  848. # language by AttrVal
  849. if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
  850. $ret .= '<td><b>Ende:</b></td><td>'.localtime(ReadingsVal($name, "Warn_".$i."_End", "")).'</td>';
  851. } else {
  852. $ret .= '<td><b>End:</b></td><td>'.localtime(ReadingsVal($name, "Warn_".$i."_End", "")).'</td>';
  853. }
  854. # end language by AttrVal
  855. $ret .= '</tr></table>';
  856. $ret .= '</td></tr>';
  857. }
  858. } else {
  859. for ( my $i=0; $i<ReadingsVal($name, "WarnCount", ""); $i++){
  860. $ret .= '<tr><td class="uwzIcon" style="vertical-align:top;"><img src="'.ReadingsVal($name, "Warn_".$i."_IconURL", "").'"></td>';
  861. $ret .= '<td class="uwzValue"><b>'.ReadingsVal($name, "Warn_".$i."_ShortText", "").'</b><br><br>';
  862. $ret .= '<table '.$attr.'><tr><th></th><th></th></tr><tr><td><b>Start:</b></td><td>'.localtime(ReadingsVal($name, "Warn_".$i."_Start", "")).'</td>';
  863. # language by AttrVal
  864. if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
  865. $ret .= '<td><b>Ende:</b></td><td>'.localtime(ReadingsVal($name, "Warn_".$i."_End", "")).'</td>';
  866. } else {
  867. $ret .= '<td><b>End:</b></td><td>'.localtime(ReadingsVal($name, "Warn_".$i."_End", "")).'</td>';
  868. }
  869. # end language by AttrVal
  870. $ret .= '</tr></table>';
  871. $ret .= '</td></tr>';
  872. }
  873. }
  874. $ret .= '</table>';
  875. $ret .= '</td></tr>';
  876. $ret .= '</table>';
  877. } else {
  878. $ret .= '<table><tr><td>';
  879. $ret .= '<table class="block wide" width="600px"><tr><th class="'.$htmltitleclass.'" colspan="2">'.$htmltitle.'</th></tr>';
  880. $ret .= '<tr><td class="uwzIcon" style="vertical-align:top;">';
  881. # language by AttrVal
  882. if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
  883. $ret .='<b>Keine Warnungen</b>';
  884. } else {
  885. $ret .='<b>No Warnings</b>';
  886. }
  887. # end language by AttrVal
  888. $ret .= '</td></tr>';
  889. $ret .= '</table>';
  890. $ret .= '</td></tr>';
  891. $ret .= '</table>';
  892. }
  893. return $ret;
  894. }
  895. #####################################
  896. sub UWZAsHtmlFP($;$) {
  897. my ($name,$items) = @_;
  898. my $tablewidth = ReadingsVal($name, "WarnCount", "") * 80;
  899. my $htmlsequence = AttrVal($name, "htmlsequence", "none");
  900. my $htmltitle = AttrVal($name, "htmltitle", "");
  901. my $htmltitleclass = AttrVal($name, "htmltitleclass", "");
  902. my $ret = '';
  903. $ret .= '<table class="uwz-fp" style="width:'.$tablewidth.'px"><tr><th class="'.$htmltitleclass.'" colspan="'.ReadingsVal($name, "WarnCount", "none").'">'.$htmltitle.'</th></tr>';
  904. $ret .= "<tr>";
  905. if ($htmlsequence eq "descending") {
  906. for ( my $i=ReadingsVal($name, "WarnCount", "")-1; $i>=0; $i--){
  907. $ret .= '<td class="uwzIcon"><img width="80px" src="'.ReadingsVal($name, "Warn_".$i."_IconURL", "").'"></td>';
  908. }
  909. } else {
  910. for ( my $i=0; $i<ReadingsVal($name, "WarnCount", ""); $i++){
  911. $ret .= '<td class="uwzIcon"><img width="80px" src="'.ReadingsVal($name, "Warn_".$i."_IconURL", "").'"></td>';
  912. }
  913. }
  914. $ret .= "</tr>";
  915. $ret .= '</table>';
  916. return $ret;
  917. }
  918. #####################################
  919. sub UWZAsHtmlMovie($$) {
  920. my ($name,$land) = @_;
  921. my $url = UWZ_Map2Movie($name,$land);
  922. my $hash = $defs{$name};
  923. my $ret = '<table><tr><td>';
  924. $ret .= '<table class="block wide">';
  925. $ret .= '<tr class="even"><td>';
  926. if(defined($url)) {
  927. $ret .= '<video controls="controls">';
  928. $ret .= '<source src="'.$url.'" type="video/mp4">';
  929. $ret .= '</video>';
  930. } else {
  931. # language by AttrVal
  932. if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
  933. $ret .= 'unbekannte Landbezeichnung';
  934. } else {
  935. $ret .='unknown movie setting';
  936. }
  937. # end language by AttrVal
  938. }
  939. $ret .= '</td></tr></table></td></tr>';
  940. $ret .= '</table>';
  941. return $ret;
  942. }
  943. #####################################
  944. sub UWZAsHtmlKarteLand($$) {
  945. my ($name,$land) = @_;
  946. my $url = UWZ_Map2Image($name,$land);
  947. my $hash = $defs{$name};
  948. my $ret = '<table><tr><td>';
  949. $ret .= '<table class="block wide">';
  950. $ret .= '<tr class="even"><td>';
  951. if(defined($url)) {
  952. $ret .= '<img src="'.$url.'">';
  953. } else {
  954. # language by AttrVal
  955. if ( $hash->{CountryCode} ~~ [ 'DE', 'AT', 'CH' ] ) {
  956. $ret .= 'unbekannte Landbezeichnung';
  957. } else {
  958. $ret .='unknown map setting';
  959. }
  960. # end language by AttrVal
  961. }
  962. $ret .= '</td></tr></table></td></tr>';
  963. $ret .= '</table>';
  964. return $ret;
  965. }
  966. #####################################
  967. sub UWZ_GetSeverityColor($$) {
  968. my ($name,$uwzlevel) = @_;
  969. my $alertcolor = "";
  970. my %UWZSeverity = ( "0" => "gruen",
  971. "1" => "orange",
  972. "2" => "gelb",
  973. "3" => "orange",
  974. "4" => "rot",
  975. "5" => "violett");
  976. return $UWZSeverity{$uwzlevel};
  977. }
  978. #####################################
  979. sub UWZ_GetUWZLevel($$) {
  980. my ($name,$warnname) = @_;
  981. my @alert = split(/_/,$warnname);
  982. if ( $alert[0] eq "notice" ) {
  983. return "1";
  984. } elsif ( $alert[1] eq "forewarn" ) {
  985. return "2";
  986. } else {
  987. my %UWZSeverity = ( "green" => "0",
  988. "yellow" => "2",
  989. "orange" => "3",
  990. "red" => "4",
  991. "violet" => "5");
  992. return $UWZSeverity{$alert[2]};
  993. }
  994. }
  995. #####################################
  996. ##
  997. ## UWZ Helper Functions
  998. ##
  999. #####################################
  1000. sub UWZSearchLatLon($$) {
  1001. my ($name,$loc) = @_;
  1002. my $url = "http://alertspro.geoservice.meteogroup.de/weatherpro/SearchFeed.php?search=".$loc;
  1003. my $agent = LWP::UserAgent->new( env_proxy => 1, keep_alive => 1, protocols_allowed => ['http'], timeout => 10 );
  1004. my $request = HTTP::Request->new( GET => $url );
  1005. my $response = $agent->request($request);
  1006. my $err_log = "Can't get $url -- " . $response->status_line unless( $response->is_success );
  1007. if ( $err_log ne "" ) {
  1008. print "Error|Error " . $response->status_line;
  1009. }
  1010. use XML::Simple qw(:strict);
  1011. use Data::Dumper;
  1012. use Encode qw(decode encode);
  1013. my $uwzxmlparser = XML::Simple->new();
  1014. #my $xmlres = $parser->XMLin(
  1015. my $search = $uwzxmlparser->XMLin($response->content, KeyAttr => { city => 'id' }, ForceArray => [ 'city' ]);
  1016. my $ret = '<html><table><tr><td>';
  1017. $ret .= '<table class="block wide">';
  1018. $ret .= '<tr class="even">';
  1019. $ret .= "<td><b>city</b></td>";
  1020. $ret .= "<td><b>country</b></td>";
  1021. $ret .= "<td><b>latitude</b></td>";
  1022. $ret .= "<td><b>longitude</b></td>";
  1023. $ret .= '</tr>';
  1024. foreach my $locres ($search->{cities}->{city})
  1025. {
  1026. my $linecount=1;
  1027. while ( my ($key, $value) = each(%$locres) ) {
  1028. if ( $linecount % 2 == 0 ) {
  1029. $ret .= '<tr class="even">';
  1030. } else {
  1031. $ret .= '<tr class="odd">';
  1032. }
  1033. $ret .= "<td>".encode('utf-8',$value->{'name'})."</td>";
  1034. $ret .= "<td>$value->{'country-name'}</td>";
  1035. $ret .= "<td>$value->{'latitude'}</td>";
  1036. $ret .= "<td>$value->{'longitude'}</td>";
  1037. my @headerHost = grep /Host/, @FW_httpheader;
  1038. $headerHost[0] =~ s/Host: //g;
  1039. my $aHref="<a href=\"http://".$headerHost[0]."/fhem?cmd=get+".$name."+AreaID+".$value->{'latitude'}.",".$value->{'longitude'}."\">Get AreaID</a>";
  1040. $ret .= "<td>".$aHref."</td>";
  1041. $ret .= '</tr>';
  1042. $linecount++;
  1043. }
  1044. }
  1045. $ret .= '</table></td></tr>';
  1046. $ret .= '</table></html>';
  1047. return $ret;
  1048. }
  1049. #####################################
  1050. sub UWZSearchAreaID($$) {
  1051. my ($lat,$lon) = @_;
  1052. my $url = "http://feed.alertspro.meteogroup.com/AlertsPro/AlertsProPollService.php?method=lookupCoord&lat=".$lat."&lon=".$lon;
  1053. my $agent = LWP::UserAgent->new( env_proxy => 1, keep_alive => 1, protocols_allowed => ['http'], timeout => 10 );
  1054. my $request = HTTP::Request->new( GET => $url );
  1055. my $response = $agent->request($request);
  1056. my $err_log = "Can't get $url -- " . $response->status_line unless( $response->is_success );
  1057. if ( $err_log ne "" ) {
  1058. print "Error|Error " . $response->status_line;
  1059. }
  1060. use JSON;
  1061. my @perl_scalar = @{JSON->new->utf8->decode($response->content)};
  1062. my $AreaType = $perl_scalar[0]->{'AREA_TYPE'};
  1063. my $CC = substr $perl_scalar[0]->{'AREA_ID'}, 3, 2;
  1064. my $AreaID = substr $perl_scalar[0]->{'AREA_ID'}, 5, 5;
  1065. if ( $AreaType eq "UWZ" ) {
  1066. my $ret = '<html>Please use the following statement to define Unwetterzentrale for your location:<br /><br />';
  1067. $ret .= '<table width=100%><tr><td>';
  1068. $ret .= '<table class="block wide">';
  1069. $ret .= '<tr class="even">';
  1070. $ret .= "<td height=100><center><b>define Unwetterzentrale UWZ $CC $AreaID 3600</b></center></td>";
  1071. $ret .= '</tr>';
  1072. $ret .= '</table>';
  1073. $ret .= '</td></tr></table>';
  1074. $ret .= '<br />';
  1075. $ret .= 'You can also use weblinks to add weathermaps. For a list of possible Weblinks see Commandref. For example to add the Europe Map use:<br />';
  1076. $ret .= '<table width=100%><tr><td>';
  1077. $ret .= '<table class="block wide">';
  1078. $ret .= '<tr class="even">';
  1079. $ret .= "<td height=100><center>define UWZ_Map_Europe weblink htmlCode { UWZAsHtmlKarteLand('Unwetterzentrale','europa') }</center></td>";
  1080. $ret .= '</tr>';
  1081. $ret .= '</table>';
  1082. $ret .= '</td></tr></table>';
  1083. $ret .= '</html>';
  1084. return $ret;
  1085. } else {
  1086. return "Sorry, nothing found or not implemented";
  1087. }
  1088. }
  1089. #####################################
  1090. 1;
  1091. =pod
  1092. =item device
  1093. =item summary Modul extracts thunderstorm warnings from unwetterzentrale.de
  1094. =item summary_DE Modul extrahiert Unwetterwarnungen von unwetterzentrale.de.
  1095. =begin html
  1096. <a name="UWZ"></a>
  1097. <h3>UWZ</h3>
  1098. <ul>
  1099. <a name="UWZdefine"></a>
  1100. This modul extracts thunderstorm warnings from <a href="http://www.unwetterzentrale.de">www.unwetterzentrale.de</a>.
  1101. <br/>
  1102. Therefore the same interface is used as the Android App <a href="http://www.alertspro.com">Alerts Pro</a> does.
  1103. A maximum of 10 thunderstorm warnings will be served.
  1104. Additional the module provides a few functions to create HTML-Templates which can be used with weblink.
  1105. <br>
  1106. <i>The following Perl-Modules are used within this module: HTTP::Request, LWP::UserAgent, JSON, Encode::Guess, Text::Iconv und HTML::Parse</i>.
  1107. <br/><br/>
  1108. <b>Define</b>
  1109. <ul>
  1110. <br>
  1111. <code>define &lt;Name&gt; UWZ [CountryCode] [AreaID] [INTERVAL]</code>
  1112. <br><br><br>
  1113. Example:
  1114. <br>
  1115. <code>
  1116. define Unwetterzentrale UWZ UK 08357 1800<br>
  1117. attr Unwetterzentrale download 1<br>
  1118. attr Unwetterzentrale humanreadable 1<br>
  1119. attr Unwetterzentrale maps eastofengland unitedkingdom<br><br>
  1120. define UnwetterDetails weblink htmlCode {UWZAsHtml("Unwetterzentrale")}<br>
  1121. define UnwetterMapE_UK weblink htmlCode {UWZAsHtmlKarteLand("Unwetterzentrale","eastofengland")}<br>
  1122. define UnwetterLite weblink htmlCode {UWZAsHtmlLite("Unwetterzentrale")}
  1123. define UnwetterMovie weblink htmlCode {UWZAsHtmlMovie("Unwetterzentrale","clouds-precipitation-uk")}
  1124. </code>
  1125. <br>&nbsp;
  1126. <li><code>[CountryCode]</code>
  1127. <br>
  1128. Possible values: DE, AT, CH, UK, ...<br/>
  1129. (for other countries than germany use SEARCH for CountryCode to start device in search mode)
  1130. </li><br>
  1131. <li><code>[AreaID]</code>
  1132. <br>
  1133. For Germany you can use the postalcode, other countries use SEARCH for CountryCode to start device in search mode.
  1134. <br>
  1135. </li><br>
  1136. <li><code>[INTERVAL]</code>
  1137. <br>
  1138. Defines the refresh interval. The interval is defined in seconds, so an interval of 3600 means that every hour a refresh will be triggered onetimes.
  1139. <br>
  1140. </li><br>
  1141. <br><br><br>
  1142. Example Search-Mode:
  1143. <br>
  1144. <code>
  1145. define Unwetterzentrale UWZ SEARCH<br>
  1146. </code>
  1147. <br>
  1148. now get the AreaID for your location (example shows london):
  1149. <br>
  1150. <code>
  1151. get Unwetterzentrale SearchAreaID London<br>
  1152. </code>
  1153. <br>
  1154. now redefine your device with the outputted CountryCode and AreaID.
  1155. <br>
  1156. <br>&nbsp;
  1157. </ul>
  1158. <br>
  1159. <a name="UWZget"></a>
  1160. <b>Get</b>
  1161. <ul>
  1162. <br>
  1163. <li><code>get &lt;name&gt; soil-frost</code>
  1164. <br>
  1165. give info about current soil frost (active|inactive).
  1166. </li><br>
  1167. <li><code>get &lt;name&gt; extremfrost</code>
  1168. <br>
  1169. give info about current frost (active|inactive).
  1170. </li><br>
  1171. <li><code>get &lt;name&gt; thunderstorm</code>
  1172. <br>
  1173. give info about current thunderstorm (active|inactive).
  1174. </li><br>
  1175. <li><code>get &lt;name&gt; glaze</code>
  1176. <br>
  1177. give info about current glaze (active|inactive).
  1178. </li><br>
  1179. <li><code>get &lt;name&gt; glazed-rain</code>
  1180. <br>
  1181. give info about current freezing rain (active|inactive).
  1182. </li><br>
  1183. <li><code>get &lt;name&gt; hail</code>
  1184. <br>
  1185. give info about current hail (active|inactive).
  1186. </li><br>
  1187. <li><code>get &lt;name&gt; heat</code>
  1188. <br>
  1189. give info about current heat (active|inactive).
  1190. </li><br>
  1191. <li><code>get &lt;name&gt; rain</code>
  1192. <br>
  1193. give info about current rain (active|inactive).
  1194. </li><br>
  1195. <li><code>get &lt;name&gt; snow</code>
  1196. <br>
  1197. give info about current snow (active|inactive).
  1198. </li><br>
  1199. <li><code>get &lt;name&gt; storm</code>
  1200. <br>
  1201. give info about current storm (active|inactive).
  1202. </li><br>
  1203. <li><code>get &lt;name&gt; forest-fire</code>
  1204. <br>
  1205. give info about current forest fire (active|inactive).
  1206. </li><br>
  1207. </ul>
  1208. <br>
  1209. <b>Get (Search-Mode)</b>
  1210. <ul>
  1211. <br>
  1212. <li><code>get &lt;name&gt; SearchAreaID &lt;city&gt;</code>
  1213. <br>
  1214. Get AreaID coresponnding to entered location.
  1215. </li><br>
  1216. </ul>
  1217. <br>
  1218. <a name="UWZset"></a>
  1219. <b>Set</b>
  1220. <ul>
  1221. <br>
  1222. <li><code>set &lt;name&gt; update</code>
  1223. <br>
  1224. Executes an imediate update of thunderstorm warnings.
  1225. </li><br>
  1226. </ul>
  1227. <br>
  1228. <a name="UWZattr"></a>
  1229. <b>Attributes</b>
  1230. <ul>
  1231. <br>
  1232. <li><code>download</code>
  1233. <br>
  1234. Download maps during update (0|1).
  1235. <br>
  1236. </li>
  1237. <li><code>savepath</code>
  1238. <br>
  1239. Define where to store the map png files (default: /tmp/).
  1240. <br>
  1241. </li>
  1242. <li><code>maps</code>
  1243. <br>
  1244. Define the maps to download space seperated. For possible values see <code>UWZAsHtmlKarteLand</code>.
  1245. <br>
  1246. </li>
  1247. <li><code>humanreadable</code>
  1248. <br>
  1249. Add additional Readings Warn_?_Start_Date, Warn_?_Start_Time, Warn_?_End_Date and Warn_?_End_Time containing the coresponding timetamp in a human readable manner. Additionally Warn_?_uwzLevel_Str and Warn_?_Type_Str will be added to device readings (0|1).
  1250. <br>
  1251. </li>
  1252. <li><code>lang</code>
  1253. <br>
  1254. Overwrite requested language for short and long warn text. (de|en|it|fr|es|..).
  1255. <br>
  1256. </li>
  1257. <li><code>sort_readings_by</code>
  1258. <br>
  1259. define how readings will be sortet (start|severity).
  1260. <br>
  1261. </li>
  1262. <li><code>htmlsequence</code>
  1263. <br>
  1264. define warn order of html output (ascending|descending).
  1265. <br>
  1266. </li>
  1267. <li><code>htmltitle</code>
  1268. <br>
  1269. title / header for the html ouput
  1270. <br>
  1271. </li>
  1272. <li><code>htmltitleclass</code>
  1273. <br>
  1274. css-Class of title / header for the html ouput
  1275. <br>
  1276. </li>
  1277. <li><code>localiconbase</code>
  1278. <br>
  1279. define baseurl to host your own thunderstorm warn pics (filetype is png).
  1280. <br>
  1281. </li>
  1282. <br>
  1283. </ul>
  1284. <br>
  1285. <a name="UWZreading"></a>
  1286. <b>Readings</b>
  1287. <ul>
  1288. <br>
  1289. <li><b>Warn_</b><i>0|1|2|3...|9</i><b>_...</b> - active warnings</li>
  1290. <li><b>WarnCount</b> - warnings count</li>
  1291. <li><b>WarnUWZLevel</b> - total warn level </li>
  1292. <li><b>WarnUWZLevel_Color</b> - total warn level color</li>
  1293. <li><b>WarnUWZLevel_Str</b> - total warn level string</li>
  1294. <li><b>Warn_</b><i>0</i><b>_AltitudeMin</b> - minimum altitude for warning </li>
  1295. <li><b>Warn_</b><i>0</i><b>_AltitudeMax</b> - maximum altitude for warning </li>
  1296. <li><b>Warn_</b><i>0</i><b>_EventID</b> - warning EventID </li>
  1297. <li><b>Warn_</b><i>0</i><b>_Creation</b> - warning creation </li>
  1298. <li><b>Warn_</b><i>0</i><b>_Creation_Date</b> - warning creation datum </li>
  1299. <li><b>Warn_</b><i>0</i><b>_Creation_Time</b> - warning creation time </li>
  1300. <li><b>Warn_</b><i>0</i><b>_Start</b> - begin of warnperiod</li>
  1301. <li><b>Warn_</b><i>0</i><b>_Start_Date</b> - start date of warnperiod</li>
  1302. <li><b>Warn_</b><i>0</i><b>_Start_Time</b> - start time of warnperiod</li>
  1303. <li><b>Warn_</b><i>0</i><b>_End</b> - end of warnperiod</li>
  1304. <li><b>Warn_</b><i>0</i><b>_End_Date</b> - end date of warnperiod</li>
  1305. <li><b>Warn_</b><i>0</i><b>_End_Time</b> - end time of warnperiod</li>
  1306. <li><b>Warn_</b><i>0</i><b>_Severity</b> - Severity of thunderstorm (0 no thunderstorm, 4, 7, 11, .. heavy thunderstorm)</li>
  1307. <li><b>Warn_</b><i>0</i><b>_Hail</b> - warning contains hail</li>
  1308. <li><b>Warn_</b><i>0</i><b>_Type</b> - kind of thunderstorm</li>
  1309. <li><b>Warn_</b><i>0</i><b>_Type_Str</b> - kind of thunderstorm (text)</li>
  1310. <ul>
  1311. <li><b>1</b> - unknown</li>
  1312. <li><b>2</b> - storm</li>
  1313. <li><b>3</b> - snow</li>
  1314. <li><b>4</b> - rain</li>
  1315. <li><b>5</b> - frost</li>
  1316. <li><b>6</b> - forest fire</li>
  1317. <li><b>7</b> - thunderstorm</li>
  1318. <li><b>8</b> - glaze</li>
  1319. <li><b>9</b> - heat</li>
  1320. <li><b>10</b> - freezing rain</li>
  1321. <li><b>11</b> - soil frost</li>
  1322. </ul>
  1323. <li><b>Warn_</b><i>0</i><b>_uwzLevel</b> - Severity of thunderstorm (0-5)</li>
  1324. <li><b>Warn_</b><i>0</i><b>_uwzLevel_Str</b> - Severity of thunderstorm (text)</li>
  1325. <li><b>Warn_</b><i>0</i><b>_levelName</b> - Level Warn Name</li>
  1326. <li><b>Warn_</b><i>0</i><b>_ShortText</b> - short warn text</li>
  1327. <li><b>Warn_</b><i>0</i><b>_LongText</b> - detailed warn text</li>
  1328. <li><b>Warn_</b><i>0</i><b>_IconURL</b> - cumulated URL to display warn-icons from <a href="http://www.unwetterzentrale.de">www.unwetterzentrale.de</a></li>
  1329. </ul>
  1330. <br>
  1331. <a name="UWZweblinks"></a>
  1332. <b>Weblinks</b>
  1333. <ul>
  1334. <br>
  1335. With the additional implemented functions <code>UWZAsHtml, UWZAsHtmlLite, UWZAsHtmlFP, UWZAsHtmlKarteLand and UWZAsHtmlMovie</code> HTML-Code will be created to display warnings and weathermovies, using weblinks.
  1336. <br><br><br>
  1337. Example:
  1338. <br>
  1339. <li><code>define UnwetterDetailiert weblink htmlCode {UWZAsHtml("Unwetterzentrale")}</code></li>
  1340. <br>
  1341. <li><code>define UnwetterLite weblink htmlCode {UWZAsHtmlLite("Unwetterzentrale")}</code></li>
  1342. <br>
  1343. <li><code>define UnwetterFloorplan weblink htmlCode {UWZAsHtmlFP("Unwetterzentrale")}</code></li>
  1344. <br>
  1345. <li><code>define UnwetterKarteLand weblink htmlCode {UWZAsHtmlKarteLand("Unwetterzentrale","Bayern")}</code></li>
  1346. <ul>
  1347. <li>The second parameter should be one of:
  1348. <ul>
  1349. <li>europa</li>
  1350. <br/>
  1351. <li>deutschland</li>
  1352. <li>deutschland-small</li>
  1353. <li>niedersachsen</li>
  1354. <li>bremen</li>
  1355. <li>bayern</li>
  1356. <li>schleswig-holstein</li>
  1357. <li>hamburg</li>
  1358. <li>mecklenburg-vorpommern</li>
  1359. <li>sachsen</li>
  1360. <li>sachsen-anhalt</li>
  1361. <li>nordrhein-westfalen</li>
  1362. <li>thueringen</li>
  1363. <li>rheinland-pfalz</li>
  1364. <li>saarland</li>
  1365. <li>baden-wuerttemberg</li>
  1366. <li>hessen</li>
  1367. <li>brandenburg</li>
  1368. <li>berlin</li>
  1369. <br/>
  1370. <li>oesterreich</li>
  1371. <li>burgenland</li>
  1372. <li>kaernten</li>
  1373. <li>niederoesterreich</li>
  1374. <li>oberoesterreich</li>
  1375. <li>salzburg</li>
  1376. <li>steiermark</li>
  1377. <li>tirol</li>
  1378. <li>vorarlberg</li>
  1379. <li>wien</li>
  1380. <br/>
  1381. <li>schweiz</li>
  1382. <li>aargau</li>
  1383. <li>appenzell_ausserrhoden</li>
  1384. <li>appenzell_innerrhoden</li>
  1385. <li>basel_landschaft</li>
  1386. <li>basel_stadt</li>
  1387. <li>bern</li>
  1388. <li>fribourg</li>
  1389. <li>geneve</li>
  1390. <li>glarus</li>
  1391. <li>graubuenden</li>
  1392. <li>jura</li>
  1393. <li>luzern</li>
  1394. <li>neuchatel</li>
  1395. <li>nidwalden</li>
  1396. <li>obwalden</li>
  1397. <li>schaffhausen</li>
  1398. <li>schwyz</li>
  1399. <li>solothurn</li>
  1400. <li>stgallen</li>
  1401. <li>ticino</li>
  1402. <li>thurgau</li>
  1403. <li>uri</li>
  1404. <li>waadt</li>
  1405. <li>wallis</li>
  1406. <li>zug</li>
  1407. <li>zuerich</li>
  1408. <br/>
  1409. <li>liechtenstein</li>
  1410. <br/>
  1411. <li>belgique</li>
  1412. <br/>
  1413. <li>denmark</li>
  1414. <br/>
  1415. <li>finnland</li>
  1416. <br/>
  1417. <li>france</li>
  1418. <br/>
  1419. <li>letzebuerg</li>
  1420. <br/>
  1421. <li>nederland</li>
  1422. <br/>
  1423. <li>norwegen</li>
  1424. <br/>
  1425. <li>portugal</li>
  1426. <br/>
  1427. <li>sverige</li>
  1428. <br/>
  1429. <li>espana</li>
  1430. <br/>
  1431. <li>unitedkingdom</li>
  1432. <li>eastofengland</li>
  1433. <li>eastmidlands</li>
  1434. <li>london</li>
  1435. <li>northeastengland</li>
  1436. <li>northernireland</li>
  1437. <li>northwestengland</li>
  1438. <li>scotland</li>
  1439. <li>southeastengland</li>
  1440. <li>southwestengland</li>
  1441. <li>wales</li>
  1442. <li>westmidlands</li>
  1443. <li>yorkshireandthehumber</li>
  1444. <br/>
  1445. <li>isobaren1</li>
  1446. <li>isobaren2</li>
  1447. <li>isobaren3</li>
  1448. </ul>
  1449. </li>
  1450. </ul>
  1451. <li><code>define UnwetterKarteMovie weblink htmlCode {UWZAsHtmlMovie("Unwetterzentrale","currents")}</code></li>
  1452. <ul>
  1453. <li>The second parameter should be one of:
  1454. <ul>
  1455. <li>niederschlag-wolken</li>
  1456. <li>stroemung</li>
  1457. <li>temperatur</li>
  1458. <br/>
  1459. <li>niederschlag-wolken-de</li>
  1460. <li>stroemung-de</li>
  1461. <br/>
  1462. <li>niederschlag-wolken-ch</li>
  1463. <li>stroemung-ch</li>
  1464. <br/>
  1465. <li>niederschlag-wolken-at</li>
  1466. <li>stroemung-at</li>
  1467. <br/>
  1468. <li>niederschlag-wolken-uk</li>
  1469. <li>stroemung-uk</li>
  1470. <br/>
  1471. </ul>
  1472. </li>
  1473. </ul>
  1474. <br/><br/>
  1475. </ul>
  1476. <br>
  1477. </ul>
  1478. =end html
  1479. =begin html_DE
  1480. <a name="UWZ"></a>
  1481. <h3>UWZ</h3>
  1482. <ul>
  1483. <a name="UWZdefine"></a>
  1484. Das Modul extrahiert Unwetterwarnungen von <a href="http://www.unwetterzentrale.de">www.unwetterzentrale.de</a>.
  1485. <br/>
  1486. Hierfür wird die selbe Schnittstelle verwendet die auch die Android App <a href="http://www.alertspro.com">Alerts Pro</a> nutzt.
  1487. Es werden maximal 10 Standortbezogene Unwetterwarnungen zur Verfügung gestellt.
  1488. Weiterhin verfügt das Modul über HTML-Templates welche als weblink verwendet werden können.
  1489. <br>
  1490. <i>Es nutzt die Perl-Module HTTP::Request, LWP::UserAgent, JSON, Encode::Guess, Text::Iconv und HTML::Parse</i>.
  1491. <br/><br/>
  1492. <b>Define</b>
  1493. <ul>
  1494. <br>
  1495. <code>define &lt;Name&gt; UWZ [L&auml;ndercode] [Postleitzahl] [INTERVAL]</code>
  1496. <br><br><br>
  1497. Beispiel:
  1498. <br>
  1499. <code>define Unwetterzentrale UWZ DE 86405 3600</code>
  1500. <br>&nbsp;
  1501. <li><code>[L&auml;ndercode]</code>
  1502. <br>
  1503. M&ouml;gliche Werte: DE, AT, CH, SEARCH, ...<br/>
  1504. (f&uuml;r ander L&auml;nder als Deutschland bitte den SEARCH Parameter nutzen um die AreaID zu ermitteln.)
  1505. </li><br>
  1506. <li><code>[Postleitzahl/AreaID]</code>
  1507. <br>
  1508. Die Postleitzahl/AreaID des Ortes für den Unwetterinformationen abgefragt werden sollen.
  1509. <br>
  1510. </li><br>
  1511. <li><code>[INTERVAL]</code>
  1512. <br>
  1513. Definiert das Interval zur aktualisierung der Unwetterwarnungen. Das Interval wird in Sekunden angegeben, somit aktualisiert das Modul bei einem Interval von 3600 jede Stunde 1 mal.
  1514. <br>
  1515. </li><br>
  1516. </ul>
  1517. <br>
  1518. <a name="UWZget"></a>
  1519. <b>Get</b>
  1520. <ul>
  1521. <br>
  1522. <li><code>get &lt;name&gt; Bodenfrost</code>
  1523. <br>
  1524. Gibt aus ob aktuell eine Bodenfrostwarnung besteht (active|inactive).
  1525. </li><br>
  1526. <li><code>get &lt;name&gt; Extremfrost</code>
  1527. <br>
  1528. Gibt aus ob aktuell eine Extremfrostwarnung besteht (active|inactive).
  1529. </li><br>
  1530. <li><code>get &lt;name&gt; Gewitter</code>
  1531. <br>
  1532. Gibt aus ob aktuell eine Gewitter Warnung besteht (active|inactive).
  1533. </li><br>
  1534. <li><code>get &lt;name&gt; Glaette</code>
  1535. <br>
  1536. Gibt aus ob aktuell eine Glaettewarnung besteht (active|inactive).
  1537. </li><br>
  1538. <li><code>get &lt;name&gt; Glatteisregen</code>
  1539. <br>
  1540. Gibt aus ob aktuell eine Glatteisregen Warnung besteht (active|inactive).
  1541. </li><br>
  1542. <li><code>get &lt;name&gt; Hagel</code>
  1543. <br>
  1544. Gibt aus ob aktuell eine Hagel Warnung besteht (active|inactive).
  1545. </li><br>
  1546. <li><code>get &lt;name&gt; Hitze</code>
  1547. <br>
  1548. Gibt aus ob aktuell eine Hitze Warnung besteht (active|inactive).
  1549. </li><br>
  1550. <li><code>get &lt;name&gt; Regen</code>
  1551. <br>
  1552. Gibt aus ob aktuell eine Regen Warnung besteht (active|inactive).
  1553. </li><br>
  1554. <li><code>get &lt;name&gt; Schneefall</code>
  1555. <br>
  1556. Gibt aus ob aktuell eine Schneefall Warnung besteht (active|inactive).
  1557. </li><br>
  1558. <li><code>get &lt;name&gt; Sturm</code>
  1559. <br>
  1560. Gibt aus ob aktuell eine Sturm Warnung besteht (active|inactive).
  1561. </li><br>
  1562. <li><code>get &lt;name&gt; Waldbrand</code>
  1563. <br>
  1564. Gibt aus ob aktuell eine Waldbrand Warnung besteht (active|inactive).
  1565. </li><br>
  1566. </ul>
  1567. <br>
  1568. <b>Get (Search-Mode)</b>
  1569. <ul>
  1570. <br>
  1571. <li><code>get &lt;name&gt; SearchAreaID &lt;gesuchte_stadt&gt;</code>
  1572. <br>
  1573. Gibt die AreaID zum eingegebenen Ort aus.
  1574. </li><br>
  1575. </ul>
  1576. <br>
  1577. <a name="UWZset"></a>
  1578. <b>Set</b>
  1579. <ul>
  1580. <br>
  1581. <li><code>set &lt;name&gt; update</code>
  1582. <br>
  1583. Startet sofort ein neues Auslesen der Unwetterinformationen.
  1584. </li><br>
  1585. </ul>
  1586. <br>
  1587. <a name="UWZattr"></a>
  1588. <b>Attribute</b>
  1589. <ul>
  1590. <br>
  1591. <li><code>download</code>
  1592. <br>
  1593. Download Unwetterkarten während des updates (0|1).
  1594. <br>
  1595. </li>
  1596. <li><code>savepath</code>
  1597. <br>
  1598. Pfad zum speichern der Karten (default: /tmp/).
  1599. <br>
  1600. </li>
  1601. <li><code>maps</code>
  1602. <br>
  1603. Leerzeichen separierte Liste der zu speichernden Karten. Für mögliche Karten siehe <code>UWZAsHtmlKarteLand</code>.
  1604. <br>
  1605. </li>
  1606. <li><code>humanreadable</code>
  1607. <br>
  1608. Anzeige weiterer Readings Warn_?_Start_Date, Warn_?_Start_Time, Warn_?_End_Date, Warn_?_End_Time. Diese Readings enthalten aus dem Timestamp kalkulierte Datums/Zeit Angaben. Weiterhin werden folgende Readings aktivier: Warn_?_Type_Str und Warn_?_uwzLevel_Str welche den Unwettertyp als auch das Unwetter-Warn-Level als Text ausgeben. (0|1)
  1609. <br>
  1610. </li>
  1611. <li><code>lang</code>
  1612. <br>
  1613. Umschalten der angeforderten Sprache für kurz und lange warn text. (de|en|it|fr|es|..).
  1614. <br>
  1615. </li>
  1616. <li><code>sort_readings_by</code>
  1617. <br>
  1618. Sortierreihenfolge der Warnmeldungen. (start|severity).
  1619. <br>
  1620. </li>
  1621. <li><code>htmlsequence</code>
  1622. <br>
  1623. Anzeigereihenfolge der html warnungen. (ascending|descending).
  1624. <br>
  1625. </li>
  1626. <li><code>htmltitle</code>
  1627. <br>
  1628. Titel / Ueberschrift der HTML Ausgabe
  1629. <br>
  1630. </li>
  1631. <li><code>htmltitleclass</code>
  1632. <br>
  1633. css-Class des Titels der HTML Ausgabe
  1634. <br>
  1635. </li>
  1636. <li><code>localiconbase</code>
  1637. <br>
  1638. BaseURL angeben um Warn Icons lokal zu hosten. (Dateityp ist png).
  1639. <br>
  1640. </li>
  1641. <br>
  1642. </ul>
  1643. <br>
  1644. <a name="UWZreading"></a>
  1645. <b>Readings</b>
  1646. <ul>
  1647. <br>
  1648. <li><b>Warn_</b><i>0|1|2|3...|9</i><b>_...</b> - aktive Warnmeldungen</li>
  1649. <li><b>WarnCount</b> - Anzahl der aktiven Warnmeldungen</li>
  1650. <li><b>WarnUWZLevel</b> - Gesamt Warn Level </li>
  1651. <li><b>WarnUWZLevel_Color</b> - Gesamt Warn Level Farbe</li>
  1652. <li><b>WarnUWZLevel_Str</b> - Gesamt Warn Level Text</li>
  1653. <li><b>Warn_</b><i>0</i><b>_AltitudeMin</b> - minimum Höhe für Warnung </li>
  1654. <li><b>Warn_</b><i>0</i><b>_AltitudeMax</b> - maximum Höhe für Warnung </li>
  1655. <li><b>Warn_</b><i>0</i><b>_EventID</b> - EventID der Warnung </li>
  1656. <li><b>Warn_</b><i>0</i><b>_Creation</b> - Warnungs Erzeugung </li>
  1657. <li><b>Warn_</b><i>0</i><b>_Creation_Date</b> - Warnungs Erzeugungs Datum </li>
  1658. <li><b>Warn_</b><i>0</i><b>_Creation_Time</b> - Warnungs Erzeugungs Zeit </li>
  1659. <li><b>Warn_</b><i>0</i><b>_Start</b> - Begin der Warnung</li>
  1660. <li><b>Warn_</b><i>0</i><b>_Start_Date</b> - Startdatum der Warnung</li>
  1661. <li><b>Warn_</b><i>0</i><b>_Start_Time</b> - Startzeit der Warnung</li>
  1662. <li><b>Warn_</b><i>0</i><b>_End</b> - Warn Ende</li>
  1663. <li><b>Warn_</b><i>0</i><b>_End_Date</b> - Enddatum der Warnung</li>
  1664. <li><b>Warn_</b><i>0</i><b>_End_Time</b> - Endzeit der Warnung</li>
  1665. <li><b>Warn_</b><i>0</i><b>_Severity</b> - Schwere des Unwetters (0 kein Unwetter, 12 massives Unwetter)</li>
  1666. <li><b>Warn_</b><i>0</i><b>_Hail</b> - Hagelwarnung (1|0)</li>
  1667. <li><b>Warn_</b><i>0</i><b>_Type</b> - Art des Unwetters</li>
  1668. <li><b>Warn_</b><i>0</i><b>_Type_Str</b> - Art des Unwetters (text)</li>
  1669. <ul>
  1670. <li><b>1</b> - unbekannt</li>
  1671. <li><b>2</b> - Sturm/Orkan</li>
  1672. <li><b>3</b> - Schneefall</li>
  1673. <li><b>4</b> - Regen</li>
  1674. <li><b>5</b> - Extremfrost</li>
  1675. <li><b>6</b> - Waldbrandgefahr</li>
  1676. <li><b>7</b> - Gewitter</li>
  1677. <li><b>8</b> - Glätte</li>
  1678. <li><b>9</b> - Hitze</li>
  1679. <li><b>10</b> - Glatteisregen</li>
  1680. <li><b>11</b> - Bodenfrost</li>
  1681. </ul>
  1682. <li><b>Warn_</b><i>0</i><b>_uwzLevel</b> - Unwetterwarnstufe (0-5)</li>
  1683. <li><b>Warn_</b><i>0</i><b>_uwzLevel_Str</b> - Unwetterwarnstufe (text)</li>
  1684. <li><b>Warn_</b><i>0</i><b>_levelName</b> - Level Warn Name</li>
  1685. <li><b>Warn_</b><i>0</i><b>_ShortText</b> - Kurzbeschreibung der Warnung</li>
  1686. <li><b>Warn_</b><i>0</i><b>_LongText</b> - Ausführliche Unwetterbeschreibung</li>
  1687. <li><b>Warn_</b><i>0</i><b>_IconURL</b> - Kumulierte URL um Warnungs-Icon von <a href="http://www.unwetterzentrale.de">www.unwetterzentrale.de</a> anzuzeigen</li>
  1688. </ul>
  1689. <br>
  1690. <a name="UWZweblinks"></a>
  1691. <b>Weblinks</b>
  1692. <ul>
  1693. <br>
  1694. &Uuml;ber die Funktionen <code>UWZAsHtml, UWZAsHtmlLite, UWZAsHtmlFP, UWZAsHtmlKarteLand, UWZAsHtmlMovie</code> wird HTML-Code zur Warnanzeige und Wetterfilme über weblinks erzeugt.
  1695. <br><br><br>
  1696. Beispiele:
  1697. <br>
  1698. <li><code>define UnwetterDetailiert weblink htmlCode {UWZAsHtml("Unwetterzentrale")}</code></li>
  1699. <br>
  1700. <li><code>define UnwetterLite weblink htmlCode {UWZAsHtmlLite("Unwetterzentrale")}</code></li>
  1701. <br>
  1702. <li><code>define UnwetterFloorplan weblink htmlCode {UWZAsHtmlFP("Unwetterzentrale")}</code></li>
  1703. <br>
  1704. <li><code>define UnwetterKarteLand weblink htmlCode {UWZAsHtmlKarteLand("Unwetterzentrale","Bayern")}</code></li>
  1705. <ul>
  1706. <li>Der zweite Parameter kann einer der folgenden sein:
  1707. <ul>
  1708. <li>europa</li>
  1709. <br/>
  1710. <li>deutschland</li>
  1711. <li>deutschland-small</li>
  1712. <li>niedersachsen</li>
  1713. <li>bremen</li>
  1714. <li>bayern</li>
  1715. <li>schleswig-holstein</li>
  1716. <li>hamburg</li>
  1717. <li>mecklenburg-vorpommern</li>
  1718. <li>sachsen</li>
  1719. <li>sachsen-anhalt</li>
  1720. <li>nordrhein-westfalen</li>
  1721. <li>thueringen</li>
  1722. <li>rheinland-pfalz</li>
  1723. <li>saarland</li>
  1724. <li>baden-wuerttemberg</li>
  1725. <li>hessen</li>
  1726. <li>brandenburg</li>
  1727. <li>berlin</li>
  1728. <br/>
  1729. <li>oesterreich</li>
  1730. <li>burgenland</li>
  1731. <li>kaernten</li>
  1732. <li>niederoesterreich</li>
  1733. <li>oberoesterreich</li>
  1734. <li>salzburg</li>
  1735. <li>steiermark</li>
  1736. <li>tirol</li>
  1737. <li>vorarlberg</li>
  1738. <li>wien</li>
  1739. <br/>
  1740. <li>schweiz</li>
  1741. <li>aargau</li>
  1742. <li>appenzell_ausserrhoden</li>
  1743. <li>appenzell_innerrhoden</li>
  1744. <li>basel_landschaft</li>
  1745. <li>basel_stadt</li>
  1746. <li>bern</li>
  1747. <li>fribourg</li>
  1748. <li>geneve</li>
  1749. <li>glarus</li>
  1750. <li>graubuenden</li>
  1751. <li>jura</li>
  1752. <li>luzern</li>
  1753. <li>neuchatel</li>
  1754. <li>nidwalden</li>
  1755. <li>obwalden</li>
  1756. <li>schaffhausen</li>
  1757. <li>schwyz</li>
  1758. <li>solothurn</li>
  1759. <li>stgallen</li>
  1760. <li>ticino</li>
  1761. <li>thurgau</li>
  1762. <li>uri</li>
  1763. <li>waadt</li>
  1764. <li>wallis</li>
  1765. <li>zug</li>
  1766. <li>zuerich</li>
  1767. <br/>
  1768. <li>liechtenstein</li>
  1769. <br/>
  1770. <li>belgique</li>
  1771. <br/>
  1772. <li>denmark</li>
  1773. <br/>
  1774. <li>finnland</li>
  1775. <br/>
  1776. <li>france</li>
  1777. <br/>
  1778. <li>letzebuerg</li>
  1779. <br/>
  1780. <li>nederland</li>
  1781. <br/>
  1782. <li>norwegen</li>
  1783. <br/>
  1784. <li>portugal</li>
  1785. <br/>
  1786. <li>sverige</li>
  1787. <br/>
  1788. <li>espana</li>
  1789. <br/>
  1790. <li>unitedkingdom</li>
  1791. <li>eastofengland</li>
  1792. <li>eastmidlands</li>
  1793. <li>london</li>
  1794. <li>northeastengland</li>
  1795. <li>northernireland</li>
  1796. <li>northwestengland</li>
  1797. <li>scotland</li>
  1798. <li>southeastengland</li>
  1799. <li>southwestengland</li>
  1800. <li>wales</li>
  1801. <li>westmidlands</li>
  1802. <li>yorkshireandthehumber</li>
  1803. <br/>
  1804. <li>isobaren1</li>
  1805. <li>isobaren2</li>
  1806. <li>isobaren3</li>
  1807. </ul>
  1808. </li>
  1809. </ul>
  1810. <li><code>define UnwetterKarteMovie weblink htmlCode {UWZAsHtmlMovie("Unwetterzentrale","niederschlag-wolken-de")}</code></li>
  1811. <ul>
  1812. <li>Der zweite Parameter kann einer der folgenden sein:
  1813. <ul>
  1814. <li>niederschlag-wolken</li>
  1815. <li>stroemung</li>
  1816. <li>temperatur</li>
  1817. <br/>
  1818. <li>niederschlag-wolken-de</li>
  1819. <li>stroemung-de</li>
  1820. <br/>
  1821. <li>niederschlag-wolken-ch</li>
  1822. <li>stroemung-ch</li>
  1823. <br/>
  1824. <li>niederschlag-wolken-at</li>
  1825. <li>stroemung-at</li>
  1826. <br/>
  1827. <li>clouds-precipitation-uk</li>
  1828. <li>currents-uk</li>
  1829. <br/>
  1830. </ul>
  1831. </li>
  1832. </ul>
  1833. <br/><br/>
  1834. </ul>
  1835. <br>
  1836. </ul>
  1837. =end html_DE
  1838. =cut