2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-05 08:20:23 +00:00

- bugfixing when specifying days as So-Di or Su-Th

- improovements displaying HC as active/inactive.

git-svn-id: https://svn.fhem.de/fhem/trunk@3243 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
dietmar63 2013-06-03 18:47:29 +00:00
parent 32eab213bb
commit f13db8477f

View File

@ -28,9 +28,6 @@ use strict;
use warnings; use warnings;
use POSIX; use POSIX;
sub Log($$);
sub Heating_Control_Update($);
##################################### #####################################
sub sub
Heating_Control_Initialize($) Heating_Control_Initialize($)
@ -53,7 +50,6 @@ Heating_Control_Get($@)
return "argument is missing" if(int(@a) != 2); return "argument is missing" if(int(@a) != 2);
$hash->{LOCAL} = 1; $hash->{LOCAL} = 1;
#Heating_Control_GetUpdate($hash);
delete $hash->{LOCAL}; delete $hash->{LOCAL};
my $reading= $a[1]; my $reading= $a[1];
my $value; my $value;
@ -74,7 +70,7 @@ Heating_Control_Define($$)
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> $hash->{TYPE} <device> <switching times> <condition|command>"
if(@a < 4); if(@a < 4);
my $name = shift @a; my $name = shift @a;
@ -113,7 +109,7 @@ Heating_Control_Define($$)
$hash->{NAME} = $name; $hash->{NAME} = $name;
$hash->{DEVICE} = $device; $hash->{DEVICE} = $device;
$modules{Heating_Control}{defptr}{$hash->{NAME}} = $hash; $modules{$hash->{TYPE}}{defptr}{$hash->{NAME}} = $hash;
$hash->{helper}{SWITCHINGTIMES} = join(" ", @switchingtimes); $hash->{helper}{SWITCHINGTIMES} = join(" ", @switchingtimes);
if($conditionOrCommand =~ m/^\(.*\)$/g) { #condition (*) if($conditionOrCommand =~ m/^\(.*\)$/g) { #condition (*)
$hash->{helper}{CONDITION} = $conditionOrCommand; $hash->{helper}{CONDITION} = $conditionOrCommand;
@ -173,7 +169,7 @@ Heating_Control_Define($$)
if ($low <= $high) { if ($low <= $high) {
@subDays = ($low .. $high); @subDays = ($low .. $high);
} else { } else {
@subDays = (1 .. $high, $low .. 7); @subDays = ($dayNumber{so} .. $high, $low .. $dayNumber{sa});
} }
@hdays{@subDays}=1; @hdays{@subDays}=1;
} else { } else {
@ -205,9 +201,6 @@ Heating_Control_Define($$)
$hash->{helper}{DESIRED_TEMP_READING} = "desired-temp"; $hash->{helper}{DESIRED_TEMP_READING} = "desired-temp";
} }
$hash->{helper}{UNIT} = "°C";
my $unit = $hash->{helper}{UNIT};
my $rWochentage; my $rWochentage;
if ($englisch) { if ($englisch) {
$rWochentage = \@Wochentage_en; $rWochentage = \@Wochentage_en;
@ -225,7 +218,7 @@ Heating_Control_Define($$)
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
my $now = time(); my $now = time();
InternalTimer ($now+30, "Heating_Control_Update", $hash, 0); InternalTimer ($now+30, "$hash->{TYPE}_Update", $hash, 0);
readingsBeginUpdate ($hash); readingsBeginUpdate ($hash);
readingsBulkUpdate ($hash, "nextUpdate", strftime("Heute, %H:%M:%S",localtime($now+30))); readingsBulkUpdate ($hash, "nextUpdate", strftime("Heute, %H:%M:%S",localtime($now+30)));
@ -242,7 +235,7 @@ Heating_Control_Undef($$)
my ($hash, $arg) = @_; my ($hash, $arg) = @_;
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
delete $modules{Heating_Control}{defptr}{$hash->{NAME}}; delete $modules{$hash->{TYPE}}{defptr}{$hash->{NAME}};
return undef; return undef;
} }
@ -301,7 +294,6 @@ Heating_Control_Update($)
} }
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $unit = $hash->{helper}{UNIT};
my $command; my $command;
#$nextSwitch += get_SummerTimeOffset($now, $nextSwitch); #$nextSwitch += get_SummerTimeOffset($now, $nextSwitch);
@ -327,13 +319,13 @@ Heating_Control_Update($)
Log GetLogLevel($name,3), $ret if($ret); Log GetLogLevel($name,3), $ret if($ret);
} }
my $active; my $active = 1;
if (defined $hash->{helper}{CONDITION}) { if (defined $hash->{helper}{CONDITION}) {
$active = eval ($hash->{helper}{CONDITION}); $active = eval ($hash->{helper}{CONDITION});
} }
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
InternalTimer($nextSwitch, "Heating_Control_Update", $hash, 0); InternalTimer($nextSwitch, "$hash->{TYPE}_Update", $hash, 0);
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
readingsBulkUpdate ($hash, "nextUpdate", strftime("%d.%m.%Y %H:%M:%S",localtime($nextSwitch))); readingsBulkUpdate ($hash, "nextUpdate", strftime("%d.%m.%Y %H:%M:%S",localtime($nextSwitch)));