10_FS20.pm 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945
  1. ##############################################
  2. # $Id: 10_FS20.pm 14888 2017-08-13 12:07:12Z rudolfkoenig $
  3. package main;
  4. use strict;
  5. use warnings;
  6. use SetExtensions;
  7. my %codes = (
  8. "00" => "off",
  9. "01" => "dim06%",
  10. "02" => "dim12%",
  11. "03" => "dim18%",
  12. "04" => "dim25%",
  13. "05" => "dim31%",
  14. "06" => "dim37%",
  15. "07" => "dim43%",
  16. "08" => "dim50%",
  17. "09" => "dim56%",
  18. "0a" => "dim62%",
  19. "0b" => "dim68%",
  20. "0c" => "dim75%",
  21. "0d" => "dim81%",
  22. "0e" => "dim87%",
  23. "0f" => "dim93%",
  24. "10" => "dim100%",
  25. "11" => "on", # Set to previous dim value (before switching it off)
  26. "12" => "toggle", # between off and previous dim val
  27. "13" => "dimup",
  28. "14" => "dimdown",
  29. "15" => "dimupdown",
  30. "16" => "timer",
  31. "17" => "sendstate",
  32. "18" => "off-for-timer",
  33. "19" => "on-for-timer",
  34. "1a" => "on-old-for-timer",
  35. "1b" => "reset",
  36. "1c" => "ramp-on-time", #time to reach the desired dim value on dimmers
  37. "1d" => "ramp-off-time", #time to reach the off state on dimmers
  38. "1e" => "on-old-for-timer-prev", # old val for timer, then go to prev. state
  39. "1f" => "on-100-for-timer-prev", # 100% for timer, then go to previous state
  40. );
  41. my %readonly = (
  42. "thermo-on" => 1,
  43. "thermo-off" => 1,
  44. );
  45. use vars qw(%fs20_c2b); # Peter would like to access it from outside
  46. my $fs20_simple ="off off-for-timer on on-for-timer reset timer toggle";
  47. my %models = (
  48. fs20fms => 'sender',
  49. fs20hgs => 'sender',
  50. fs20irl => 'sender',
  51. fs20kse => 'sender',
  52. fs20ls => 'sender',
  53. fs20pira => 'sender',
  54. fs20piri => 'sender',
  55. fs20piru => 'sender',
  56. fs20s16 => 'sender',
  57. fs20s20 => 'sender',
  58. fs20s4 => 'sender',
  59. fs20s4a => 'sender',
  60. fs20s4m => 'sender',
  61. fs20s4u => 'sender',
  62. fs20s4ub => 'sender',
  63. fs20s8 => 'sender',
  64. fs20s8m => 'sender',
  65. fs20sd => 'sender', # Sensor: Daemmerung
  66. fs20sn => 'sender', # Sensor: Naeherung
  67. fs20sr => 'sender', # Sensor: Regen
  68. fs20ss => 'sender', # Sensor: Sprache
  69. fs20str => 'sender', # Sensor: Thermostat+Regelung
  70. fs20tc1 => 'sender',
  71. fs20tc6 => 'sender', # TouchControl x 6
  72. fs20tfk => 'sender', # TuerFensterKontakt
  73. fs20tk => 'sender', # TuerKlingel
  74. fs20uts => 'sender', # Universal Thermostat Sender
  75. fs20ze => 'sender', # FunkTimer (ZeitEinheit?)
  76. fs20bf => 'sender', # BodenFeuchte
  77. fs20bs => 'sender', # Beschattung
  78. fs20si3 => 'sender', # 3 Kanal Schaltinterface
  79. dummySender => 'sender',
  80. fs20di => 'dimmer',
  81. fs20di10 => 'dimmer',
  82. fs20du => 'dimmer',
  83. dummyDimmer => 'dimmer',
  84. fs20as1 => 'simple',
  85. fs20as4 => 'simple',
  86. fs20ms2 => 'simple',
  87. fs20rgbsa => 'simple',
  88. fs20rst => 'simple',
  89. fs20rsu => 'simple',
  90. fs20sa => 'simple',
  91. fs20sig => 'simple',
  92. fs20sm4 => 'simple',
  93. fs20sm8 => 'simple',
  94. fs20st => 'simple',
  95. fs20st2 => 'simple',
  96. fs20su => 'simple',
  97. fs20sv => 'simple',
  98. fs20ue1 => 'simple',
  99. fs20usr => 'simple',
  100. fs20ws1 => 'simple',
  101. dummySimple => 'simple',
  102. );
  103. sub hex2four($);
  104. sub four2hex($$);
  105. sub
  106. FS20_Initialize($)
  107. {
  108. my ($hash) = @_;
  109. foreach my $k (keys %codes) {
  110. $fs20_c2b{$codes{$k}} = $k;
  111. }
  112. $hash->{Match} = "^81..(04|0c)..0101a001";
  113. $hash->{SetFn} = "FS20_Set";
  114. $hash->{DefFn} = "FS20_Define";
  115. $hash->{UndefFn} = "FS20_Undef";
  116. $hash->{ParseFn} = "FS20_Parse";
  117. $hash->{AttrList} = "IODev follow-on-for-timer:1,0 follow-on-timer ".
  118. "do_not_notify:1,0 ignore:1,0 dummy:1,0 showtime:1,0 ".
  119. "useSetExtensions:0,1 $readingFnAttributes " .
  120. "model:".join(",", sort keys %models);
  121. }
  122. sub
  123. FS20_Follow($$$$)
  124. {
  125. my ($name, $arg, $na, $val) = @_;
  126. ###########################################
  127. # Set the state of a device to off if on-for-timer is called
  128. if($modules{FS20}{ldata}{$name}) {
  129. CommandDelete(undef, $name . "_timer");
  130. delete $modules{FS20}{ldata}{$name};
  131. delete $defs{$name}->{TIMED_OnOff} if( $defs{$name} );
  132. }
  133. my $newState="";
  134. my $onTime = AttrVal($name, "follow-on-timer", undef);
  135. ####################################
  136. # following timers
  137. if(($arg eq "on" || $arg =~ m/dim/) && $na == 2 && $onTime) {
  138. $newState = "off";
  139. $val = $onTime;
  140. } elsif($arg =~ m/(on|off).*-for-timer/ && $na == 3 &&
  141. AttrVal($name, "follow-on-for-timer", undef)) {
  142. $newState = ($1 eq "on" ? "off" : "on");
  143. }
  144. if($newState) {
  145. my $to = sprintf("%02d:%02d:%02d", $val/3600, ($val%3600)/60, $val%60);
  146. $modules{FS20}{ldata}{$name} = $to;
  147. Log3 $name, 4, "Follow: +$to setstate $name $newState";
  148. CommandDefine(undef, $name."_timer at +$to ".
  149. "{readingsSingleUpdate(\$defs{'$name'},'state','$newState', 1);".
  150. "delete \$defs{'$name'}->{TIMED_OnOff}; undef}");
  151. if($defs{$name}) {
  152. $defs{$name}->{TIMED_OnOff} = {
  153. START=>time(),
  154. START_FMT=>TimeNow(),
  155. DURATION=>$val,
  156. CMD=>$arg
  157. }
  158. }
  159. }
  160. }
  161. ###################################
  162. sub
  163. FS20_Set($@)
  164. {
  165. my ($hash, @a) = @_;
  166. my $ret = undef;
  167. my $na = int(@a);
  168. return "no set value specified" if($na < 2);
  169. return "Readonly value $a[1]" if(defined($readonly{$a[1]}));
  170. if($na > 2 && $a[1] eq "dim") {
  171. $a[1] = ($a[2] eq "0" ? "off" : sprintf("dim%02d%%",$a[2]) );
  172. splice @a, 2, 1;
  173. $na = int(@a);
  174. }
  175. my $c = $fs20_c2b{$a[1]};
  176. my $name = $a[0];
  177. if(!defined($c)) {
  178. # Model specific set arguments
  179. my $list;
  180. if(defined($attr{$name}) && defined($attr{$name}{"model"})) {
  181. my $mt = $models{$attr{$name}{"model"}};
  182. $list = "" if($mt && $mt eq "sender");
  183. $list = $fs20_simple if($mt && $mt eq "simple");
  184. }
  185. $list = (join(" ", sort keys %fs20_c2b) . " dim:slider,0,6.25,100")
  186. if(!defined($list));
  187. return SetExtensions($hash, $list, @a)
  188. if(AttrVal($name, "useSetExtensions", 1));
  189. return "Unknown argument $a[1], choose one of $list";
  190. }
  191. SetExtensionsCancel($hash);
  192. return "Bad time spec" if($na == 3 && $a[2] !~ m/^\d*\.?\d+$/);
  193. my $v = join(" ", @a);
  194. Log3 $name, 3, "FS20 set $v";
  195. (undef, $v) = split(" ", $v, 2); # Not interested in the name...
  196. my $val;
  197. if($na == 3) { # Timed command.
  198. $c = sprintf("%02X", (hex($c) | 0x20)); # Set the extension bit
  199. ########################
  200. # Calculating the time.
  201. LOOP: for(my $i = 0; $i <= 12; $i++) {
  202. for(my $j = 0; $j <= 15; $j++) {
  203. $val = (2**$i)*$j*0.25;
  204. if($val >= $a[2]) {
  205. if($val != $a[2]) {
  206. Log3 $name, 2, "$name: changing timeout to $val from $a[2]";
  207. }
  208. $c .= sprintf("%x%x", $i, $j);
  209. last LOOP;
  210. }
  211. }
  212. }
  213. return "Specified timeout too large, max is 15360" if(length($c) == 2);
  214. }
  215. IOWrite($hash, "04", "010101" . $hash->{XMIT} . $hash->{BTN} . $c);
  216. ##########################
  217. # Look for all devices with the same code, and set state, timestamp
  218. my $code = "$hash->{XMIT} $hash->{BTN}";
  219. my $defptr = $modules{FS20}{defptr}{$code};
  220. foreach my $n (keys %{ $defptr }) {
  221. FS20_Follow($defptr->{$n}->{NAME}, $a[1], $na, $val);
  222. readingsSingleUpdate($defptr->{$n}, "state", $v, 1);
  223. }
  224. return $ret;
  225. }
  226. #############################
  227. sub
  228. FS20_Define($$)
  229. {
  230. my ($hash, $def) = @_;
  231. my @a = split("[ \t][ \t]*", $def);
  232. my $u = "wrong syntax: define <name> FS20 housecode " .
  233. "addr [fg addr] [lm addr] [gm FF]";
  234. return $u if(int(@a) < 4);
  235. return "Define $a[0]: wrong housecode format: specify a 4 digit hex value ".
  236. "or an 8 digit quad value"
  237. if( ($a[2] !~ m/^[a-f0-9]{4}$/i) && ($a[2] !~ m/^[1-4]{8}$/i) );
  238. return "Define $a[0]: wrong btn format: specify a 2 digit hex value " .
  239. "or a 4 digit quad value"
  240. if( ($a[3] !~ m/^[a-f0-9]{2}$/i) && ($a[3] !~ m/^[1-4]{4}$/i) );
  241. my $housecode = $a[2];
  242. $housecode = four2hex($housecode,4) if (length($housecode) == 8);
  243. my $btncode = $a[3];
  244. $btncode = four2hex($btncode,2) if (length($btncode) == 4);
  245. $hash->{XMIT} = lc($housecode);
  246. $hash->{BTN} = lc($btncode);
  247. my $code = lc("$housecode $btncode");
  248. my $ncode = 1;
  249. my $name = $a[0];
  250. $hash->{CODE}{$ncode++} = $code;
  251. $modules{FS20}{defptr}{$code}{$name} = $hash;
  252. for(my $i = 4; $i < int(@a); $i += 2) {
  253. return "No address specified for $a[$i]" if($i == int(@a)-1);
  254. $a[$i] = lc($a[$i]);
  255. if($a[$i] eq "fg") {
  256. return "Bad fg address for $name, see the doc"
  257. if( ($a[$i+1] !~ m/^f[a-f0-9]$/) && ($a[$i+1] !~ m/^44[1-4][1-4]$/));
  258. } elsif($a[$i] eq "lm") {
  259. return "Bad lm address for $name, see the doc"
  260. if( ($a[$i+1] !~ m/^[a-f0-9]f$/) && ($a[$i+1] !~ m/^[1-4][1-4]44$/));
  261. } elsif($a[$i] eq "gm") {
  262. return "Bad gm address for $name, must be ff"
  263. if( ($a[$i+1] ne "ff") && ($a[$i+1] ne "4444"));
  264. } else {
  265. return $u;
  266. }
  267. my $grpcode = $a[$i+1];
  268. if (length($grpcode) == 4) {
  269. $grpcode = four2hex($grpcode,2);
  270. }
  271. $code = "$housecode $grpcode";
  272. $hash->{CODE}{$ncode++} = $code;
  273. $modules{FS20}{defptr}{$code}{$name} = $hash;
  274. }
  275. AssignIoPort($hash);
  276. }
  277. #############################
  278. sub
  279. FS20_Undef($$)
  280. {
  281. my ($hash, $name) = @_;
  282. foreach my $c (keys %{ $hash->{CODE} } ) {
  283. $c = $hash->{CODE}{$c};
  284. # As after a rename the $name my be different from the $defptr{$c}{$n}
  285. # we look for the hash.
  286. foreach my $dname (keys %{ $modules{FS20}{defptr}{$c} }) {
  287. delete($modules{FS20}{defptr}{$c}{$dname})
  288. if($modules{FS20}{defptr}{$c}{$dname} == $hash);
  289. }
  290. }
  291. return undef;
  292. }
  293. sub
  294. FS20_Parse($$)
  295. {
  296. my ($hash, $msg) = @_;
  297. # Msg format:
  298. # 81 0b 04 f7 0101 a001 HHHH 01 00 11
  299. my $dev = substr($msg, 16, 4);
  300. my $btn = substr($msg, 20, 2);
  301. my $cde = substr($msg, 24, 2);
  302. my $dur = 0;
  303. my $cx = hex($cde);
  304. if($cx & 0x20) { # Timed command
  305. $dur = hex(substr($msg, 26, 2));
  306. my $i = ($dur & 0xf0) / 16;
  307. my $j = ($dur & 0xf);
  308. $dur = (2**$i)*$j*0.25;
  309. $cde = sprintf("%02x", $cx & ~0x20);
  310. }
  311. my $v = $codes{$cde};
  312. $v = "unknown_$cde" if(!defined($v));
  313. $v .= " $dur" if($dur);
  314. my $def = $modules{FS20}{defptr}{"$dev $btn"};
  315. if($def) {
  316. my @list;
  317. foreach my $n (keys %{ $def }) {
  318. my $lh = $def->{$n};
  319. $n = $lh->{NAME}; # It may be renamed
  320. return "" if(IsIgnored($n)); # Little strange.
  321. readingsSingleUpdate($lh, "state", $v, 1);
  322. Log3 $n, 4, "FS20 $n $v";
  323. if($modules{FS20}{ldata}{$n}) {
  324. CommandDelete(undef, $n . "_timer");
  325. delete $modules{FS20}{ldata}{$n};
  326. delete $lh->{TIMED_OnOff};
  327. }
  328. my $newState = "";
  329. if($v =~ m/(on|off).*-for-timer/ && $dur &&
  330. AttrVal($n, "follow-on-for-timer", undef)) {
  331. $newState = ($1 eq "on" ? "off" : "on");
  332. } elsif($v eq "on" && (my $d = AttrVal($n, "follow-on-timer", undef))) {
  333. $dur = $d;
  334. $newState = "off";
  335. }
  336. if($newState) {
  337. my $to = sprintf("%02d:%02d:%02d", $dur/3600, ($dur%3600)/60, $dur%60);
  338. Log3 $n, 4, "Follow: +$to setstate $n $newState";
  339. CommandDefine(undef, $n."_timer at +$to ".
  340. "{readingsSingleUpdate(\$defs{'$n'},'state','$newState', 1); ".
  341. "delete \$defs{'$n'}->{TIMED_OnOff}; undef}");
  342. $modules{FS20}{ldata}{$n} = $to;
  343. $lh->{TIMED_OnOff} = {
  344. START=>time(),
  345. START_FMT=>TimeNow(),
  346. DURATION=>$dur,
  347. CMD=>$v
  348. };
  349. }
  350. push(@list, $n);
  351. }
  352. return @list;
  353. } else {
  354. # Special FHZ initialization parameter. In Multi-FHZ-Mode we receive
  355. # it by the second FHZ
  356. return "" if($dev eq "0001" && $btn eq "00" && $cde eq "00");
  357. my $dev_four = hex2four($dev);
  358. my $btn_four = hex2four($btn);
  359. Log3 $hash, 3, "FS20 Unknown device $dev ($dev_four), " .
  360. "Button $btn ($btn_four) Code $cde ($v), please define it";
  361. return "UNDEFINED FS20_$dev$btn FS20 $dev $btn";
  362. }
  363. }
  364. #############################
  365. sub
  366. hex2four($)
  367. {
  368. my $v = shift;
  369. my $r = "";
  370. foreach my $x (split("", $v)) {
  371. $r .= sprintf("%d%d", (hex($x)/4)+1, (hex($x)%4)+1);
  372. }
  373. return $r;
  374. }
  375. #############################
  376. sub
  377. four2hex($$)
  378. {
  379. my ($v,$len) = @_;
  380. my $r = 0;
  381. foreach my $x (split("", $v)) {
  382. $r = $r*4+($x-1);
  383. }
  384. return sprintf("%0*x", $len,$r);
  385. }
  386. 1;
  387. =pod
  388. =item summary devices communicating via the ELV FS20 protocol
  389. =item summary_DE Anbindung von FS20 Ger&auml;ten
  390. =begin html
  391. <a name="FS20"></a>
  392. <h3>FS20</h3>
  393. <ul>
  394. The FS20 protocol is used by a wide range of devices, which are either of
  395. the sender/sensor category or the receiver/actuator category. The radio
  396. (868.35 MHz) messages are either received through an <a href="#FHZ">FHZ</a>
  397. or an <a href="#CUL">CUL</a> device, so this must be defined first.
  398. <br><br>
  399. <a name="FS20define"></a>
  400. <b>Define</b>
  401. <ul>
  402. <code>define &lt;name&gt; FS20 &lt;housecode&gt; &lt;button&gt;
  403. [fg &lt;fgaddr&gt;] [lm &lt;lmaddr&gt;] [gm FF] </code>
  404. <br><br>
  405. The values of housecode, button, fg, lm, and gm can be either defined as
  406. hexadecimal value or as ELV-like "quad-decimal" value with digits 1-4. We
  407. will reference this ELV-like notation as ELV4 later in this document. You
  408. may even mix both hexadecimal and ELV4 notations, because FHEM can detect
  409. the used notation automatically by counting the digits.<br>
  410. <ul>
  411. <li><code>&lt;housecode&gt;</code> is a 4 digit hex or 8 digit ELV4 number,
  412. corresponding to the housecode address.</li>
  413. <li><code>&lt;button&gt;</code> is a 2 digit hex or 4 digit ELV4 number,
  414. corresponding to a button of the transmitter.</li>
  415. <li>The optional <code>&lt;fgaddr&gt;</code> specifies the function group.
  416. It is a 2 digit hex or 4 digit ELV address. The first digit of the hex
  417. address must be F or the first 2 digits of the ELV4 address must be
  418. 44.</li>
  419. <li>The optional <code>&lt;lmaddr&gt;</code> specifies the local
  420. master. It is a 2 digit hex or 4 digit ELV address. The last digit of the
  421. hex address must be F or the last 2 digits of the ELV4 address must be
  422. 44.</li>
  423. <li>The optional gm specifies the global master, the address must be FF if
  424. defined as hex value or 4444 if defined as ELV4 value.</li>
  425. </ul>
  426. <br>
  427. Examples:
  428. <ul>
  429. <code>define lamp FS20 7777 00 fg F1 gm F</code><br>
  430. <code>define roll1 FS20 7777 01</code><br>
  431. <code>define otherlamp FS20 24242424 1111 fg 4412 gm 4444</code><br>
  432. <code>define otherroll1 FS20 24242424 1114</code>
  433. </ul>
  434. </ul>
  435. <br>
  436. <a name="FS20set"></a>
  437. <b>Set </b>
  438. <ul>
  439. <code>set &lt;name&gt; &lt;value&gt; [&lt;time&gt]</code>
  440. <br><br>
  441. where <code>value</code> is one of:<br>
  442. <ul><code>
  443. dim06% dim12% dim18% dim25% dim31% dim37% dim43% dim50%<br>
  444. dim56% dim62% dim68% dim75% dim81% dim87% dim93% dim100%<br>
  445. dimdown<br>
  446. dimup<br>
  447. dimupdown<br>
  448. off<br>
  449. off-for-timer<br>
  450. on # dimmer: set to value before switching it off<br>
  451. on-for-timer # see the note<br>
  452. on-old-for-timer # set to previous (before switching it on)<br>
  453. ramp-on-time # time to reach the desired dim value on dimmers<br>
  454. ramp-off-time # time to reach the off state on dimmers<br>
  455. reset<br>
  456. sendstate<br>
  457. timer<br>
  458. toggle # between off and previous dim val<br>
  459. </code></ul>
  460. The <a href="#setExtensions"> set extensions</a> are also supported.<br>
  461. <br>
  462. Examples:
  463. <ul>
  464. <code>set lamp on</code><br>
  465. <code>set lamp1,lamp2,lamp3 on</code><br>
  466. <code>set lamp1-lamp3 on</code><br>
  467. <code>set lamp on-for-timer 12</code><br>
  468. </ul>
  469. <br>
  470. Notes:
  471. <ul>
  472. <li>Use reset with care: the device forgets even the housecode.
  473. </li>
  474. <li>As the FS20 protocol needs about 0.22 seconds to transmit a
  475. sequence, a pause of 0.22 seconds is inserted after each command.
  476. </li>
  477. <li>The FS20ST switches on for dim*%, dimup. It does not respond to
  478. sendstate.</li>
  479. <li>If the timer is set (i.e. it is not 0) then on, dim*,
  480. and *-for-timer will take it into account (at least by the FS20ST).
  481. </li>
  482. <li>The <code>time</code> argument ranges from 0.25sec to 4 hours and 16
  483. minutes. As the time is encoded in one byte there are only 112
  484. distinct values, the resolution gets coarse with larger values. The
  485. program will report the used timeout if the specified one cannot be
  486. set exactly. The resolution is 0.25 sec from 0 to 4 sec, 0.5 sec
  487. from 4 to 8 sec, 1 sec from 8 to 16 sec and so on. If you need better
  488. precision for large values, use <a href="#at">at</a> which has a 1
  489. sec resolution.</li>
  490. </ul>
  491. </ul>
  492. <br>
  493. <b>Get</b> <ul>N/A</ul><br>
  494. <a name="FS20attr"></a>
  495. <b>Attributes</b>
  496. <ul>
  497. <a name="IODev"></a>
  498. <li>IODev<br>
  499. Set the IO or physical device which should be used for sending signals
  500. for this "logical" device. An example for the physical device is an FHZ
  501. or a CUL. Note: Upon startup FHEM assigns each logical device
  502. (FS20/HMS/KS300/etc) the last physical device which can receive data
  503. for this type of device. The attribute IODev needs to be used only if
  504. you attached more than one physical device capable of receiving signals
  505. for this logical device.</li><br>
  506. <a name="eventMap"></a>
  507. <li>eventMap<br>
  508. Replace event names and set arguments. The value of this attribute
  509. consists of a list of space separated values, each value is a colon
  510. separated pair. The first part specifies the "old" value, the second
  511. the new/desired value. If the first character is slash(/) or komma(,)
  512. then split not by space but by this character, enabling to embed spaces.
  513. Examples:<ul><code>
  514. attr store eventMap on:open off:closed<br>
  515. attr store eventMap /on-for-timer 10:open/off:closed/<br>
  516. set store open
  517. </code></ul>
  518. </li><br>
  519. <a name="attrdummy"></a>
  520. <li>dummy<br>
  521. Set the device attribute dummy to define devices which should not
  522. output any radio signals. Associated notifys will be executed if
  523. the signal is received. Used e.g. to react to a code from a sender, but
  524. it will not emit radio signal if triggered in the web frontend.
  525. </li><br>
  526. <a name="follow-on-for-timer"></a>
  527. <li>follow-on-for-timer<br>
  528. schedule a "setstate off;trigger off" for the time specified as argument to
  529. the on-for-timer command. Or the same with on, if the command is
  530. off-for-timer.
  531. </li><br>
  532. <a name="follow-on-timer"></a>
  533. <li>follow-on-timer<br>
  534. Like with follow-on-for-timer schedule a "setstate off;trigger off", but
  535. this time for the time specified as argument in seconds to this attribute.
  536. This is used to follow the pre-programmed timer, which was set previously
  537. with the timer command or manually by pressing the button on the device,
  538. see your manual for details. Works for on and dim commands.
  539. </li><br>
  540. <a name="model"></a>
  541. <li>model<br>
  542. The model attribute denotes the model type of the device.
  543. The attributes will (currently) not be used by the fhem.pl directly.
  544. It can be used by e.g. external programs or web interfaces to
  545. distinguish classes of devices and send the appropriate commands
  546. (e.g. "on" or "off" to a fs20st, "dim..%" to fs20du etc.).
  547. The spelling of the model names are as quoted on the printed
  548. documentation which comes which each device. This name is used
  549. without blanks in all lower-case letters. Valid characters should be
  550. <code>a-z 0-9</code> and <code>-</code> (dash),
  551. other characters should be ommited. Here is a list of "official"
  552. devices:<br><br>
  553. <b>Sender/Sensor</b>: fs20fms fs20hgs fs20irl fs20kse fs20ls
  554. fs20pira fs20piri fs20piru fs20s16 fs20s20 fs20s4 fs20s4a fs20s4m
  555. fs20s4u fs20s4ub fs20s8 fs20s8m fs20sd fs20sn fs20sr fs20ss
  556. fs20str fs20tc1 fs20tc6 fs20tfk fs20tk fs20uts fs20ze fs20bf fs20si3<br><br>
  557. <b>Dimmer</b>: fs20di fs20di10 fs20du<br><br>
  558. <b>Receiver/Actor</b>: fs20as1 fs20as4 fs20ms2 fs20rgbsa fs20rst
  559. fs20rsu fs20sa fs20sig fs20sm4 fs20sm8 fs20st fs20su fs20sv fs20ue1
  560. fs20usr fs20ws1
  561. </li><br>
  562. <a name="ignore"></a>
  563. <li>ignore<br>
  564. Ignore this device, e.g. if it belongs to your neighbour. The device
  565. won't trigger any FileLogs/notifys, issued commands will silently
  566. ignored (no RF signal will be sent out, just like for the <a
  567. href="#attrdummy">dummy</a> attribute). The device won't appear in the
  568. list command (only if it is explicitely asked for it), nor will it
  569. appear in commands which use some wildcard/attribute as name specifiers
  570. (see <a href="#devspec">devspec</a>). You still get them with the
  571. "ignored=1" special devspec.
  572. </li><br>
  573. <li><a href="#do_not_notify">do_not_notify</a></li>
  574. <li><a href="#showtime">showtime</a></li>
  575. <li><a href="#readingFnAttributes">readingFnAttributes</a></li>
  576. <li>useSetExtensions<br>
  577. Setting it to 0 you can disable using the Setextensions. Deffault is 1.
  578. </li><br>
  579. </ul>
  580. <br>
  581. <a name="FS20events"></a>
  582. <b>Generated events:</b>
  583. <ul>
  584. From an FS20 device you can receive one of the following events.
  585. <li>on</li>
  586. <li>off</li>
  587. <li>toggle</li>
  588. <li>dimdown</li>
  589. <li>dimup</li>
  590. <li>dimupdown</li>
  591. <li>on-for-timer</li>
  592. Which event is sent is device dependent and can sometimes configured on
  593. the device.
  594. </ul>
  595. </ul>
  596. =end html
  597. =begin html_DE
  598. <a name="FS20"></a>
  599. <h3>FS20</h3>
  600. <ul>
  601. Das FS20 Protokoll wird von einem gro&szlig;en Spektrum an Ger&auml;ten
  602. verwendet. Diese stammen entweder aus der Kategorie Sensor/Sender oder
  603. Aktor/Empf&auml;nger. Die Funknachrichten (868.35 MHz) k&ouml;nnen mit einem
  604. <a href="#FHZ">FHZ</a> oder einem <a href="#CUL">CUL</a> empfangen werden.
  605. Dieses muss daher zuerst definiert werden.
  606. <br><br>
  607. <a name="FS20define"></a>
  608. <b>Define</b>
  609. <ul>
  610. <code>define &lt;name&gt; FS20 &lt;housecode&gt; &lt;button&gt;
  611. [fg &lt;fgaddr&gt;] [lm &lt;lmaddr&gt;] [gm FF] </code>
  612. <br><br>
  613. Die Werte housecode, button, fg, lm, und gm k&ouml;nnen entweder hexadezimal
  614. oder in der ELV-typischen quatern&auml;ren Notation (Zahlen von 1-4)
  615. eingegeben werden.
  616. Hier und auch in sp&auml;teren Beispielen wird als Referenz die ELV4
  617. Notation verwendet. Die Notationen k&ouml;nnen auch gemischt werden da FHEM
  618. die verwendete Notation durch z&auml;hlen der Zeichen erkennt.<br>
  619. <ul>
  620. <li><code>&lt;housecode&gt;</code> ist eine 4 stellige Hex oder 8 stellige
  621. ELV4 Zahl, entsprechend der Hauscode Adresse.</li>
  622. <li><code>&lt;button&gt;</code> ist eine 2 stellige Hex oder 4 stellige ELV4
  623. Zahl, entsprechend dem Button des Transmitters.</li>
  624. <li>Optional definiert <code>&lt;fgaddr&gt;</code> die Funktionsgruppe mit
  625. einer 2 stelligen Hex oder 4 stelligen ELV4 Adresse. Bei Hex muss die
  626. erste Stelle F, bei ELV4 die ersten zwei Stellen 44 sein.</li>
  627. <li>Optional definiert <code>&lt;lmaddr&gt;</code> definiert einen local
  628. master mit einer 2 stelligen Hex oder 4 stelligen ELV4 Adresse. Bei Hex
  629. muss die letzte Stelle F, bei ELV4 die letzten zwei Stellen 44 sein.</li>
  630. <li>Optional definiert gm den global master. Die Adresse muss FF bei HEX
  631. und 4444 bei ELV4 Notation sein.</li>
  632. </ul>
  633. <br>
  634. Beispiele:
  635. <ul>
  636. <code>define lamp FS20 7777 00 fg F1 gm F</code><br>
  637. <code>define roll1 FS20 7777 01</code><br>
  638. <code>define otherlamp FS20 24242424 1111 fg 4412 gm 4444</code><br>
  639. <code>define otherroll1 FS20 24242424 1114</code>
  640. </ul>
  641. </ul>
  642. <br>
  643. <a name="FS20set"></a>
  644. <b>Set </b>
  645. <ul>
  646. <code>set &lt;name&gt; &lt;value&gt; [&lt;time&gt]</code>
  647. <br><br>
  648. Wobei <code>value</code> einer der folgenden Werte sein kann:<br>
  649. <ul><code>
  650. dim06% dim12% dim18% dim25% dim31% dim37% dim43% dim50%<br>
  651. dim56% dim62% dim68% dim75% dim81% dim87% dim93% dim100%<br>
  652. dimdown<br>
  653. dimup<br>
  654. dimupdown<br>
  655. off<br>
  656. off-for-timer<br>
  657. on # dimmer: Setze auf diesen Wert vor dem Ausschalten<br>
  658. on-for-timer # Siehe Hinweise<br>
  659. on-old-for-timer # Setze zum vorherigen (vor dem Einschalten)<br>
  660. ramp-on-time # Zeit bis zum erreichen des gew&uuml;nschten Dim-Wertes<br>
  661. ramp-off-time # Zeit bis zum Ausschalten bei Dimmern<br>
  662. reset<br>
  663. sendstate<br>
  664. timer<br>
  665. toggle # zwischen aus und dem letztern Dim-Wert<br>
  666. </code></ul><br>
  667. Die<a href="#setExtensions"> set extensions</a> sind ebenfalls
  668. unterst&uuml;tzt.<br>
  669. <br>
  670. Beispiele:
  671. <ul>
  672. <code>set lamp on</code><br>
  673. <code>set lamp1,lamp2,lamp3 on</code><br>
  674. <code>set lamp1-lamp3 on</code><br>
  675. <code>set lamp on-for-timer 12</code><br>
  676. </ul>
  677. <br>
  678. Hinweise:
  679. <ul>
  680. <li>reset nur mit Vorsicht verwenden: Auch der Hauscode wird
  681. gel&ouml;scht. </li>
  682. <li>Da das FS20 Protokoll 0.22Sek f&uuml;r eine Funksequenz ben&ouml;tigt
  683. wird nach jeder Ausf&uuml;hrung eine Pause von 0.22Sek eingef&uuml;gt.
  684. </li>
  685. <li>Das FS20ST schaltet f&uuml;r dim*% und dimup ein. Es reagiert nicht
  686. auf sendstate.</li>
  687. <li>Wenn ein Timer gesetzt ist (und dieser nicht 0 ist) werden on, dim*,
  688. und *-for-timer ber&uuml;cksichtigt (zumindest beim FS20ST). </li>
  689. <li>Das <code>time</code> Argument geht von 0.25Sek bis 4Std und 16Min.
  690. Da <code>time</code> nur mit einem Byte dargestellt wird ergeben sich
  691. hieraus nur 112 eindeutige Zeit-Werte die mit ansteigender
  692. gr&ouml;&szlig;e immer gr&ouml;ber aufgel&ouml;st werden. Das Programm
  693. zeigt die exakte Restzeit an wenn die gew&auml;hlte Aufl&ouml;sung
  694. nicht eindeutig war. Die Aufl&ouml;sung ist is 0.25Sek von 0 bis 4
  695. Sekunden, 0.5Sek von 4 bis 8Sek, 1Sek von 8 bis 16 Sek und so weiter.
  696. Wenn eine h&ouml;here Genauigkeit bei gro&szlig;en Werten gebraucht
  697. wird, dann hilft <a href="#at">at</a> mit einer Aufl&ouml;sung von
  698. 1Sek.</li>
  699. </ul>
  700. </ul>
  701. <br>
  702. <b>Get</b> <ul>N/A</ul><br>
  703. <a name="FS20attr"></a>
  704. <b>Attribute</b>
  705. <ul>
  706. <a name="IODev"></a>
  707. <li>IODev<br>
  708. Setzt das IO oder das physische Device welches zum Senden der Signale an
  709. dieses logische Device verwendet werden soll (Beispielsweise FHZ oder
  710. CUL). Hinweis: Beim Start weist FHEM jedem logischen Device das letzte
  711. physische Device zu, das Daten von diesem Typ empfangen kann. Das
  712. Attribut IODev muss nur gesetzt werden wenn mehr als ein physisches
  713. Device f&auml;hig ist Signale von diesem logischen Device zu empfangen.
  714. </li><br>
  715. <a name="eventMap"></a>
  716. <li>eventMap<br>
  717. Ersetze Event Namen und setze Argumente. Der Wert dieses Attributes
  718. besteht aus einer Liste von durch Leerzeichen getrennte Werten. Jeder
  719. Wert ist ein durch Doppelpunkt getrenntes Paar. Der erste Teil stellt den
  720. "alten" Wert, der zweite Teil den "neuen" Wert dar. Wenn der erste Wert
  721. ein Slash (/) oder ein Komma (,) ist, dann wird nicht durch Leerzeichen
  722. sondern durch das vorgestellte Zeichen getrennt.
  723. Beispiele:
  724. <ul><code>
  725. attr store eventMap on:open off:closed<br>
  726. attr store eventMap /on-for-timer 10:open/off:closed/<br>
  727. set store open
  728. </code></ul>
  729. </li><br>
  730. <a name="attrdummy"></a>
  731. <li>dummy<br>
  732. Setzt das Attribut dummy um Devices zu definieren, die keine Funksignale
  733. absetzen. Zugeh&ouml;rige notifys werden ausgef&uuml;hrt wenn das Signal
  734. empfangen wird. Wird beispielsweise genutzt um auf Code eines Sender zu
  735. reagieren, dennoch wird es auch dann kein Signal senden wenn es im Web
  736. Frontend getriggert wird.
  737. </li><br>
  738. <a name="follow-on-for-timer"></a>
  739. <li>follow-on-for-timer<br>
  740. Plant ein "setstate off;trigger off" f&uuml;r die angegebene Zeit als
  741. Argument zum on-for-timer Command. Oder das gleiche mit "on" wenn der
  742. Befehl "follow-off-for-timer" war.
  743. </li><br>
  744. <a name="follow-on-timer"></a>
  745. <li>follow-on-timer<br>
  746. Wie follow-on-for-timer plant es ein "setstate off;trigger off", aber
  747. diesmal als Argument in Sekunden zum Attribut. Wird verwendet um dem
  748. vorprogrammierten Timer zu folgen welcher vorher durch den timer-Befehl,
  749. oder manuell durch Dr&uuml;cken des Buttons gesetzt wurde. Im Handbuch
  750. finden sich noch mehr Informationen. Beachtet bei on und dim Befehlen.
  751. </li><br>
  752. <a name="model"></a>
  753. <li>model<br>
  754. Das "model" Attribut bezeichnet den Modelltyp des Ger&auml;tes. Dieses
  755. Attribut wird (derzeit) nicht direkt durch fhem.pl genutzt. Es kann
  756. beispielsweise von externen Programmen oder Webinterfaces genutzt werden
  757. um Ger&auml;teklassen zu unterscheiden und dazu passende Befehle zu senden
  758. (z.B. "on" oder "off" an ein fs20st, "dim..%" an ein fs20du etc.). Die
  759. Schreibweise des Modellnamens ist wie die in Anf&uuml;hrungszeichen in
  760. der Anleitung gedruckte Bezeichnung die jedem Ger&auml;t beiliegt.
  761. Dieser Name wird ohne Leerzeichen ausschlie&szlig;lich in Kleinbuchstaben
  762. verwendet. G&uuml;ltige Zeichen sind <code>a-z 0-9</code> und
  763. <code>-</code>, andere Zeichen sind zu vermeiden. Hier ist eine Liste der
  764. "offiziellen" Devices:<br><br>
  765. <b>Sender/Sensor</b>: fs20fms fs20hgs fs20irl fs20kse fs20ls
  766. fs20pira fs20piri fs20piru fs20s16 fs20s20 fs20s4 fs20s4a fs20s4m
  767. fs20s4u fs20s4ub fs20s8 fs20s8m fs20sd fs20sn fs20sr fs20ss
  768. fs20str fs20tc1 fs20tc6 fs20tfk fs20tk fs20uts fs20ze fs20bf fs20si3<br><br>
  769. <b>Dimmer</b>: fs20di fs20di10 fs20du<br><br>
  770. <b>Empf&auml;nger/Aktor</b>: fs20as1 fs20as4 fs20ms2 fs20rgbsa fs20rst
  771. fs20rsu fs20sa fs20sig fs20sm4 fs20sm8 fs20st fs20su fs20sv fs20ue1
  772. fs20usr fs20ws1
  773. </li><br>
  774. <a name="ignore"></a>
  775. <li>ignore<br>
  776. Ignoriere dieses Ger&auml;t, beispielsweise wenn es dem Nachbar
  777. geh&ouml;rt. Das Ger&auml;t wird keine FileLogs/notifys triggern,
  778. empfangene Befehle werden stillschweigend ignoriert (es wird kein
  779. Funksignal gesendet, wie auch beim <a href="#attrdummy">dummy</a>
  780. Attribut). Das Ger&auml;t wird weder in der Device-List angezeigt (es sei
  781. denn, es wird explizit abgefragt), noch wird es in Befehlen mit
  782. "Wildcard"-Namenspezifikation (siehe <a href="#devspec">devspec</a>)
  783. erscheinen. Es kann mit dem "ignored=1" devspec dennoch erreicht werden.
  784. </li><br>
  785. <li><a href="#do_not_notify">do_not_notify</a></li>
  786. <li><a href="#showtime">showtime</a></li>
  787. <li><a href="#readingFnAttributes">readingFnAttributes</a></li>
  788. <li>useSetExtensions<br>
  789. Falls es auf 0 gesetzt wird, werden die SetExtensions Befehle nicht
  790. angeboten. Die Voreinstellung ist 1.
  791. </li><br>
  792. </ul>
  793. <br>
  794. <a name="FS20events"></a>
  795. <b>Erzeugte Events:</b>
  796. <ul>
  797. Von einem FS20 Ger&auml;t k&ouml;nnen folgende Events empfangen werden:
  798. <li>on</li>
  799. <li>off</li>
  800. <li>toggle</li>
  801. <li>dimdown</li>
  802. <li>dimup</li>
  803. <li>dimupdown</li>
  804. <li>on-for-timer</li>
  805. Welches Event gesendet wird ist Ger&auml;teabh&auml;ngig und kann manchmal
  806. auf dem Device konfiguriert werden.
  807. </ul>
  808. </ul>
  809. =end html_DE
  810. =cut