2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-20 01:06:04 +00:00

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
This commit is contained in:
dietmar63 2013-04-30 17:42:29 +00:00
parent b3457d80df
commit 6b25ebe77f

View File

@ -41,6 +41,7 @@ Heating_Control_Initialize($)
$hash->{DefFn} = "Heating_Control_Define"; $hash->{DefFn} = "Heating_Control_Define";
$hash->{UndefFn} = "Heating_Control_Undef"; $hash->{UndefFn} = "Heating_Control_Undef";
$hash->{GetFn} = "Heating_Control_Get"; $hash->{GetFn} = "Heating_Control_Get";
$hash->{UpdFn} = "Heating_Control_Update";
$hash->{AttrList}= "disable:0,1 loglevel:0,1,2,3,4,5 ". $hash->{AttrList}= "disable:0,1 loglevel:0,1,2,3,4,5 ".
$readingFnAttributes; $readingFnAttributes;
} }
@ -71,7 +72,6 @@ Heating_Control_Define($$)
{ {
my ($hash, $def) = @_; my ($hash, $def) = @_;
RemoveInternalTimer($hash);
my @a = split("[ \t]+", $def); my @a = split("[ \t]+", $def);
return "Usage: define <name> Heating_Control <device> <switching times> <condition|command>" return "Usage: define <name> Heating_Control <device> <switching times> <condition|command>"
@ -224,6 +224,7 @@ Heating_Control_Define($$)
} }
} }
RemoveInternalTimer($hash);
my $now = time(); my $now = time();
InternalTimer ($now+30, "Heating_Control_Update", $hash, 0); InternalTimer ($now+30, "Heating_Control_Update", $hash, 0);
@ -283,8 +284,8 @@ Heating_Control_Update($)
$newDesTemperature = $hash->{helper}{SWITCHINGTIME}{$days[$d]}{$st}; $newDesTemperature = $hash->{helper}{SWITCHINGTIME}{$days[$d]}{$st};
$nowSwitch = $now; $nowSwitch = $now;
} else { } else {
$nextSwitch = $next;
$nextDesTemperature = $hash->{helper}{SWITCHINGTIME}{$days[$d]}{$st}; $nextDesTemperature = $hash->{helper}{SWITCHINGTIME}{$days[$d]}{$st};
$nextSwitch = $next;
last; last;
} }
} }
@ -320,6 +321,7 @@ Heating_Control_Update($)
Log GetLogLevel($name,3), $ret if($ret); Log GetLogLevel($name,3), $ret if($ret);
} }
RemoveInternalTimer($hash);
InternalTimer($nextSwitch, "Heating_Control_Update", $hash, 0); InternalTimer($nextSwitch, "Heating_Control_Update", $hash, 0);
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
@ -330,6 +332,18 @@ Heating_Control_Update($)
return 1; 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 { sub SortNumber {
if($a < $b) if($a < $b)