# $Id: 98_Heating_Control.pm 20678 2019-12-08 04:49:25Z Beta-User $ ############################################################################## # # 98_Heating_Control.pm # written by Dietmar Ortmann # Maintained by igami since 02-2018 # # 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 . # ############################################################################## package main; use strict; use warnings; ######################################################################## sub Heating_Control_Initialize($) { my ($hash) = @_; if(!$modules{WeekdayTimer}{LOADED} && -f "$attr{global}{modpath}/FHEM/98_WeekdayTimer.pm") { my $ret = CommandReload(undef, "98_WeekdayTimer"); Log3 undef, 1, $ret if($ret); } # Consumer $hash->{SetFn} = "Heating_Control_Set"; $hash->{AttrFn} = "Heating_Control_Attr"; $hash->{DefFn} = "Heating_Control_Define"; $hash->{UndefFn} = "Heating_Control_Undef"; $hash->{GetFn} = "Heating_Control_Get"; $hash->{UpdFn} = "Heating_Control_Update"; $hash->{AttrList}= "disable:0,1 delayedExecutionCond windowSensor switchInThePast:0,1 commandTemplate ". $readingFnAttributes; } ################################################################################ sub Heating_Control_Set($@) { my ($hash, @a) = @_; return "no set value specified" if(int(@a) < 2); return "Unknown argument $a[1], choose one of enable disable ConvertToWDT:noArg" if($a[1] eq "?"); my $name = shift @a; my $v = join(" ", @a); Log3 $hash, 3, "[$name] set $name $v"; if ($v eq "enable") { fhem("attr $name disable 0"); } elsif ($v eq "disable") { fhem("attr $name disable 1"); } elsif ($v eq "ConvertToWDT") { Heating_Control_ConvertToWDT(); } return undef; } ######################################################################## sub Heating_Control_Get($@) { return WeekdayTimer_Get($@); } ######################################################################## sub Heating_Control_Define($$){ my ($hash, $def) = @_; Log3 $hash, 1, "Heating_Control is deprecated, use WeekdayTimer instead!"; my $ret = WeekdayTimer_Define($hash, $def); return $ret; } ######################################################################## sub Heating_Control_Undef($$){ my ($hash, $arg) = @_; return WeekdayTimer_Undef($hash, $arg); } ######################################################################## sub Heating_Control_Update($){ my ($hash) = @_; return WeekdayTimer_Update($hash); } ################################################################################ sub Heating_Control_SetTimerOfDay($) { my ($hash) = @_; return WeekdayTimer_SetTimerOfDay($hash); } ######################################################################## sub Heating_Control_Attr($$$$) { my ($cmd, $name, $attrName, $attrVal) = @_; WeekdayTimer_Attr($cmd, $name, $attrName, $attrVal); return undef; } ######################################################################## sub Heating_Control_SetTimer($) { my ($hash) = @_; WeekdayTimer_DeleteTimer($hash); WeekdayTimer_SetTimer($hash); } ######################################################################## sub Heating_Control_SetTemp($) { my ($name) = @_; my $hash = $modules{Heating_Control}{defptr}{$name}; if(defined $hash) { Heating_Control_SetTimer($hash); } } ######################################################################## sub Heating_Control_SetAllTemps() { # {Heating_Control_SetAllTemps()} my @hcNamen = sort keys %{$modules{Heating_Control}{defptr}}; foreach my $hcName ( @hcNamen ) { Heating_Control_SetTemp($hcName); } Log3 undef, 3, "Heating_Control_SetAllTemps() done on: ".join(" ",@hcNamen ); } ######################################################################## sub Heating_Control_ConvertToWDT() { my @hcNamen = sort keys %{$modules{Heating_Control}{defptr}}; foreach my $hcName ( @hcNamen ) { my $hash = $defs{$hcName}; my $definition = $defs{$hcName}{DEF}; my $windows = AttrVal($hcName,"windowSensor",undef); my @a = GetDefAndAttr($hcName); shift @a; #delete define my @b = GetAllReadings($hcName); CommandDelete(undef,$hcName); CommandDefine(undef,"$hcName WeekdayTimer $definition"); CommandAttr(undef, "$hcName WDT_delayedExecutionDevices $windows") if defined $windows; CommandAttr(undef, "$hcName WDT_Group former_HC"); foreach my $linesa ( @a ){ AnalyzeCommand(undef, "$linesa") unless ($linesa =~ m/^attr $hcName windowSensor/); } foreach my $linesb ( @b ){ AnalyzeCommand(undef, "$linesb"); } } Log3 undef, 3, "Heating_Control_ConvertToWDT() done on: ".join(" ",@hcNamen ); } 1; =pod =item helper =item summary sends heating commands to heating at defined times - deprecated module! =item summary_DE - nicht mehr supportetes Modul, bitte stattdessen WeekdayTimer nutzen! =begin html

Heating Control

=end html =begin html_DE

Heating Control

=end html_DE =cut