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

exchange_on_off

git-svn-id: https://svn.fhem.de/fhem/trunk@750 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2010-11-05 20:28:29 +00:00
parent a6b76bc2a1
commit a7c0b99e2c
3 changed files with 32 additions and 3 deletions

View File

@ -109,7 +109,7 @@ FS20_Initialize($)
$hash->{DefFn} = "FS20_Define";
$hash->{UndefFn} = "FS20_Undef";
$hash->{ParseFn} = "FS20_Parse";
$hash->{AttrList} = "IODev follow-on-for-timer:1,0 do_not_notify:1,0 ignore:0,1 dummy:1,0 showtime:1,0 model;fs20hgs,fs20hgs,fs20pira,fs20piri,fs20s20,fs20s8,fs20s4,fs20s4a,fs20s4m,fs20s4u,fs20s4ub,fs20sd,fs20sn,fs20sr,fs20ss,fs20str,fs20tfk,fs20tfk,fs20tk,fs20uts,fs20ze,fs20as1,fs20as4,fs20di,fs20du,fs20ls,fs20ms2,fs20rst,fs20sa,fs20sig,fs20st,fs20sv,fs20usr loglevel:0,1,2,3,4,5,6";
$hash->{AttrList} = "IODev follow-on-for-timer:1,0 do_not_notify:1,0 ignore:0,1 dummy:1,0 showtime:1,0 model;fs20hgs,fs20hgs,fs20pira,fs20piri,fs20s20,fs20s8,fs20s4,fs20s4a,fs20s4m,fs20s4u,fs20s4ub,fs20sd,fs20sn,fs20sr,fs20ss,fs20str,fs20tfk,fs20tfk,fs20tk,fs20uts,fs20ze,fs20as1,fs20as4,fs20di,fs20du,fs20ls,fs20ms2,fs20rst,fs20sa,fs20sig,fs20st,fs20sv,fs20usr exchange_on_off loglevel:0,1,2,3,4,5,6";
}
@ -162,6 +162,14 @@ FS20_Set($@)
return "no set value specified" if($na < 2 || $na > 3);
return "Readonly value $a[1]" if(defined($readonly{$a[1]}));
if($attr{$a[0]} && $attr{$a[0]}{exchange_on_off}) {
if($a[1] =~ m/off/) {
$a[1] =~ s/off/on/;
} else {
$a[1] =~ s/on/off/;
}
}
my $c = $fs20_c2b{$a[1]};
if(!defined($c)) {
@ -339,7 +347,7 @@ FS20_Parse($$)
my $dur = 0;
my $cx = hex($cde);
if($cx & 0x20) {
if($cx & 0x20) { # Timed command
$dur = hex(substr($msg, 26, 2));
my $i = ($dur & 0xf0) / 16;
my $j = ($dur & 0xf);
@ -351,6 +359,7 @@ FS20_Parse($$)
$v = "unknown_$cde" if(!defined($v));
$v .= " $dur" if($dur);
my $def = $modules{FS20}{defptr}{"$dev $btn"};
if($def) {
my @list;
@ -358,6 +367,14 @@ FS20_Parse($$)
my $lh = $def->{$n};
$n = $lh->{NAME}; # It may be renamed
if($attr{$n} && $attr{$n}{exchange_on_off}) {
if($v =~ m/off/) {
$v =~ s/off/on/;
} else {
$v =~ s/on/off/;
}
}
return "" if(IsIgnored($n)); # Little strange.
$lh->{CHANGED}[0] = $v;

View File

@ -1300,7 +1300,13 @@ A line ending with \ will be concatenated with the next one, so long lines
list command (only if it is explicitely asked for it), nor will it
appear in commands which use some wildcard/attribute as name specifiers
(see <a href="#devspec">devspec</a>). You still get them with the
"ignored=1" special devspec. </li>
"ignored=1" special devspec.
</li><br>
<a name="exchange_on_off"></a>
<li>exchange_on_off<br>
Exchange on and off (and on-for-timer, etc). Both reception and sending
is exchanged.</li>
</ul>
</ul>

View File

@ -241,6 +241,12 @@
<li>Linux driver installation:
<a href="http://www.koeniglich.de/fhem/linux.html">
http://www.koeniglich.de/fhem/linux.html</a></li>
<li>Misc USB problems:
<a href="http://www.koeniglich.de/fhem/USB.html">
http://www.koeniglich.de/fhem/USB.html</a></li>
<li>Russels Blog for Windows user:
<a href="http://www.eclipcecreate.co.uk/category/FHEM.aspx">
http://www.eclipcecreate.co.uk/category/FHEM.aspx</a> <br>
<li>Windows driver installation:
<a href="http://fhz4linux.info/tiki-index.php?page=Driver%20installation">
http://fhz4linux.info/tiki-index.php?page=Driver%20installation</a> <br>