From 216899c2da7621d38ef28b60e49e6c03d352901d Mon Sep 17 00:00:00 2001 From: betateilchen <> Date: Tue, 4 Feb 2014 17:09:26 +0000 Subject: [PATCH] added: ShutdownFn fixed: minor bugs git-svn-id: https://svn.fhem.de/fhem/trunk@4808 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/51_BBB_BMP180.pm | 13 ++++++++----- fhem/FHEM/55_GDS.pm | 20 ++++++++++++-------- fhem/FHEM/71_LISTENLIVE.pm | 20 ++++++++++++++------ fhem/FHEM/98_openweathermap.pm | 16 ++++++++-------- 4 files changed, 42 insertions(+), 27 deletions(-) diff --git a/fhem/FHEM/51_BBB_BMP180.pm b/fhem/FHEM/51_BBB_BMP180.pm index 01ac5d1e7..25e509d39 100644 --- a/fhem/FHEM/51_BBB_BMP180.pm +++ b/fhem/FHEM/51_BBB_BMP180.pm @@ -33,11 +33,6 @@ use warnings; use feature qw/say switch/; use Time::HiRes qw(gettimeofday); -sub BBB_BMP180_Define($$); -sub BBB_BMP180_Undefine($$); -sub BBB_BMP180_Get($@); -sub BBB_BMP180_Notify($$); - sub BBB_BMP180_Initialize($){ my ($hash) = @_; $hash->{DefFn} = "BBB_BMP180_Define"; @@ -45,6 +40,7 @@ sub BBB_BMP180_Initialize($){ $hash->{GetFn} = "BBB_BMP180_Get"; $hash->{AttrFn} = "BBB_BMP180_Attr"; $hash->{NotifyFn} = "BBB_BMP180_Notify"; + $hash->{ShutdoenFn} = "BBB_BMP180_Shutdown"; $hash->{AttrList} = "bbbRoundPressure:0,1 ". "bbbRoundTemperature:0,1 ". "bbbInterval ". @@ -83,6 +79,13 @@ sub BBB_BMP180_Undefine($$){ return; } +sub BBB_BMP180_Shutdown($) { + my ($hash) = @_; + my $name = $hash->{NAME}; + Log3 ($name,4,"BBB_BMP180 $name: shutdown requested"); + return undef; +} + sub BBB_BMP180_Get($@){ my ($hash, @a) = @_; my $name = $hash->{NAME}; diff --git a/fhem/FHEM/55_GDS.pm b/fhem/FHEM/55_GDS.pm index 1dfe97c8a..65668aad3 100644 --- a/fhem/FHEM/55_GDS.pm +++ b/fhem/FHEM/55_GDS.pm @@ -38,13 +38,6 @@ use XML::Simple; use HttpUtils; require LWP::UserAgent; -sub GDS_Define($$$); -sub GDS_Undef($$); -sub GDS_Set($@); -sub GDS_Get($@); -sub GDS_Attr(@); - - my ($bulaList, $cmapList, %rmapList, $fmapList, %bula2bulaShort, %bulaShort2dwd, %dwd2Dir, %dwd2Name, $alertsXml, %capCityHash, %capCellHash, $sList, $aList); @@ -66,6 +59,7 @@ sub GDS_Initialize($) { $hash->{UndefFn} = "GDS_Undef"; $hash->{GetFn} = "GDS_Get"; $hash->{SetFn} = "GDS_Set"; + $hash->{ShutdownFn} = "GDS_Shutdown"; $hash->{AttrFn} = "GDS_Attr"; $hash->{AttrList} = "gdsFwName gdsFwType:0,1,2,3,4,5,6,7 ". "gdsAll:0,1 gdsDebug:0,1 gdsLong:0,1 gdsPolygon:0,1 ". @@ -143,6 +137,13 @@ sub GDS_Undef($$) { return undef; } +sub GDS_Shutdown($) { + my ($hash) = @_; + my $name = $hash->{NAME}; + Log3 ($name,4,"GDS $name: shutdown requested"); + return undef; +} + sub GDS_Set($@) { my ($hash, @a) = @_; my $name = $hash->{NAME}; @@ -777,7 +778,7 @@ sub retrieveFile($$;$$$){ eval { $ftp = Net::FTP->new( "ftp-outgoing2.dwd.de", Debug => 0, - Timeout => 360, + Timeout => 10, FirewallType => $proxyType, Firewall => $proxyName); if(defined($ftp)){ @@ -1082,6 +1083,9 @@ sub initDropdownLists($){ # # 2013-11-03 added error handling for malformed XML files from GDS # +# 2014-02-04 added ShutdownFn +# changed FTP Timeout +# #################################################################################################### # # Further informations diff --git a/fhem/FHEM/71_LISTENLIVE.pm b/fhem/FHEM/71_LISTENLIVE.pm index 9f85f97d1..2194c29c8 100644 --- a/fhem/FHEM/71_LISTENLIVE.pm +++ b/fhem/FHEM/71_LISTENLIVE.pm @@ -70,6 +70,10 @@ # Updated: commandref documentations # internal help texts # +# 2014-02-04 +# Added: ShutdownFn +# Changed: Undef will delete presence, too +# ############################################################################## package main; @@ -85,12 +89,6 @@ use MIME::Base64; use Time::HiRes qw(gettimeofday sleep usleep); use feature qw(say switch); -sub LISTENLIVE_Set($@); -sub LISTENLIVE_Get($@); -sub LISTENLIVE_Define($$); -sub LISTENLIVE_GetStatus($;$); -sub LISTENLIVE_Undefine($$); - sub HMT350_RCLayout(); sub HMT350_RCmakenotify($$); @@ -158,6 +156,7 @@ sub LISTENLIVE_Initialize($) { my ($hash) = @_; $hash->{DefFn} = "LISTENLIVE_Define"; $hash->{UndefFn} = "LISTENLIVE_Undefine"; + $hash->{ShutdownFn} = "LISTENLIVE_Shutdown"; $hash->{AttrFn} = "LISTENLIVE_Attr"; $hash->{SetFn} = "LISTENLIVE_Set"; $hash->{GetFn} = "LISTENLIVE_Get"; @@ -231,10 +230,19 @@ sub LISTENLIVE_Define($$) { sub LISTENLIVE_Undefine($$) { my($hash, $name) = @_; + CommandDelete(undef, "pres_".$name); RemoveInternalTimer($hash); return undef; } +sub LISTENLIVE_Shutdown($) { + my ($hash) = @_; + my $name = $hash->{NAME}; + Log3 ($name,4,"LISTENLIVE $name: shutdown requested"); + return undef; +} + + sub LISTENLIVE_Attr($@) { my @a = @_; my $hash = $defs{$a[1]}; diff --git a/fhem/FHEM/98_openweathermap.pm b/fhem/FHEM/98_openweathermap.pm index 6a6dcf671..1c5b1ab55 100644 --- a/fhem/FHEM/98_openweathermap.pm +++ b/fhem/FHEM/98_openweathermap.pm @@ -73,14 +73,6 @@ my $ua = LWP::UserAgent->new; # test $ua->timeout(10); # test $ua->env_proxy; # test -sub OWO_Set($@); -sub OWO_Get($@); -sub OWO_Attr(@); -sub OWO_Notify($$); -sub OWO_Define($$); -sub OWO_GetStatus($;$); -sub OWO_Undefine($$); - sub OWO_abs2rel($$$); sub OWO_isday($$); @@ -94,6 +86,7 @@ sub openweathermap_Initialize($) { $hash->{UndefFn} = "OWO_Undefine"; $hash->{NotifyFn} = "OWO_Notify"; $hash->{AttrFn} = "OWO_Attr"; + $hash->{ShutdownFn} = "OWO_Shutdown"; $hash->{AttrList} = "do_not_notify:0,1 ". "owoGetUrl owoSendUrl owoInterval:600,900,1800,3600 ". @@ -106,6 +99,13 @@ sub openweathermap_Initialize($) { $readingFnAttributes; } +sub OWO_Shutdown($) { + my ($hash) = @_; + my $name = $hash->{NAME}; + Log3 ($name,4,"owo $name: shutdown requested"); + return undef; +} + sub OWO_Set($@){ my ($hash, @a) = @_; my $name = $hash->{NAME};