# $Id$
##############################################################################
#
# 98_Heating_Control.pm
# written by Dietmar Ortmann
#
# This file is part of fhem.
#
# Fhem is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Fhem is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with fhem. If not, see
define <name> Heating_Control <device> [<language>] [weekdays] <profile> [<command>|<condition>]
set <device> (desired-temp|desiredTemperature) <temp>
The following parameter are defined:
Example:
define HCB Heating_Control Bad_Heizung 12345|05:20|21 12345|05:25|comfort 17:20|21 17:25|eco
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 $NAME desired-temp $EVENT");}
At the given times and weekdays only(!) the command will be executed.
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 HCW Heating_Control WZ_Heizung en Su-Fr|{sunrise_abs()}|21 Mo-Fr|{sunset_abs()}|16
The device is switched at sunrise/sunset. Language: english.
define HCW Heating_Control WZ_Heizung en Mo-Fr|{myFunction}|night-temp:18 Mo-Fr|{myFunction()}|dayTemp:16
The is switched at time myFunction(). It is sent the Command "night-temp 18" and "dayTemp 16".
If you want to have set all Heating_Controls their current value (after a temperature lowering phase holidays)
you can call the function Heating_Control_SetTemp(<"HC-device">) or Heating_Control_SetAllTemps().
This call can be automatically coupled to a dummy by a notify:
define HeizStatus2 notify Heating:. * {Heating_Control_SetAllTemps()}
Some definitions without comment:
The daylist can be given globaly for the whole WeekdayTimer:
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
define hx WeekdayTimer WDdevice de 22:35|hi 23:00|on
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)
attr hc delayedExecutionCond isDelayed("%HEATING_CONTROL","%WEEKDAYTIMER","%TIME","%NAME","%EVENT")the parameters %HEATING_CONTROL(timer name) %TIME %NAME(device name) %EVENT are replaced at runtime by the correct value.
sub isDelayed($$$$$) { my($hc, $wdt, $tim, $nam, $event ) = @_; my $theSunIsStillshining = ... return ($tim eq "16:30" && $theSunIsStillshining) ; }
define <name> Heating_Control <device> [<language>] <wochentage;] <profile> <command>|<condition>
set <device> (desired-temp|desiredTemperature) <temp>
Folgende Parameter sind im Define definiert:
Beispiel:
define HCW Heating_Control Bad_Heizung 12345|05:20|21 12345|05:25|comfort 17:20|21 17:25|eco
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 $NAME desired-temp $EVENT");}
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.
define HCW Heating_Control WZ_Heizung en Su-Fr|{sunrise_abs()}|21 Mo-Fr|{sunset_abs()}|16
Das Gerät wird bei Sonnenaufgang und Sonnenuntergang geschaltet. Sprache: Englisch.
define HCW Heating_Control WZ_Heizung en Mo-Fr|{myFunction}|night-temp:18 Mo-Fr|{myFunction()}|dayTemp:16
Das Gerät wird bei myFunction() geschaltet. Es wird das Kommando "night-temp 18" bzw. "dayTemp 16" gesendet.
Wenn du beispielsweise nach einer Temperaturabsenkungsphase erreichen willst, dass alle Heating_Controls ihren aktuellen Wert einstellen sollen, kannst du die Funktion Heating_Control_SetTemp(<"HC-device">) or Heating_Control_SetAllTemps() aufrufen.
Dieser Aufruf kann per notify automatisch an ein dummy gekoppelt werden:
define HeizStatus2 notify Heizung:.* {Heating_Control_SetAllTemps()}
Einige Definitionen ohne weitere Erklärung:
Die Tagesliste kann global für das ganze Heating_Control angegeben werden:
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 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"))
set <name> <value>
value
is one of:enable # enables the Heating_Control disable # disables the Heating_ControlExamples:
set hc disable
set hc enable
attr wd delayedExecutionCond isDelayed("%HEATING_CONTROL","%WEEKDAYTIMER","%TIME","%NAME","%EVENT")Die Parameter %HEATING_CONTROL(timer Name) %TIME %NAME(device Name) %EVENT werden zur Laufzeit durch die echten Werte ersetzt.
sub isDelayed($$$$$) { my($hc, $wdt, $tim, $nam, $event ) = @_; my $theSunIsStillshining = ... return ($tim eq "16:30" && $theSunIsStillshining) ; }