]> wagnertech.de Git - xhome.git/blob - Griesstatt/99_myUtils.pm
gitarre
[xhome.git] / Griesstatt / 99_myUtils.pm
1 ##############################################
2 # $Id: myUtilsTemplate.pm 7570 2015-01-14 18:31:44Z rudolfkoenig $
3 #
4 # Save this file as 99_myUtils.pm, and create your own functions in the new
5 # file. They are then available in every Perl expression.
6
7 package main;
8
9 use strict;
10 use warnings;
11 use POSIX;
12
13 sub
14 myUtils_Initialize($$)
15 {
16   my ($hash) = @_;
17 }
18
19 # Enter you functions below _this_ line.
20
21 sub setHeizstatus {
22    my $heizstatus = shift;
23    my $force = shift;
24
25    # parameter check
26    die ("Ungültiger Heizstatus (1 .. 4)") if ($heizstatus < 1 or $heizstatus > 4);
27
28    fhem("set KNX_0000001 g1 $heizstatus");
29    Log(1, "Set Heizstatus to $heizstatus");
30    fhem("set KNX_LED1 g1 off");
31    fhem("set KNX_LED2 g1 off");
32    fhem("set KNX_LED3 g1 off");
33    fhem("set KNX_LED4 g1 off");
34
35    fhem("set KNX_LED1 g1 on") if ($heizstatus == 1);
36    fhem("set KNX_LED2 g1 on") if ($heizstatus == 2);
37    fhem("set KNX_LED3 g1 on") if ($heizstatus == 3);
38    fhem("set KNX_LED4 g1 on") if ($heizstatus == 4);
39 }
40 sub boostReset {
41         my $zimmer = shift;
42
43         if ($zimmer eq "WZ") {
44                 my $hstat = Value("KNX_0000001");
45            setHeizstatus(2) if ($hstat == 1);
46         }
47         elsif ($zimmer eq "GZ") {
48                 my $hstat = Value("Heizregler_GZ");
49                 fhem("set Heizregler_GZ g1 2") if ($hstat == 1);
50         }
51         else {
52                 die "Unbekanntes Zimmer: $zimmer";
53         }
54 }
55
56 1;