# $Id$ ############################################################################## # # 98_WeekdayTimer.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 WeekdayTimer_Initialize($) { my ($hash) = @_; if(!$modules{Heating_Control}{LOADED} && -f "$attr{global}{modpath}/FHEM/98_Heating_Control.pm") { my $ret = CommandReload(undef, "98_Heating_Control"); Log3 undef, 1, $ret if($ret); } # Consumer $hash->{SetFn} = "WeekdayTimer_Set"; $hash->{AttrFn} = "WeekdayTimer_Attr"; $hash->{DefFn} = "WeekdayTimer_Define"; $hash->{UndefFn} = "WeekdayTimer_Undef"; $hash->{GetFn} = "WeekdayTimer_Get"; $hash->{UpdFn} = "WeekdayTimer_Update"; $hash->{AttrList}= "disable:0,1 delayedExecutionCond ". $readingFnAttributes; } ################################################################################ sub WeekdayTimer_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 WeekdayTimer_Get($@) { return Heating_Control_Get($@); } ######################################################################## sub WeekdayTimer_Define($$){ my ($hash, $def) = @_; my $ret = Heating_Control_Define($hash, $def); $hash->{helper}{DESIRED_TEMP_READING} = ""; return $ret; } ######################################################################## sub WeekdayTimer_Undef($$){ my ($hash, $arg) = @_; return Heating_Control_Undef($hash, $arg); } ######################################################################## sub WeekdayTimer_UpdatePerlTime($) { my ($hash) = @_; Heating_Control_UpdatePerlTime($hash); } ######################################################################## sub WeekdayTimer_Update($){ my ($hash) = @_; return Heating_Control_Update($hash); } ######################################################################## sub WeekdayTimer_Attr($$$) { my ($cmd, $name, $attrName, $attrVal) = @_; if( $attrName eq "disable" ) { my $hash = $defs{$name}; readingsSingleUpdate ($hash, "disabled", $attrVal, 1); } return undef; } ######################################################################## sub WeekdayTimer_SetAllParms() { # {WeekdayTimer_SetAllParms()} foreach my $hc ( sort keys %{$modules{WeekdayTimer}{defptr}} ) { my $hash = $modules{WeekdayTimer}{defptr}{$hc}; if($hash->{helper}{CONDITION}) { if (!(eval ($hash->{helper}{CONDITION}))) { readingsSingleUpdate ($hash, "state", "inactive", 1); next; } } my $myHash->{HASH}=$hash; $hash->{setAllTempMode} = 1; WeekdayTimer_Update($myHash); delete $hash->{setAllTempMode}; Log3 undef, 3, "WeekdayTimer_Update() for $hash->{NAME} done!"; } Log3 undef, 3, "WeekdayTimer_SetAllParms() done!"; } 1; =pod =begin html

WeekdayTimer

Get
Attributes
=end html =cut