From 1bc4e62e23d1cecab66d3f755cb24bda1ce49291 Mon Sep 17 00:00:00 2001 From: sgloor <> Date: Mon, 25 Jun 2012 13:30:45 +0000 Subject: [PATCH] on-for-timer implemented git-svn-id: https://svn.fhem.de/fhem/trunk@1652 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/23_WEBIO_12DIGITAL.pm | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/fhem/FHEM/23_WEBIO_12DIGITAL.pm b/fhem/FHEM/23_WEBIO_12DIGITAL.pm index 83c6b1d4c..6e8a3b546 100644 --- a/fhem/FHEM/23_WEBIO_12DIGITAL.pm +++ b/fhem/FHEM/23_WEBIO_12DIGITAL.pm @@ -22,7 +22,6 @@ # This copyright notice MUST APPEAR in all copies of the script! # ################################################################ -# $Id$ ############################################## package main; @@ -50,10 +49,21 @@ WEBIO_12DIGITAL_Set($@) { my ($hash, @a) = @_; - return "no set value specified" if(int(@a) != 2); - return "Unknown argument $a[1], choose one of on offf" if($a[1] eq "?"); + return "no set value specified" if(int(@a) < 2); + return "Unknown argument $a[1], choose one of on off on-for-timer" if($a[1] eq "?"); my $v = $a[1]; + my $v2= ""; + if(defined($a[2])) { $v2=$a[2]; } + + RemoveInternalTimer("WEBIO_12DIGITAL_on_timeout"); + + if($v eq "on-for-timer") + { + InternalTimer(gettimeofday()+$v2, "WEBIO_12DIGITAL_on_timeout",$hash, 0); +# on-for-timer is now a on. + $v="on"; + } WEBIO_12DIGITAL_execute($hash->{DEF},$v); @@ -69,6 +79,21 @@ WEBIO_12DIGITAL_Set($@) return undef; } +sub +WEBIO_12DIGITAL_on_timeout($) +{ + my ($hash) = @_; + my @a; + + $a[0]=$hash->{NAME}; + $a[1]="off"; + + WEBIO_12DIGITAL_Set($hash,@a); + + return undef; +} + + ################################### sub WEBIO_12DIGITAL_execute($@)