From 1a9418a61e3c8bd5087909407298f6d011da534d Mon Sep 17 00:00:00 2001 From: sachag <> Date: Mon, 19 Sep 2011 12:58:13 +0000 Subject: [PATCH] toggle implemented git-svn-id: https://svn.fhem.de/fhem/trunk@1007 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/88_Itach_Relay.pm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/fhem/FHEM/88_Itach_Relay.pm b/fhem/FHEM/88_Itach_Relay.pm index 29fe09117..62aa8e7b1 100644 --- a/fhem/FHEM/88_Itach_Relay.pm +++ b/fhem/FHEM/88_Itach_Relay.pm @@ -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";