2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-12 22:56:34 +00:00

on-for-timer implemented.

git-svn-id: https://svn.fhem.de/fhem/trunk@746 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
sachag 2010-10-28 09:24:54 +00:00
parent d6d23be0f7
commit c5f97acb28
2 changed files with 27 additions and 2 deletions

View File

@ -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;
}
###################################

View File

@ -3228,6 +3228,7 @@ Attributes:<br>
<pre>
off
on
on-for-timer &lt;Seconds&gt;
toggle
</pre>
Examples: