From c5f97acb28f1482a2dc72490902cee4aab281835 Mon Sep 17 00:00:00 2001
From: sachag <>
Date: Thu, 28 Oct 2010 09:24:54 +0000
Subject: [PATCH] on-for-timer implemented.
git-svn-id: https://svn.fhem.de/fhem/trunk@746 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/FHEM/23_ALL4027.pm | 28 ++++++++++++++++++++++++++--
fhem/docs/commandref.html | 1 +
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/fhem/FHEM/23_ALL4027.pm b/fhem/FHEM/23_ALL4027.pm
index e96fa5570..7ef171b1c 100644
--- a/fhem/FHEM/23_ALL4027.pm
+++ b/fhem/FHEM/23_ALL4027.pm
@@ -48,10 +48,12 @@ ALL4027_Set($@)
{
my ($hash, @a) = @_;
- return "no set value specified" if(int(@a) != 2);
- return "Unknown argument $a[1], choose one of on off toggle" if($a[1] eq "?");
+ return "no set value specified" if(int(@a) < 2);
+ return "Unknown argument $a[1], choose one of on off toggle on-for-timer" if($a[1] eq "?");
my $v = $a[1];
+ my $v2= "";
+ if(defined($a[2])) { $v2=$a[2]; }
if($v eq "toggle")
{
@@ -71,6 +73,12 @@ ALL4027_Set($@)
$v="off";
}
}
+ elsif($v eq "on-for-timer")
+ {
+ InternalTimer(gettimeofday()+$v2, "ALL4027_on_timeout",$hash, 0);
+# on-for-timer is now a on.
+ $v="on";
+ }
ALL4027_execute($hash->{DEF},$v);
Log GetLogLevel($a[0],2), "ALL4027 set @a";
@@ -79,6 +87,22 @@ ALL4027_Set($@)
$hash->{STATE} = $v;
$hash->{READINGS}{state}{TIME} = TimeNow();
$hash->{READINGS}{state}{VAL} = $v;
+
+ DoTrigger($hash->{NAME}, undef);
+
+ return undef;
+}
+sub
+ALL4027_on_timeout($)
+{
+ my ($hash) = @_;
+ my @a;
+
+ $a[0]=$hash->{NAME};
+ $a[1]="off";
+
+ ALL4027_Set($hash,@a);
+
return undef;
}
###################################
diff --git a/fhem/docs/commandref.html b/fhem/docs/commandref.html
index e67d00665..3e7665449 100644
--- a/fhem/docs/commandref.html
+++ b/fhem/docs/commandref.html
@@ -3228,6 +3228,7 @@ Attributes:
off on + on-for-timer <Seconds> toggleExamples: