diff --git a/fhem/FHEM/98_Heating_Control.pm b/fhem/FHEM/98_Heating_Control.pm index 5ab26981a..28bdfdf35 100644 --- a/fhem/FHEM/98_Heating_Control.pm +++ b/fhem/FHEM/98_Heating_Control.pm @@ -95,13 +95,13 @@ Heating_Control_Define($$) } for(my $i=0; $i<@a; $i++) { - #prüfen auf Angabe eines Schaltpunktes + #prüfen auf Angabe eines Schaltpunktes my @t = split(/\|/, $a[$i]); my $anzahl = @t; if ( $anzahl ~~ [2,3]) { push(@switchingtimes, $a[$i]); } else { - #der Rest ist das auzuführende Kommando/condition + #der Rest ist das auzuführende Kommando/condition $conditionOrCommand = trim(join(" ", @a[$i..@a-1])); last; } @@ -145,13 +145,13 @@ Heating_Control_Define($$) $dayNumber{$day} = $idx; $idx++; } - #Aufzählung 1234 ... + #Aufzählung 1234 ... if ( $daylist =~ m/^(\d){0,7}$/g) { @days = split("", $daylist); @hdays{@days}=1; - # Aufzählung Sa,So,... | Mo-Di,Do,Fr-Mo + # Aufzählung Sa,So,... | Mo-Di,Do,Fr-Mo } elsif ($daylist =~ m/^($daysRegExp(,|-|$)){0,7}$/g ) { my $oldDay, my $oldDel; @@ -193,21 +193,25 @@ Heating_Control_Define($$) } } - # Profile sortiert aufbauen - for (my $d=1; $d<=7; $d++) { - foreach my $st (sort (keys %{ $hash->{helper}{SWITCHINGTIME}{$d} })) { - my $temp = $hash->{helper}{SWITCHINGTIME}{$d}{$st}; - $hash->{"PROFILE ".($d).": ".$Wochentage[$d-1]} .= sprintf("%s: %.1f°C, ", $st, $temp); - } - } - - #desired-temp des Zieldevices auswählen + #desired-temp des Zieldevices auswählen if($defs{$device}{TYPE} eq "MAX") { $hash->{helper}{DESIRED_TEMP_READING} = "desiredTemperature" } else { $hash->{helper}{DESIRED_TEMP_READING} = "desired-temp"; } + $hash->{helper}{UNIT} = "°C"; + + my $unit = $hash->{helper}{UNIT}; + + # Profile sortiert aufbauen + for (my $d=1; $d<=7; $d++) { + foreach my $st (sort (keys %{ $hash->{helper}{SWITCHINGTIME}{$d} })) { + my $temp = $hash->{helper}{SWITCHINGTIME}{$d}{$st}; + $hash->{"PROFILE ".($d).": ".$Wochentage[$d-1]} .= sprintf("%s: %.1f%s, ", $st, $temp, $unit); + } + } + my $now = time(); InternalTimer ($now+30, "Heating_Control_Update", $hash, 0); @@ -288,6 +292,7 @@ Heating_Control_Update($) } my $name = $hash->{NAME}; + my $unit = $hash->{helper}{UNIT}; my $command; Log $loglevel, "NowSwitch: ".strftime('%d.%m.%Y %H:%M:%S',localtime($nowSwitch))." ; AktDesiredTemp: $AktDesiredTemp ; newDesTemperature: $newDesTemperature"; @@ -315,8 +320,8 @@ Heating_Control_Update($) InternalTimer($nextSwitch, "Heating_Control_Update", $hash, 0); readingsBeginUpdate($hash); readingsBulkUpdate ($hash, "nextUpdate", strftime("%d.%m.%Y %H:%M:%S",localtime($nextSwitch))); - readingsBulkUpdate ($hash, "nextValue", $nextDesTemperature . "°C"); - readingsBulkUpdate ($hash, "state", $newDesTemperature . "°C"); + readingsBulkUpdate ($hash, "nextValue", $nextDesTemperature . $unit); + readingsBulkUpdate ($hash, "state", $newDesTemperature . $unit); readingsEndUpdate ($hash, defined($hash->{LOCAL} ? 0 : 1)); return 1; @@ -337,6 +342,7 @@ sub SortNumber { =begin html +
define HCB Heating_Control Bad_Heizung 12345|05:20|21 12345|05:25|12 17:20|21 17:25|12
+ Mo-Fr are setting the temperature at 05:20 to 21°C, and at 05:25 to 12°C. + Every day will be set the temperature at 17:20 to 21°C and 17:25 to 12°C.
-
-
define HCW Heating_Control WZ_Heizung 07:00|16 Mo,Di,Do-Fr|16:00|18.5 20:00|12
+
define HCW Heating_Control WZ_Heizung 07:00|16 Mo,Tu,Th-Fr|16:00|18.5 20:00|12
{fhem("set dummy on"); fhem("set @ desired-temp %");}
At the given times and weekdays only(!) the command will be executed.define HCW Heating_Control WZ_Heizung Sa-So,Mi|08:00|21 (ReadingsVal("WeAreThere", "state", "no") eq "yes")
+ define HCW Heating_Control WZ_Heizung Sa-Su,We|08:00|21 (ReadingsVal("WeAreThere", "state", "no") eq "yes")
The temperature is only set if the dummy variable WeAreThere is "yes".
define <name> Heating_Control <device> <profile> <command>|<condition>
set <device> desired-temp <temp>
dem Device mitgeteilt. Ist eine <condition> angegeben und ist zum Schaltpunkt der Ausdruck unwahr,
- so wird dieser Schaltpunkt nicht ausgeführt.Folgende Parameter sind im Define definiert:
Beispiel:
define HCB Heating_Control Bad_Heizung 12345|05:20|21 12345|05:25|12 17:20|21 17:25|12
+ Mo-Fr wird die Temperatur um 05:20Uhr auf 21°C, und um 05:25Uhr auf 12°C gesetzt. + Jeden Tag wird die Temperatur um 17:20Uhr auf 21°C und 17:25Uhr auf 12°C gesetzt.
define HCW Heating_Control WZ_Heizung 07:00|16 Mo,Di,Mi|16:00|18.5 20:00|12
{fhem("set dummy on"); fhem("set @ desired-temp %");}
- Zu den definierten Schaltzeiten wird nur(!) der in {} angegebene Perl-Code ausgeführt.
+ Zu den definierten Schaltzeiten wird nur(!) der in {} angegebene Perl-Code ausgeführt.
define HCW Heating_Control WZ_Heizung Sa-So,Mi|08:00|21 (ReadingsVal("WeAreThere", "state", "no") eq "yes")
Die zu setzende Temperatur wird nur gesetzt, falls die Dummy Variable WeAreThere = "yes" ist.