From 76201682dfb7d5c0a07d22cc9e9ea67a44062a64 Mon Sep 17 00:00:00 2001 From: dietmar63 <> Date: Sun, 4 Dec 2016 21:42:11 +0000 Subject: [PATCH] 98_Heating_Control, 98_WeekdayTimer: a bug fixed when starting a WDT or a HC an trying to switch in the past. now being able to use on-till:13:30:30 as a parameter the parameter can now be a Perlcode git-svn-id: https://svn.fhem.de/fhem/trunk@12715 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_Heating_Control.pm | 98 ++++++++++++++++++++++++------- fhem/FHEM/98_WeekdayTimer.pm | 100 +++++++++++++++++++++++--------- 2 files changed, 149 insertions(+), 49 deletions(-) diff --git a/fhem/FHEM/98_Heating_Control.pm b/fhem/FHEM/98_Heating_Control.pm index b97037a4e..ebf7f0ccf 100644 --- a/fhem/FHEM/98_Heating_Control.pm +++ b/fhem/FHEM/98_Heating_Control.pm @@ -211,7 +211,7 @@ sub Heating_Control_SetAllTemps() { # {Heating_Control_SetAllTemps()} The parameter $NAME and $EVENT will be interpreted.
- Example: + Examples:
define HCB Heating_Control Bad_Heizung 12345|05:20|21 12345|05:25|comfort 17:20|21 17:25|eco
define HeizStatus2 notify Heating:. * {Heating_Control_SetAllTemps()}
Some definitions without comment:
-
+
+ the list of days can be set globaly for the whole Heating_Control:
+
-
- define hc WeekdayTimer WDdevice de 7|23:35|veryHigh 34|23:30|low 23:30|high 23:15|off 8|23:45|down
- define hc WeekdayTimer WDdevice de fr,$we|23:35|veryHigh 34|23:30|low 23:30|high 23:15|off 12|23:45|down
- define hc WeekdayTimer WDdevice de 20:35|veryHigh 34|14:30|low 21:30|high 21:15|off 12|23:00|down
-
- define hw WeekdayTimer WDdevice de mo-so, $we|{sunrise_abs_dat($date)}|on mo-so, $we|{sunset_abs_dat($date)}|off
- define ht WeekdayTimer WDdevice de mo-so,!$we|{sunrise_abs_dat($date)}|on mo-so,!$we|{sunset_abs_dat($date)}|off
- define hh WeekdayTimer WDdevice de {sunrise_abs_dat($date)}|on {sunset_abs_dat($date)}|off
+
- The daylist can be given globaly for the whole WeekdayTimer:
+ define hc Heating_Control HeizungKueche de 7|23:35|25 34|23:30|22 23:30|16 23:15|22 8|23:45|16
+ define hc Heating_Control HeizungKueche de fr,$we|23:35|25 34|23:30|22 23:30|16 23:15|22 12|23:45|16
+ define hc Heating_Control HeizungKueche de 20:35|25 34|14:30|22 21:30|16 21:15|22 12|23:00|16
- define hx WeekdayTimer WDdevice de 22:35|hi 23:00|on
+ define hw Heating_Control HeizungKueche de mo-so, $we|{sunrise_abs_dat($date)}|18 mo-so, $we|{sunset_abs_dat($date)}|22
+ define ht Heating_Control HeizungKueche de mo-so,!$we|{sunrise_abs_dat($date)}|18 mo-so,!$we|{sunset_abs_dat($date)}|22
+
+ define hh Heating_Control HeizungKueche de {sunrise_abs_dat($date)}|19 {sunset_abs_dat($date)}|21
+ define hx Heating_Control HeizungKueche de 22:35|25 23:00|16
+ An example to be able to temporarily boost the temperature for one hour:
+
- define WD_Wohnen_an WeekdayTimer WDdevice de !$we 09:00|an 19:00|aus (bedingung($NAME, $EVENT)
- define WD_Wohnen_an WeekdayTimer WDdevice de $we 09:00|an 19:00|aus (bedingung($NAME, $EVENT)
- define WD_Wohnen_an WeekdayTimer WDdevice de 78 09:00|an 19:00|aus (bedingung($NAME, $EVENT)
- define WD_Wohnen_an WeekdayTimer WDdevice de 57 09:00|an 19:00|aus (bedingung($NAME, $EVENT)
- define WD_Wohnen_an WeekdayTimer WDdevice de fr,$we 09:00|an 19:00|aus (bedingung($NAME, $EVENT)
+ define HeizungWohnen_an_wt Heating_Control HeizungWohnen de !$we 09:00|19 (heizungAnAus("Ein"))
+ define HeizungWohnen_an_we Heating_Control HeizungWohnen de $we 09:00|19 (heizungAnAus("Ein"))
+ define HeizungWohnen_an_we Heating_Control HeizungWohnen de 78 09:00|19 (heizungAnAus("Ein"))
+ define HeizungWohnen_an_we Heating_Control HeizungWohnen de 57 09:00|19 (heizungAnAus("Ein"))
+ define HeizungWohnen_an_we Heating_Control HeizungWohnen de fr,$we 09:00|19 (heizungAnAus("Ein"))
+ and using a "HeatingBath_Boost" dummy variable:
+
+ define hc Heating_Control HeatingBath de !$we|05:00|{HC_WithBoost(23,"HeatingBath")} $we|07:00|{HC_WithBoost(23,"HeatingBath")} 23:00|{HC_WithBoost(20,"HeatingBath")}
+
+ and the perl subroutine in 99_myUtils.pm (or the like)
+
+ define HeatingBath_Boost dummy
+ attr HeatingBath_Boost setList state:0,23,24,25
+ attr HeatingBath_Boost webCmd state
+ define di_ResetBoostBath DOIF ([HeatingBath_Boost] > 0)
+ ({Heating_Control_SetAllTemps()}, defmod di_ResetBoostBath_Reset at +01:00:00 set HeatingBath_Boost 0)
+ DOELSE
+ ({Heating_Control_SetAllTemps()})
+ attr di_ResetBoostBath do always
+
+ Now you can set "HeatingBath_Boost" in the web interface for a one-hour boost of 3 degrees in the bath.
+ (you can trigger that using the PRESENCE function using your girlfriend's device... grin).
+
+ Easy to extend this with a vacation timer using another dummy variable, here
+ sub HC_BathWithBoost {
+ my $numParams = @_;
+ my ($degree, $boostPrefix) = @_;
+ if ($numParams > 1)
+ {
+ my $boost = ReadingsVal($boostPrefix . "_Boost", "state", "0");
+ return $boost if ($boost =~ m/^\d+$/) && ($boost > 0); # boost?
+ }
+ return $degree; # otherwise return given temperature
+ }
+
VacationTemp
.
+ Then you can use the command
+ defmod defVacationEnd at 2016-12-30T00:00:00 set VacationTemp off, {Heating_Control_SetAllTemps()}
+ to stop the vacation temperature before you return in january 2017 and let the appartment heat up again.
+
+ Pray that the device does not restart during your vacation, as the
+ sub HC_BathWithBoost($) {
+ my $vacation = ReadingsVal("VacationTemp", "state", "unfortunately not on vacation");
+ return $vacation if $vacation =~ /^(\d+|eco)$/; # set vacation temperature if given
+
+ my $numParams = @_;
+ my ($degree, $boostPrefix) = @_;
+ if ($numParams > 1)
+ {
+ my $boost = ReadingsVal($boostPrefix . "_Boost", "state", "0");
+ return $boost if ($boost =~ m/^\d+$/) && ($boost > 0); # boost?
+ }
+ }
+
define defVacationEnd ... at
is volatile and will be lost at restart!
+
- Beispiel: + Beispiele:
define HCW Heating_Control Bad_Heizung 12345|05:20|21 12345|05:25|comfort 17:20|21 17:25|eco
define HeizStatus2 notify Heizung:.* {Heating_Control_SetAllTemps()}
Einige Definitionen ohne weitere Erklärung:
-
+ es ist möglich den Parameter als Perlcode zu spezifizieren:
+
+
-
+
-
define hc Heating_Control HeizungKueche de 7|23:35|25 34|23:30|22 23:30|16 23:15|22 8|23:45|16
define hc Heating_Control HeizungKueche de fr,$we|23:35|25 34|23:30|22 23:30|16 23:15|22 12|23:45|16
define hc Heating_Control HeizungKueche de 20:35|25 34|14:30|22 21:30|16 21:15|22 12|23:00|16
@@ -437,7 +488,12 @@ sub Heating_Control_SetAllTemps() { # {Heating_Control_SetAllTemps()}
define HeizungWohnen_an_we Heating_Control HeizungWohnen de fr,$we 09:00|19 (heizungAnAus("Ein"))
+ ein detailiertes Beispiel ist in Heating_Control(EN) beschrieben
+ ... 7|23:35|{getParameter(13,"this")} 7|23:36|{getParameter(14,"that")}
+
- Example: + Examples:
define shutter WeekdayTimer bath 12345|05:20|up 12345|20:30|down
@@ -1151,31 +1188,38 @@ sub WeekdayTimer_SetAllParms() { # {WeekdayTimer_SetAllParms()} The dimmer is only set to dimXX% if the dummy variable WeAreThere is "yes"(not a real live example).
If you want to have set all WeekdayTimer their current value (after a temperature lowering phase holidays)
- you can call the function WeekdayTimer_SetParm(<"WD-device">) or WeekdayTimer_SetAllParms().
+ you can call the function WeekdayTimer_SetParm("WD-device") or WeekdayTimer_SetAllParms().
This call can be automatically coupled to a dummy by a notify:
define dummyNotify notify Dummy:. * {WeekdayTimer_SetAllTemps()}
Some definitions without comment:
- The daylist can be given globaly for the whole Heating_Control:
- define hc Heating_Control HeizungKueche de 7|23:35|25 34|23:30|22 23:30|16 23:15|22 8|23:45|16
- define hc Heating_Control HeizungKueche de fr,$we|23:35|25 34|23:30|22 23:30|16 23:15|22 12|23:45|16
- define hc Heating_Control HeizungKueche de 20:35|25 34|14:30|22 21:30|16 21:15|22 12|23:00|16
-
- define hw Heating_Control HeizungKueche de mo-so, $we|{sunrise_abs_dat($date)}|18 mo-so, $we|{sunset_abs_dat($date)}|22
- define ht Heating_Control HeizungKueche de mo-so,!$we|{sunrise_abs_dat($date)}|18 mo-so,!$we|{sunset_abs_dat($date)}|22
-
- define hh Heating_Control HeizungKueche de {sunrise_abs_dat($date)}|19 {sunset_abs_dat($date)}|21
- define hx Heating_Control HeizungKueche de 22:35|25 23:00|16
+ define wd Weekdaytimer device de 7|23:35|25 34|23:30|22 23:30|16 23:15|22 8|23:45|16
+ define wd Weekdaytimer device de fr,$we|23:35|25 34|23:30|22 23:30|16 23:15|22 12|23:45|16
+ define wd Weekdaytimer device de 20:35|25 34|14:30|22 21:30|16 21:15|22 12|23:00|16
+
+ define wd Weekdaytimer device de mo-so, $we|{sunrise_abs_dat($date)}|on mo-so, $we|{sunset_abs_dat($date)}|off
+ define wd Weekdaytimer device de mo-so,!$we|{sunrise_abs_dat($date)}|aus mo-so,!$we|{sunset_abs_dat($date)}|aus
+
+ define wd Weekdaytimer device de {sunrise_abs_dat($date)}|19 {sunset_abs_dat($date)}|21
+ define wd Weekdaytimer device de 22:35|25 23:00|16
+ The daylist can be given globaly for the whole Weekdaytimer:
+
+ it is possible to construct the parameter as Perlcode:
- define HeizungWohnen_an_wt Heating_Control HeizungWohnen de !$we 09:00|19 (heizungAnAus("Ein"))
- define HeizungWohnen_an_we Heating_Control HeizungWohnen de $we 09:00|19 (heizungAnAus("Ein"))
- define HeizungWohnen_an_we Heating_Control HeizungWohnen de 78 09:00|19 (heizungAnAus("Ein"))
- define HeizungWohnen_an_we Heating_Control HeizungWohnen de 57 09:00|19 (heizungAnAus("Ein"))
- define HeizungWohnen_an_we Heating_Control HeizungWohnen de fr,$we 09:00|19 (heizungAnAus("Ein"))
+ define wd Weekdaytimer device de !$we 09:00|19 (function("Ein"))
+ define wd Weekdaytimer device de $we 09:00|19 (function("Ein"))
+ define wd Weekdaytimer device de 78 09:00|19 (function("exit"))
+ define wd Weekdaytimer device de 57 09:00|19 (function("exit"))
+ define wd Weekdaytimer device de fr,$we 09:00|19 (function("exit"))
+
+ A detailed examle can be found in Heating_Control
+ ... 7|23:35|{getParameter(13,"this")} 7|23:36|{getParameter(14,"that")}
+
+