on-for-timer implemented

git-svn-id: https://svn.fhem.de/fhem/trunk@1652 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
sgloor
2012-06-25 13:30:45 +00:00
parent 8cbc788ff2
commit 6a4eb8f7b9

View File

@@ -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($@)