diff --git a/CHANGED b/CHANGED index c230b4fd0..d1b028d15 100644 --- a/CHANGED +++ b/CHANGED @@ -1,5 +1,8 @@ # 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. + - update: 77_UWZ: New Minor Release 1.2 Support for United Kingdom + - feature: 74_AMAD: add Conditionsupport for older Androisversions + (Kreidezeit) - bugfix: 73_GasCalculator: Unknown "?"-reading no longer created. - feature: 74_AMAD: battery_temperature formated - bugfix: 74_AMAD: deviceState timestamp bugfix for usb-ethernet Devices diff --git a/FHEM/74_AMAD.pm b/FHEM/74_AMAD.pm index 3509e44a2..aa8f22fb5 100644 --- a/FHEM/74_AMAD.pm +++ b/FHEM/74_AMAD.pm @@ -37,8 +37,8 @@ use TcpServerUtils; use Encode qw(encode); -my $modulversion = "2.2.3"; -my $flowsetversion = "2.2.3"; +my $modulversion = "2.2.4"; +my $flowsetversion = "2.2.4"; @@ -1091,6 +1091,8 @@ sub AMAD_CommBridge_Read($) { my $bhash = $modules{AMAD}{defptr}{BRIDGE}; my $bname = $bhash->{NAME}; + + ## Zum testen mal ausgeschalten if( $hash->{SERVERSOCKET} ) { # Accept and create a child TcpServer_Accept( $hash, "AMAD" ); @@ -1522,7 +1524,7 @@ sub AMAD_decrypt($) {
  • androidVersion - aktuell installierte Androidversion
  • automagicState - Statusmeldungen von der AutomagicApp (Voraussetzung Android >4.3). Ist Android größer 4.3 vorhanden und im Reading steht "wird nicht unterstützt", muß in den Androideinstellungen unter Ton und Benachrichtigungen -> Benachrichtigungszugriff ein Haken für Automagic gesetzt werden
  • batteryHealth - Zustand der Battery (1=unbekannt, 2=gut, 3=Überhitzt, 4=tot, 5=Überspannung, 6=unbekannter Fehler, 7=kalt)
  • -
  • batterytemperature - Temperatur der Batterie in Grad Fahrenheit
  • +
  • batterytemperature - Temperatur der Batterie
  • bluetooth - on/off, Bluetooth Status an oder aus
  • checkActiveTask - Zustand einer zuvor definierten APP. 0=nicht aktiv oder nicht aktiv im Vordergrund, 1=aktiv im Vordergrund, siehe Hinweis unten
  • connectedBTdevices - eine Liste der verbundenen Gerät
  • diff --git a/FHEM/77_UWZ.pm b/FHEM/77_UWZ.pm index e164b3f9e..d0a52d1e9 100644 --- a/FHEM/77_UWZ.pm +++ b/FHEM/77_UWZ.pm @@ -38,6 +38,19 @@ ############################################## +### Wünsche von Usern +## +## Hi, +## benutze jetzt seid einigen Tagen erfolgreich das UWZ Modul. +## Habe da noch einen kleinen wunsch zum weblink: +## Könnte mal das attribut htmlattr mit einbinden? +## attr Unwetterzentrale htmlattr width="220" height="330" +## https://forum.fhem.de/index.php/topic,51233.msg461384.html#msg461384 +## +## + + + package main; use strict; @@ -60,7 +73,7 @@ use vars qw($readingFnAttributes); use vars qw(%defs); my $MODUL = "UWZ"; -my $version = "1.0.1"; +my $version = "1.2.0"; my $countrycode = "DE"; my $plz = "77777"; @@ -87,6 +100,7 @@ sub UWZ_Map2Image($$) { my $uwz_de_url = "http://www.unwetterzentrale.de/images/map/"; my $uwz_at_url = "http://unwetter.wetteralarm.at/images/map/"; + my $uwz_en_url = "http://warnings.severe-weather-centre.co.uk/images/map/"; my ( $hash, $smap ) = @_; my $lmap; @@ -122,6 +136,21 @@ sub UWZ_Map2Image($$) { $lmap->{'wien'}=$uwz_at_url.'wien_index.png'; $lmap->{'isobaren1'}="http://www.unwetterzentrale.de/images/icons/UWZ_ISO_00.jpg"; $lmap->{'isobaren2'}="http://www.wetteralarm.at/uploads/pics/UWZ_EURO_ISO_GER_00.jpg"; + + ## Maps of United Kingdom + $lmap->{'unitedkingdom'}=$uwz_en_url.'unitedkingdom_index.png'; + $lmap->{'eastofengland'}=$uwz_en_url.'eastofengland_index.png'; + $lmap->{'eastmidlands'}=$uwz_en_url.'eastmidlands-index.png'; + $lmap->{'london'}=$uwz_en_url.'london-index.png'; + $lmap->{'northeastengland'}=$uwz_en_url.'northeastengland-index.png'; + $lmap->{'northernireland'}=$uwz_en_url.'northernireland-index.png'; + $lmap->{'northwestengland'}=$uwz_en_url.'northwestengland-index.png'; + $lmap->{'scotland'}=$uwz_en_url.'scotland-index.png'; + $lmap->{'southeastengland'}=$uwz_en_url.'southeastengland-index.png'; + $lmap->{'southwestengland'}=$uwz_en_url.'southwestengland-index.png'; + $lmap->{'wales'}=$uwz_en_url.'wales-index.png'; + $lmap->{'westmidlands'}=$uwz_en_url.'westmidlands-index.png'; + $lmap->{'yorkshireandthehumber'}=$uwz_en_url.'yorkshireandthehumber-index.png'; return $lmap->{$smap}; } @@ -134,6 +163,7 @@ sub UWZ_Initialize($) { $hash->{SetFn} = "UWZ_Set"; $hash->{GetFn} = "UWZ_Get"; $hash->{AttrList} = "INTERVAL ". + "CountryCode ". # Added to set country/language "URL ". "PLZ ". "download:0,1 ". @@ -162,7 +192,11 @@ sub UWZ_Define($$) { $hash->{STATE} = "Initializing"; $hash->{CountryCode} = $a[2]; $hash->{PLZ} = $a[3]; - $hash->{URL} = "http://feed.alertspro.meteogroup.com/AlertsPro/AlertsProPollService.php?method=getWarning&language=de&areaID=UWZ" . $a[2] . $a[3]; + + ## URL by CountryCode + $hash->{URL} = "http://feed.alertspro.meteogroup.com/AlertsPro/AlertsProPollService.php?method=getWarning&language=en&areaID=UWZ" . $a[2] . $a[3] if ( $hash->{CountryCode} eq "UK" ); + $hash->{URL} = "http://feed.alertspro.meteogroup.com/AlertsPro/AlertsProPollService.php?method=getWarning&language=de&areaID=UWZ" . $a[2] . $a[3] if ( $hash->{CountryCode} eq "DE" ); + $hash->{fhem}{LOCAL} = 0; $hash->{INTERVAL} = $a[4]; $hash->{VERSION} = $version; @@ -262,9 +296,10 @@ sub UWZ_GetCurrent($@) { } else { $out = "inactive"; } - } - } - return $out; + } + } + + return $out; } ##################################### @@ -285,8 +320,8 @@ sub UWZ_GetCurrentHail($) { } else { $out= "inactive"; } - } - } + } + } return $out; } @@ -372,19 +407,6 @@ sub UWZ_Done($) { # delete the marker for RUNNING_PID process delete( $hash->{helper}{RUNNING_PID} ); - - -## alter Code sollte gelöscht werden -# -# fhem("deletereading ".$hash->{NAME}." .*"); -# -# foreach my $skey (grep /^(Warn_?_|WarnCount)/ ,sort keys %{ $hash->{READINGS} }) { -# UWZ_Log $hash, 3, "Delete Reading:$skey"; -# delete $hash->{READINGS}{$skey}; -# } - - - UWZ_Log $hash, 4, "Delete old Readings"; CommandDeleteReading(undef, "$hash->{NAME} Warn_?_.*"); @@ -406,8 +428,10 @@ sub UWZ_Done($) { if (keys %values > 0) { my $newState; if (defined $values{WarnCount}) { - $newState = "Warnungen: " . $values{WarnCount}; - + # Message by CountryCode + $newState = "Warnings: " . $values{WarnCount} if ( $hash->{CountryCode} eq "UK" ); + $newState = "Warnungen: " . $values{WarnCount} if ( $hash->{CountryCode} eq "DE" ); + # end Message by CountryCode } else { $newState = "Error: Could not capture all data. Please check CountryCode and PLZ."; } @@ -600,32 +624,55 @@ sub UWZ_Run($) { $message .= "Warn_".$i."_Type_Str|".ucfirst($typenames{ $single_warning->{'type'} })."|"; } ## End of redundant Reading - + UWZ_Log $hash, 4, "Warn_".$i."_levelName: ".$single_warning->{'payload'}{'levelName'}; $message .= "Warn_".$i."_levelName|".$single_warning->{'payload'}{'levelName'}."|"; - UWZ_Log $hash, 4, "Warn_".$i."_LongText: ".$enc->decode($single_warning->{'payload'}{'translationsLongText'}{'DE'}); - $message .= "Warn_".$i."_LongText|".$converter->convert($single_warning->{'payload'}{'translationsLongText'}{'DE'})."|"; + # Begin Language by AttrVal + if ( AttrVal( $name, 'CountryCode', '' ) eq "UK" ) { - UWZ_Log $hash, 4, "Warn_".$i."_ShortText: ".$enc->decode($single_warning->{'payload'}{'translationsShortText'}{'DE'}); - $message .= "Warn_".$i."_ShortText|".$converter->convert($single_warning->{'payload'}{'translationsShortText'}{'DE'})."|"; + UWZ_Log $hash, 4, "Warn_".$i."_LongText: ".$enc->decode($single_warning->{'payload'}{'translationsLongText'}{'EN'}); + $message .= "Warn_".$i."_LongText|".$converter->convert($single_warning->{'payload'}{'translationsLongText'}{'EN'})."|"; + + UWZ_Log $hash, 4, "Warn_".$i."_ShortText: ".$enc->decode($single_warning->{'payload'}{'translationsShortText'}{'EN'}); + $message .= "Warn_".$i."_ShortText|".$converter->convert($single_warning->{'payload'}{'translationsShortText'}{'EN'})."|"; + + } else { + + UWZ_Log $hash, 4, "Warn_".$i."_LongText: ".$enc->decode($single_warning->{'payload'}{'translationsLongText'}{'DE'}); + $message .= "Warn_".$i."_LongText|".$converter->convert($single_warning->{'payload'}{'translationsLongText'}{'DE'})."|"; + + UWZ_Log $hash, 4, "Warn_".$i."_ShortText: ".$enc->decode($single_warning->{'payload'}{'translationsShortText'}{'DE'}); + $message .= "Warn_".$i."_ShortText|".$converter->convert($single_warning->{'payload'}{'translationsShortText'}{'DE'})."|"; + } + # end language by AttrVal UWZ_Log $hash, 4, "Warn_".$i."_IconURL: http://www.unwetterzentrale.de/images/icons/".$typenames{ $single_warning->{'type'} }."-".$single_warning->{'severity'}.".gif"; $message .= "Warn_".$i."_IconURL|http://www.unwetterzentrale.de/images/icons/".$typenames{ $single_warning->{'type'} }."-".$severitycolor{ $single_warning->{'severity'} }.".gif|"; ## Hagel start - my $hagelcount = my @hagelmatch = $single_warning->{'payload'}{'translationsLongText'}{'DE'} =~ /Hagel/g; - if ( $hagelcount ne 0 ) { + my $hagelcount = 0; + # Begin Language by AttrVal + if ( AttrVal( $name, 'CountryCode', '' ) eq "UK" ) { + + $hagelcount = my @hagelmatch = $single_warning->{'payload'}{'translationsLongText'}{'EN'} =~ /Hail/g; - UWZ_Log $hash, 4, "Warn_".$i."_Hail: 1"; - $message .= "Warn_".$i."_Hail|1|"; + } else { + + $hagelcount = my @hagelmatch = $single_warning->{'payload'}{'translationsLongText'}{'DE'} =~ /Hagel/g; + } + # end language by AttrVal + if ( $hagelcount ne 0 ) { + + UWZ_Log $hash, 4, "Warn_".$i."_Hail: 1"; + $message .= "Warn_".$i."_Hail|1|"; - } else { + } else { - UWZ_Log $hash, 4, "Warn_".$i."_Hail: 0"; - $message .= "Warn_".$i."_Hail|0|"; - } + UWZ_Log $hash, 4, "Warn_".$i."_Hail: 0"; + $message .= "Warn_".$i."_Hail|0|"; + } ## Hagel end $i++; @@ -660,7 +707,10 @@ sub UWZAsHtml($;$) { $ret .= ''; - $ret .= ''; + # language by AttrVal + $ret .= '' if ( AttrVal( $hash, 'CountryCode', '' ) eq "UK" ); + $ret .= '' if ( AttrVal( $hash, 'CountryCode', '' ) eq "DE" ); + # end language by AttrVal $ret .= '
    Start:'.localtime(ReadingsVal($hash, "Warn_".$i."_Start", "")).'Ende:'.localtime(ReadingsVal($hash, "Warn_".$i."_End", "")).'End:'.localtime(ReadingsVal($hash, "Warn_".$i."_End", "")).'Ende:'.localtime(ReadingsVal($hash, "Warn_".$i."_End", "")).'
    '; $ret .= ''; } @@ -674,7 +724,10 @@ sub UWZAsHtml($;$) { $ret .= ''; @@ -700,8 +753,10 @@ sub UWZAsHtmlLite($;$) { $ret .= ''; $ret .= ''; @@ -716,7 +771,10 @@ sub UWZAsHtmlLite($;$) { $ret .= '
    '; $ret .= ''; $ret .= ''; $ret .= '
    '; - $ret .='Keine Warnungen'; + # language by AttrVal + $ret .='No Warnings' if ( AttrVal( $hash, 'CountryCode', '' ) eq "UK" ); + $ret .='Keine Warnungen' if ( AttrVal( $hash, 'CountryCode', '' ) eq "DE" ); + # end language by AttrVal $ret .= '
    '; $ret .= '
    '.ReadingsVal($hash, "Warn_".$i."_ShortText", "").'

    '; $ret .= ''; - - $ret .= ''; + # language by AttrVal + $ret .= '' if ( AttrVal( $hash, 'CountryCode', '' ) eq "UK" ); + $ret .= '' if ( AttrVal( $hash, 'CountryCode', '' ) eq "DE" ); + # end language by AttrVal $ret .= '
    Start:'.localtime(ReadingsVal($hash, "Warn_".$i."_Start", "")).'Ende:'.localtime(ReadingsVal($hash, "Warn_".$i."_End", "")).'End:'.localtime(ReadingsVal($hash, "Warn_".$i."_End", "")).'Ende:'.localtime(ReadingsVal($hash, "Warn_".$i."_End", "")).'
    '; $ret .= '
    '; @@ -751,8 +809,6 @@ sub UWZAsHtmlFP($;$) { sub UWZAsHtmlKarteLand($$) { my ($hash,$land) = @_; - # my $uwz_de_url = "http://www.unwetterzentrale.de/images/map/"; - # my $uwz_at_url = "http://unwetter.wetteralarm.at/images/map/"; my $url = UWZ_Map2Image($hash,$land); my $ret = '
    '; $ret .= ''; $ret .= ''; $ret .= '
    '; - $ret .='Keine Warnungen'; + # language by AttrVal + $ret .='No Warnings' if ( AttrVal( $hash, 'CountryCode', '' ) eq "UK" ); + $ret .='Keine Warnungen' if ( AttrVal( $hash, 'CountryCode', '' ) eq "DE" ); + # end language by AttrVal $ret .= '
    '; $ret .= '
    '; @@ -763,8 +819,10 @@ sub UWZAsHtmlKarteLand($$) { $ret .= ''; } else { - - $ret .= 'unbekannte Landbezeichnung'; + # language by AttrVal + $ret .='unknown map setting' if ( AttrVal( $hash, 'CountryCode', '' ) eq "UK" ); + $ret .= 'unbekannte Landbezeichnung' if ( AttrVal( $hash, 'CountryCode', '' ) eq "DE" ); + # end language by AttrVal } $ret .= '
    '; @@ -802,13 +860,24 @@ sub UWZAsHtmlKarteLand($$) {


    Example:
    - define Unwetterzentrale UWZ DE 86405 3600 + + define Unwetterzentrale UWZ UK 03931 1800
    + attr Unwetterzentrale CountryCode UK
    + attr Unwetterzentrale PLZ 03931
    + attr Unwetterzentrale URL http://feed.alertspro.meteogroup.com/AlertsPro/AlertsProPollService.php?method=getWarning&language=en&areaID=UWZUK03931
    + attr Unwetterzentrale download 1
    + attr Unwetterzentrale humanreadable 1
    + attr Unwetterzentrale maps eastofengland unitedkingdom

    + define UnwetterDetails weblink htmlCode {UWZAsHtml("Unwetterzentrale")}
    + define UnwetterMapE_UK weblink htmlCode {UWZAsHtmlKarteLand("Unwetterzentrale","eastofengland")}
    + define UnwetterLite weblink htmlCode {UWZAsHtmlLite("Unwetterzentrale")} +

     
  • [CountryCode]
    - Possible values: DE, AT, CH,...
    - (for other countries than germany see fhem-forum) + Possible values: DE, AT, CH, UK, ...
    + (for other countries than germany or unitedkingdom see fhem-forum)

  • [postalcode]
    @@ -891,6 +960,11 @@ sub UWZAsHtmlKarteLand($$) { Attributes