2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-27 08:14:54 +00:00
rudolfkoenig 71fe020f84 Initial version
git-svn-id: https://svn.fhem.de/fhem/trunk@3 2b470e98-0d58-463d-a4d8-8e2adae1ed80
2007-01-30 12:47:36 +00:00

81 lines
1.8 KiB
Perl

##############################################
# Switching the FHTs with e.g. a Button
##############################################
# This is only an example.
# After pressing e.g. a button it will change the values
# of desired-temp against the value of windowopen-temp
# With small changes it is possible to change e.g. all FHTs to
# 2 degrees less if you are leaving the house and activating
# the alarm system.
# Don't change the values very often within a time because the FHT seems
# to hang if there are too much values within a time.
#
# Add something like the following lines to the configuration file :
# notifyon NameOfButton {MyFHTswitch("NameOfFHT")}
# and put this file in the <modpath>/FHZ1000 directory.
# Martin Haas
##############################################
package main;
use strict;
use warnings;
sub
FHTswitch_Initialize($)
{
# my ($hash) = @_; ## for fhz1000 >3.0
# $hash->{Category} = "none"; ## for fhz1000 >3.0
my ($hash, $init) = @_; ## for fhz1000 <=3.0
$hash->{Type} = "none"; ## for fhz1000 <=3.0
}
###### ok, let's learn perl ;-)...
sub
MyFHTswitch($)
{
my $str;
my $fhtorder;
my @a = @_;
my $fht=$a[0];
my @windowopentemp;
my @desiredtemp;
no strict "refs";
$str = &{$devmods{$defs{$a[0]}{TYPE}}{ListFn}}($defs{$a[0]});
my @lines = split("\n", $str);
use strict "refs";
foreach my $l (@lines) {
my ($date, $time, $attr, $val) = split(" ", $l, 4);
if($attr eq "desired-temp")
{
Log 3, "old $attr of $a[0]: $val";
@desiredtemp = split(" ", $val);
}
if($attr eq "windowopen-temp")
{
Log 3, "old $attr of $a[0]: $val";
@windowopentemp = split(" ", $val);
}
}
$fhtorder="set $fht desired-temp $windowopentemp[0] ";
fhz "$fhtorder";
$fhtorder="set $fht windowopen-temp $desiredtemp[0] ";
fhz "$fhtorder";
fhz "set $fht refreshvalues";
}
1;