2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

toggle implemented

git-svn-id: https://svn.fhem.de/fhem/trunk@1007 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
sachag 2011-09-19 12:58:13 +00:00
parent 60529c90cb
commit 1a9418a61e

View File

@ -48,10 +48,29 @@ ITACH_RELAY_Set($@)
my ($hash, @a) = @_;
return "no set value specified" if(int(@a) != 2);
return "Unknown argument $a[1], choose one of on off" if($a[1] eq "?");
return "Unknown argument $a[1], choose one of on off toggle" if($a[1] eq "?");
my $v = $a[1];
if($v eq "toggle")
{
if(defined $hash->{READINGS}{state}{VAL})
{
if($hash->{READINGS}{state}{VAL} eq "off")
{
$v="on";
}
else
{
$v="off";
}
}
else
{
$v="off";
}
}
ITACH_RELAY_execute($hash->{DEF},$v);
Log GetLogLevel($a[0],2), "ITACH_RELAY set @a";