# $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 . # ############################################################################## package main; use strict; use warnings; use POSIX; ######################################################################## 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 ". $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 " 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"); } return undef; } ######################################################################## sub Heating_Control_Get($@) { return WeekdayTimer_Get($@); } ######################################################################## sub Heating_Control_Define($$){ my ($hash, $def) = @_; my $ret = WeekdayTimer_Define($hash, $def); $hash->{helper}{DESIRED_TEMP_READING} = ""; 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) = @_; if( $attrName eq "disable" ) { my $hash = $defs{$name}; readingsSingleUpdate ($hash, "disabled", $attrVal, 1); } return undef; } ######################################################################## sub Heating_Control_SetTimer($) { my ($hash) = @_; return WeekdayTimer_SetTimer($hash); } ######################################################################## sub Heating_Control_SetAllTemps() { # {Heating_Control_SetAllTemps()} foreach my $hc ( sort keys %{$modules{Heating_Control}{defptr}} ) { my $hash = $modules{Heating_Control}{defptr}{$hc}; Heating_Control_SetTimer($hash); Log3 undef, 3, "Heating_Control_SetTimer() for $hash->{NAME} done!"; } Log3 undef, 3, "Heating_Control_SetAllTemps() done!"; } 1; =pod =begin html

Heating Control

=end html =begin html_DE

Heating Control

Get
Attributes
=end html_DE =cut