2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

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 d78e66b927
commit 1bc4e62e23

View File

@ -22,7 +22,6 @@
# This copyright notice MUST APPEAR in all copies of the script! # This copyright notice MUST APPEAR in all copies of the script!
# #
################################################################ ################################################################
# $Id$
############################################## ##############################################
package main; package main;
@ -50,10 +49,21 @@ WEBIO_12DIGITAL_Set($@)
{ {
my ($hash, @a) = @_; my ($hash, @a) = @_;
return "no set value specified" if(int(@a) != 2); return "no set value specified" if(int(@a) < 2);
return "Unknown argument $a[1], choose one of on offf" if($a[1] eq "?"); return "Unknown argument $a[1], choose one of on off on-for-timer" if($a[1] eq "?");
my $v = $a[1]; 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); WEBIO_12DIGITAL_execute($hash->{DEF},$v);
@ -69,6 +79,21 @@ WEBIO_12DIGITAL_Set($@)
return undef; 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 sub
WEBIO_12DIGITAL_execute($@) WEBIO_12DIGITAL_execute($@)