From fe7c5284c322805fcf53cfcb61ebd08436d94e39 Mon Sep 17 00:00:00 2001 From: dietmar63 Date: Tue, 30 Apr 2013 17:42:29 +0000 Subject: [PATCH] Heating_Control_SetAllTemps() added to force the setting of all definded Heating_Controls git-svn-id: https://svn.fhem.de/fhem/trunk@3142 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_Heating_Control.pm | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/fhem/FHEM/98_Heating_Control.pm b/fhem/FHEM/98_Heating_Control.pm index bd83318a9..5229df715 100644 --- a/fhem/FHEM/98_Heating_Control.pm +++ b/fhem/FHEM/98_Heating_Control.pm @@ -41,6 +41,7 @@ Heating_Control_Initialize($) $hash->{DefFn} = "Heating_Control_Define"; $hash->{UndefFn} = "Heating_Control_Undef"; $hash->{GetFn} = "Heating_Control_Get"; + $hash->{UpdFn} = "Heating_Control_Update"; $hash->{AttrList}= "disable:0,1 loglevel:0,1,2,3,4,5 ". $readingFnAttributes; } @@ -71,7 +72,6 @@ Heating_Control_Define($$) { my ($hash, $def) = @_; - RemoveInternalTimer($hash); my @a = split("[ \t]+", $def); return "Usage: define Heating_Control " @@ -224,6 +224,7 @@ Heating_Control_Define($$) } } + RemoveInternalTimer($hash); my $now = time(); InternalTimer ($now+30, "Heating_Control_Update", $hash, 0); @@ -283,8 +284,8 @@ Heating_Control_Update($) $newDesTemperature = $hash->{helper}{SWITCHINGTIME}{$days[$d]}{$st}; $nowSwitch = $now; } else { - $nextSwitch = $next; $nextDesTemperature = $hash->{helper}{SWITCHINGTIME}{$days[$d]}{$st}; + $nextSwitch = $next; last; } } @@ -320,6 +321,7 @@ Heating_Control_Update($) Log GetLogLevel($name,3), $ret if($ret); } + RemoveInternalTimer($hash); InternalTimer($nextSwitch, "Heating_Control_Update", $hash, 0); readingsBeginUpdate($hash); @@ -330,6 +332,18 @@ Heating_Control_Update($) return 1; } +# +sub Heating_Control_SetAllTemps() { # {Heating_Control_SetAllTemps()} + + foreach my $hc ( sort keys %{$modules{Heating_Control}{defptr}} ) { + my $hash = $modules{Heating_Control}{defptr}{$hc}; + + if($hash->{helper}{CONDITION}) { + next if (!(eval ($hash->{helper}{CONDITION}))) ; + } + Heating_Control_Update($hash); + } +} sub SortNumber { if($a < $b)