From 18d185faeb65c0a113a6f579028ae69cd49746d5 Mon Sep 17 00:00:00 2001 From: dietmar63 Date: Mon, 3 Jun 2013 18:47:29 +0000 Subject: [PATCH] - bugfixing when specifying days as So-Di or Su-Th - improovements displaying HC as active/inactive. git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@3243 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_Heating_Control.pm | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/fhem/FHEM/98_Heating_Control.pm b/fhem/FHEM/98_Heating_Control.pm index 54686e390..8f4426597 100644 --- a/fhem/FHEM/98_Heating_Control.pm +++ b/fhem/FHEM/98_Heating_Control.pm @@ -28,9 +28,6 @@ use strict; use warnings; use POSIX; -sub Log($$); -sub Heating_Control_Update($); - ##################################### sub Heating_Control_Initialize($) @@ -53,7 +50,6 @@ Heating_Control_Get($@) return "argument is missing" if(int(@a) != 2); $hash->{LOCAL} = 1; - #Heating_Control_GetUpdate($hash); delete $hash->{LOCAL}; my $reading= $a[1]; my $value; @@ -74,7 +70,7 @@ Heating_Control_Define($$) my @a = split("[ \t]+", $def); - return "Usage: define Heating_Control " + return "Usage: define $hash->{TYPE} " if(@a < 4); my $name = shift @a; @@ -113,7 +109,7 @@ Heating_Control_Define($$) $hash->{NAME} = $name; $hash->{DEVICE} = $device; - $modules{Heating_Control}{defptr}{$hash->{NAME}} = $hash; + $modules{$hash->{TYPE}}{defptr}{$hash->{NAME}} = $hash; $hash->{helper}{SWITCHINGTIMES} = join(" ", @switchingtimes); if($conditionOrCommand =~ m/^\(.*\)$/g) { #condition (*) $hash->{helper}{CONDITION} = $conditionOrCommand; @@ -173,7 +169,7 @@ Heating_Control_Define($$) if ($low <= $high) { @subDays = ($low .. $high); } else { - @subDays = (1 .. $high, $low .. 7); + @subDays = ($dayNumber{so} .. $high, $low .. $dayNumber{sa}); } @hdays{@subDays}=1; } else { @@ -205,9 +201,6 @@ Heating_Control_Define($$) $hash->{helper}{DESIRED_TEMP_READING} = "desired-temp"; } - $hash->{helper}{UNIT} = "°C"; - my $unit = $hash->{helper}{UNIT}; - my $rWochentage; if ($englisch) { $rWochentage = \@Wochentage_en; @@ -225,7 +218,7 @@ Heating_Control_Define($$) RemoveInternalTimer($hash); my $now = time(); - InternalTimer ($now+30, "Heating_Control_Update", $hash, 0); + InternalTimer ($now+30, "$hash->{TYPE}_Update", $hash, 0); readingsBeginUpdate ($hash); readingsBulkUpdate ($hash, "nextUpdate", strftime("Heute, %H:%M:%S",localtime($now+30))); @@ -242,7 +235,7 @@ Heating_Control_Undef($$) my ($hash, $arg) = @_; RemoveInternalTimer($hash); - delete $modules{Heating_Control}{defptr}{$hash->{NAME}}; + delete $modules{$hash->{TYPE}}{defptr}{$hash->{NAME}}; return undef; } @@ -301,7 +294,6 @@ Heating_Control_Update($) } my $name = $hash->{NAME}; - my $unit = $hash->{helper}{UNIT}; my $command; #$nextSwitch += get_SummerTimeOffset($now, $nextSwitch); @@ -327,13 +319,13 @@ Heating_Control_Update($) Log GetLogLevel($name,3), $ret if($ret); } - my $active; + my $active = 1; if (defined $hash->{helper}{CONDITION}) { $active = eval ($hash->{helper}{CONDITION}); } RemoveInternalTimer($hash); - InternalTimer($nextSwitch, "Heating_Control_Update", $hash, 0); + InternalTimer($nextSwitch, "$hash->{TYPE}_Update", $hash, 0); readingsBeginUpdate($hash); readingsBulkUpdate ($hash, "nextUpdate", strftime("%d.%m.%Y %H:%M:%S",localtime($nextSwitch)));