From e5af3f6e896eb8780010bbb71a7d6e2f29d244e2 Mon Sep 17 00:00:00 2001 From: Beta-User Date: Sat, 11 May 2019 14:16:45 +0000 Subject: [PATCH] 98_Heating_Control: prepare for beeing deprecated; 98_Weekdaytimer: add group functions to replace Heating_Control. git-svn-id: https://svn.fhem.de/fhem/trunk@19369 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 3 + fhem/FHEM/98_Heating_Control.pm | 42 ++++++++++--- fhem/FHEM/98_WeekdayTimer.pm | 105 +++++++++++++++++++++----------- 3 files changed, 108 insertions(+), 42 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index dc799b7f8..47514140a 100644 --- a/fhem/CHANGED +++ b/fhem/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. + - change: 98_Heating_Control.pm will be removed soon. Users will need to + change their device definitions to 98_WeekdayTimer; supporting + code is provided, but perl calls have to be changed manually. - bugfix: 73_AutoShuttersControl: fix bug roommate and windwo comfort - bugfix: 73_DoorBird: Error 404 handling for history images corrected - bugfix: 73_AutoShuttersControl: fix sunset sunrise object values diff --git a/fhem/FHEM/98_Heating_Control.pm b/fhem/FHEM/98_Heating_Control.pm index 27a566d1f..c921410f3 100644 --- a/fhem/FHEM/98_Heating_Control.pm +++ b/fhem/FHEM/98_Heating_Control.pm @@ -50,7 +50,7 @@ sub Heating_Control_Set($@) { my ($hash, @a) = @_; return "no set value specified" if(int(@a) < 2); - return "Unknown argument $a[1], choose one of enable disable " if($a[1] eq "?"); + return "Unknown argument $a[1], choose one of enable disable ConvertToWDT:noArg" if($a[1] eq "?"); my $name = shift @a; my $v = join(" ", @a); @@ -61,6 +61,8 @@ sub Heating_Control_Set($@) { fhem("attr $name disable 0"); } elsif ($v eq "disable") { fhem("attr $name disable 1"); + } elsif ($v eq "ConvertToWDT") { + Heating_Control_ConvertToWDT(); } return undef; } @@ -71,7 +73,7 @@ sub Heating_Control_Get($@) { ######################################################################## sub Heating_Control_Define($$){ my ($hash, $def) = @_; - + Log3 $hash, 3, "Heating_Control is deprecated, use WeekdayTimer instead!"; my $ret = WeekdayTimer_Define($hash, $def); return $ret; } @@ -122,21 +124,46 @@ sub Heating_Control_SetAllTemps() { # {Heating_Control_SetAllTemps()} Log3 undef, 3, "Heating_Control_SetAllTemps() done on: ".join(" ",@hcNamen ); } +######################################################################## +sub Heating_Control_ConvertToWDT() { + my @hcNamen = sort keys %{$modules{Heating_Control}{defptr}}; + foreach my $hcName ( @hcNamen ) { + my $hash = $defs{$hcName}; + my $definition = $defs{$hcName}{DEF}; + my $windows = AttrVal($hcName,"windowSensor",undef); + my @a = GetDefAndAttr($hcName); + shift @a; shift @a; #delete define and uuid + my @b = GetAllReadings($hcName); + CommandDelete(undef,$hcName); + CommandDefine(undef,"$hcName WeekdayTimer $definition"); + CommandAttr(undef, "$hcName WDT_delayedExecutionDevices $windows"); + CommandAttr(undef, "$hcName WDT_Group former_HC"); + foreach my $linesa ( @a ){ + AnalyzeCommand(undef, "$linesa") unless ($linesa =~ m/^attr $hcName windowSensor/); + } + foreach my $linesb ( @b ){ + AnalyzeCommand(undef, "$linesb"); + } + } + Log3 undef, 3, "Heating_Control_ConvertToWDT() done on: ".join(" ",@hcNamen ); +} + 1; =pod =item device -=item summary sends heating commands to heating at defined times -=item summary_DE sendet Temperaturwerte zu festgelegen Zeiten an eine Heizung +=item summary sends heating commands to heating at defined times - deprecated module! +=item summary_DE - nicht mehr supportetes Modul, bitte stattdessen WeekdayTimer nutzen! =begin html

Heating Control

+ + =end html