43_RFXX10REC.pm 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. #################################################################################
  2. # 43_RFXX10REC.pm
  3. # Modul for FHEM for
  4. # - X10 security messages for
  5. # - ds10a: X10 Door / Window Sensor or compatible devices
  6. # - ss10a: X10 motion sensor
  7. # - sd90: Marmitek smoke detector
  8. # - kr18: X10 remote control
  9. # - X10 light messages for
  10. # - ms14a: motion sensor
  11. # - x10: generic X10 sensor
  12. #
  13. #
  14. # (c) 2010-2014 Copyright: Willi Herzig (Willi.Herzig@gmail.com)
  15. #
  16. # This script is distributed in the hope that it will be useful,
  17. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  19. #
  20. ##################################
  21. #
  22. # Special thanks to RFXCOM, http://www.rfxcom.com/, for their
  23. # help. I own an USB-RFXCOM-Receiver (433.92MHz, USB, order code 80002)
  24. # and highly recommend it.
  25. #
  26. ##################################
  27. #
  28. # Some code from X10security code is derived from http://www.xpl-perl.org.uk/.
  29. # xpl-perl/lib/xPL/RF/X10Security.pm:
  30. # Thanks a lot to Mark Hindess who wrote xPL.
  31. #
  32. #SEE ALSO
  33. # Project website: http://www.xpl-perl.org.uk/
  34. # AUTHOR: Mark Hindess, soft-xpl-perl@temporalanomaly.com
  35. #
  36. #Copyright (C) 2007, 2009 by Mark Hindess
  37. #
  38. #This library is free software; you can redistribute it and/or modify
  39. #it under the same terms as Perl itself, either Perl version 5.8.7 or,
  40. #at your option, any later version of Perl 5 you may have available.
  41. #
  42. ##################################
  43. #
  44. # values for "set global verbose"
  45. # 4: log unknown protocols
  46. # 5: log decoding hexlines for debugging
  47. #
  48. # $Id: 43_RFXX10REC.pm 5599 2014-04-22 15:26:46Z wherzig $
  49. package main;
  50. use strict;
  51. use warnings;
  52. # Debug this module? YES = 1, NO = 0
  53. my $RFXX10REC_debug = 0;
  54. my $time_old = 0;
  55. my $RFXX10REC_type_default = "ds10a";
  56. my $RFXX10REC_X10_type_default = "x10";
  57. my $DOT = q{_};
  58. sub
  59. RFXX10REC_Initialize($)
  60. {
  61. my ($hash) = @_;
  62. $hash->{Match} = "^(20|29).*";
  63. $hash->{DefFn} = "RFXX10REC_Define";
  64. $hash->{UndefFn} = "RFXX10REC_Undef";
  65. $hash->{ParseFn} = "RFXX10REC_Parse";
  66. $hash->{AttrList} = "IODev ignore:1,0 do_not_notify:1,0 loglevel:0,1,2,3,4,5,6";
  67. #Log 1, "RFXX10REC: Initialize";
  68. }
  69. #####################################
  70. sub
  71. RFXX10REC_Define($$)
  72. {
  73. my ($hash, $def) = @_;
  74. my @a = split("[ \t][ \t]*", $def);
  75. my $a = int(@a);
  76. if(int(@a) != 5 && int(@a) != 7) {
  77. Log 1,"RFXX10REC wrong syntax '@a'. \nCorrect syntax is 'define <name> RFXX10REC <type> <deviceid> <devicelog> [<deviceid2> <devicelog2>]'";
  78. return "wrong syntax: define <name> RFXX10REC <type> <deviceid> <devicelog> [<deviceid2> <devicelog2>]";
  79. }
  80. my $name = $a[0];
  81. my $type = lc($a[2]);
  82. my $deviceid = $a[3];
  83. my $devicelog = $a[4];
  84. my $device_name = "RFXX10REC".$DOT.$deviceid;
  85. if ($type ne "ds10a" && $type ne "sd90" && $type ne "x10" && $type ne "ms10a" && $type ne "ms14a" && $type ne "kr18") {
  86. Log 1,"RFX10SEC define: wrong type: $type";
  87. return "RFX10SEC: wrong type: $type";
  88. }
  89. $hash->{RFXX10REC_deviceid} = $deviceid;
  90. $hash->{RFXX10REC_devicelog} = $devicelog;
  91. $hash->{RFXX10REC_type} = $type;
  92. #$hash->{RFXX10REC_CODE} = $deviceid;
  93. $modules{RFXX10REC}{defptr}{$device_name} = $hash;
  94. if (int(@a) == 7) {
  95. # there is a second deviceid:
  96. #
  97. my $deviceid2 = $a[5];
  98. my $devicelog2 = $a[6];
  99. my $device_name2 = "RFXX10REC".$DOT.$deviceid2;
  100. $hash->{RFXX10REC_deviceid2} = $deviceid2;
  101. $hash->{RFXX10REC_devicelog2} = $devicelog2;
  102. #$hash->{RFXX10REC_CODE2} = $deviceid2;
  103. $modules{RFXX10REC}{defptr2}{$device_name2} = $hash;
  104. }
  105. AssignIoPort($hash);
  106. return undef;
  107. }
  108. #####################################
  109. sub
  110. RFXX10REC_Undef($$)
  111. {
  112. my ($hash, $name) = @_;
  113. delete($modules{RFXX10REC}{defptr}{$name});
  114. return undef;
  115. }
  116. #####################################
  117. sub RFXX10REC_parse_X10 {
  118. my $bytes = shift;
  119. # checksum test
  120. (($bytes->[0]^0xff) == $bytes->[1] && ($bytes->[2]^0xff) == $bytes->[3])
  121. or return "";
  122. #RFXX10REC_reverse_bits($bytes);
  123. my %x10_devname =
  124. (
  125. 0x60 => "A",
  126. 0x70 => "B",
  127. 0x40 => "C",
  128. 0x50 => "D",
  129. 0x80 => "E",
  130. 0x90 => "F",
  131. 0xA0 => "G",
  132. 0xB0 => "H",
  133. 0xE0 => "I",
  134. 0xF0 => "J",
  135. 0xC0 => "K",
  136. 0xD0 => "L",
  137. 0x00 => "M",
  138. 0x10 => "N",
  139. 0x20 => "O",
  140. 0x30 => "P",
  141. );
  142. my $dev_first = "?";
  143. my $devnr = $bytes->[0] & 0xf0;
  144. if (exists $x10_devname{$devnr}) {
  145. $dev_first = $x10_devname{$devnr};
  146. }
  147. my $unit_bit0 = ($bytes->[2] & 0x10) ? 1 : 0;
  148. my $unit_bit1 = ($bytes->[2] & 0x08) ? 1 : 0;
  149. my $unit_bit2 = ($bytes->[2] & 0x40) ? 1 : 0;
  150. my $unit_bit3 = ($bytes->[0] & 0x04) ? 1 : 0;
  151. my $unit = $unit_bit0 * 1 + $unit_bit1 * 2 + $unit_bit2 * 4 +$unit_bit3 * 8 + 1;
  152. my $device = sprintf '%s%0d', $dev_first, $unit;
  153. my $data = $bytes->[2];
  154. my $hexdata = sprintf '%02x', $bytes->[2];
  155. my $error;
  156. if ($data == 0x98) {
  157. $error = "RFXX10REC: X10 command 'Dim' not implemented, device=".$dev_first;
  158. Log 1,$error;
  159. return $error;
  160. } elsif ($data == 0x88) {
  161. $error = "RFXX10REC: X10 command 'Bright' not implemented, device=".$dev_first;
  162. Log 1,$error;
  163. return $error;
  164. } elsif ($data == 0x90) {
  165. $error = "RFXX10REC: X10 command 'All Lights on' not implemented, device=".$dev_first;
  166. Log 1,$error;
  167. return $error;
  168. } elsif ($data == 0x80) {
  169. $error = "RFXX10REC: X10 command 'All Lights off' not implemented, device=".$dev_first;
  170. Log 1,$error;
  171. return $error;
  172. }
  173. my $command;
  174. if ($data & 0x20) {
  175. $command = "off";
  176. } else {
  177. $command = "on";
  178. }
  179. my @res;
  180. my $current = "";
  181. #--------------
  182. my $device_name = "RFXX10REC".$DOT.$device;
  183. #Log 1, "RFXX10REC: device_name=$device_name command=$command" if ($RFXX10REC_debug == 1);
  184. my $firstdevice = 1;
  185. my $def = $modules{RFXX10REC}{defptr}{$device_name};
  186. if(!$def) {
  187. #Log 1, "-1- not device_name=$device_name";
  188. $firstdevice = 0;
  189. $def = $modules{RFXX10REC}{defptr2}{$device_name};
  190. if (!$def) {
  191. #Log 1, "-2- not device_name=$device_name";
  192. Log 3, "RFXX10REC: RFXX10REC Unknown device $device_name, please define it";
  193. return "UNDEFINED $device_name RFXX10REC $RFXX10REC_X10_type_default $device Unknown";
  194. }
  195. }
  196. # Use $def->{NAME}, because the device may be renamed:
  197. my $name = $def->{NAME};
  198. return "" if(IsIgnored($name));
  199. Log 1, "RFXX10REC: $name devn=$device_name first=$firstdevice type=$command, cmd=$hexdata" if ($RFXX10REC_debug == 1);
  200. my $n = 0;
  201. my $tm = TimeNow();
  202. my $val = "";
  203. my $device_type = $def->{RFXX10REC_type};
  204. #Log 1,"device_name=$device_name name=$name, type=$type";
  205. my $sensor = "";
  206. if ($device_type eq "ms14a") {
  207. # for ms14a behave like x11, but flip second deviceid
  208. $device_type = "x10";
  209. if ($firstdevice == 1) {
  210. $command = ($command eq "on") ? "alert" : "normal" ;
  211. } else {
  212. $command = ($command eq "on") ? "off" : "on" ;
  213. }
  214. }
  215. if ($device_type eq "x10") {
  216. $current = $command;
  217. $sensor = $firstdevice == 1 ? $def->{RFXX10REC_devicelog} : $def->{RFXX10REC_devicelog2};
  218. $val .= $current;
  219. $def->{READINGS}{$sensor}{TIME} = $tm;
  220. $def->{READINGS}{$sensor}{VAL} = $current;
  221. $def->{CHANGED}[$n++] = $sensor . ": " . $current;
  222. } else {
  223. Log 1, "RFXX10REC: X10 error unknown sensor type=$device_type $name devn=$device_name first=$firstdevice type=$command, user=$device (hex $hexdata)";
  224. return "RFXX10REC X10 error unknown sensor type=$device_type for $device_name device=$device";
  225. }
  226. if (($firstdevice == 1) && $val) {
  227. $def->{STATE} = $val;
  228. $def->{TIME} = $tm;
  229. $def->{CHANGED}[$n++] = $val;
  230. }
  231. DoTrigger($name, undef);
  232. return "";
  233. }
  234. #####################################
  235. sub RFXX10REC_parse_X10Sec {
  236. my $bytes = shift;
  237. # checksum test
  238. (($bytes->[0]^0x0f) == $bytes->[1] && ($bytes->[2]^0xff) == $bytes->[3])
  239. or return "";
  240. #RFXX10REC_reverse_bits($bytes);
  241. #my $device = sprintf 'x10sec%02x', $bytes->[0];
  242. my $device = sprintf '%02x%02x', $bytes->[4], $bytes->[0];
  243. #Log 1, "X10Sec device-nr=$device";
  244. my $short_device = $bytes->[0];
  245. my $data = $bytes->[2];
  246. my $hexdata = sprintf '%02x', $bytes->[2];
  247. #Log 1, "X10Sec data=$hexdata";
  248. my %x10_security =
  249. (
  250. 0x00 => ['X10Sec', 'alert', 'max_delay', 'batt_ok'],
  251. 0x01 => ['X10Sec', 'alert', 'max_delay', 'batt_low'],
  252. 0x04 => ['X10Sec', 'alert', 'min_delay', 'batt_ok'],
  253. 0x05 => ['X10Sec', 'alert', 'min_delay', 'batt_low'],
  254. 0x80 => ['X10Sec', 'normal', 'max_delay', 'batt_ok'],
  255. 0x81 => ['X10Sec', 'normal', 'max_delay', 'batt_low'],
  256. 0x84 => ['X10Sec', 'normal', 'min_delay', 'batt_ok'],
  257. 0x85 => ['X10Sec', 'normal', 'min_delay', 'batt_low'],
  258. 0x26 => ['X10Sec', 'alert', '', ''],
  259. #
  260. 0x0c => ['X10Sec', 'alert', '', 'batt_ok'], # MS10a
  261. 0x0d => ['X10Sec', 'alert', '', 'batt_low'], # MS10a
  262. 0x8c => ['X10Sec', 'normal', '', 'batt_ok'], # MS10a
  263. 0x8d => ['X10Sec', 'normal', '', 'batt_low'], # MS10a
  264. #
  265. 0x06 => ['X10Sec', 'Security-Arm', '', ''], # kr18
  266. 0x86 => ['X10Sec', 'Security-Disarm', '', ''], # kr18
  267. 0x42 => ['X10Sec', 'ButtonA-on', '', ''], # kr18
  268. 0xc2 => ['X10Sec', 'ButtonA-off', '', ''], # kr18
  269. 0x46 => ['X10Sec', 'ButtonB-on', '', ''], # kr18
  270. 0xc6 => ['X10Sec', 'ButtonB-off', '', ''], # kr18
  271. );
  272. my $command = "";
  273. my $type = "";
  274. my $delay = "";
  275. my $battery = "";
  276. my @res;
  277. my %args;
  278. if (exists $x10_security{$data}) {
  279. my $rec = $x10_security{$data};
  280. if (ref $rec) {
  281. ($type, $command, $delay, $battery) = @$rec;
  282. } else {
  283. $command = $rec;
  284. }
  285. } else {
  286. Log 1, "RFXX10REC undefined command cmd=$data device-nr=$device, hex=$hexdata";
  287. return "RFXX10REC undefined command";
  288. }
  289. my $current = "";
  290. #--------------
  291. my $device_name = "RFXX10REC".$DOT.$device;
  292. #Log 1, "device_name=$device_name";
  293. Log 4, "device_name=$device_name";
  294. my $firstdevice = 1;
  295. my $def = $modules{RFXX10REC}{defptr}{$device_name};
  296. if(!$def) {
  297. #Log 1, "-1- not device_name=$device_name";
  298. $firstdevice = 0;
  299. $def = $modules{RFXX10REC}{defptr2}{$device_name};
  300. if (!$def) {
  301. #Log 1, "-2- not device_name=$device_name";
  302. Log 3, "RFXX10REC: RFXX10REC Unknown device $device_name, please define it";
  303. return "UNDEFINED $device_name RFXX10REC $RFXX10REC_type_default $device Window";
  304. }
  305. }
  306. # Use $def->{NAME}, because the device may be renamed:
  307. my $name = $def->{NAME};
  308. #Log 1, "name=$new_name";
  309. return "" if(IsIgnored($name));
  310. Log 1, "RFXX10REC: $name devn=$device_name first=$firstdevice type=$command, delay=$delay, batt=$battery cmd=$hexdata" if ($RFXX10REC_debug == 1);
  311. my $n = 0;
  312. my $tm = TimeNow();
  313. my $val = "";
  314. my $device_type = $def->{RFXX10REC_type};
  315. #Log 1,"device_name=$device_name name=$name, type=$type";
  316. my $sensor = "";
  317. if ($device_type eq "ds10a") {
  318. $current = "Error";
  319. $current = "Open" if ($command eq "alert");
  320. $current = "Closed" if ($command eq "normal");
  321. $sensor = $def->{RFXX10REC_devicelog};
  322. $val .= $current;
  323. $def->{READINGS}{$sensor}{TIME} = $tm;
  324. $def->{READINGS}{$sensor}{VAL} = $current;
  325. $def->{CHANGED}[$n++] = $sensor . ": " . $current;
  326. if (($def->{STATE} ne $val)) {
  327. $sensor = "statechange";
  328. $def->{READINGS}{$sensor}{TIME} = $tm;
  329. $def->{READINGS}{$sensor}{VAL} = $current;
  330. $def->{CHANGED}[$n++] = $sensor . ": " . $current;
  331. }
  332. if ($battery ne '') {
  333. $sensor = "battery";
  334. $current = "Error";
  335. $current = "ok" if ($battery eq "batt_ok");
  336. $current = "low" if ($battery eq "batt_low");
  337. $def->{READINGS}{$sensor}{TIME} = $tm;
  338. $def->{READINGS}{$sensor}{VAL} = $current;
  339. $def->{CHANGED}[$n++] = $sensor . ": " . $current;
  340. }
  341. if ($delay ne '') {
  342. $sensor = "delay";
  343. $current = "Error";
  344. $current = "min" if ($delay eq "min_delay");
  345. $current = "max" if ($delay eq "max_delay");
  346. $def->{READINGS}{$sensor}{TIME} = $tm;
  347. $def->{READINGS}{$sensor}{VAL} = $current;
  348. $def->{CHANGED}[$n++] = $sensor . ": " . $current;
  349. }
  350. } elsif ($device_type eq "sd90") {
  351. $sensor = $firstdevice == 1 ? $def->{RFXX10REC_devicelog} : $def->{RFXX10REC_devicelog2};
  352. $current = $command;
  353. if ($firstdevice == 1) {
  354. $val .= $current;
  355. }
  356. $def->{READINGS}{$sensor}{TIME} = $tm;
  357. $def->{READINGS}{$sensor}{VAL} = $current;
  358. $def->{CHANGED}[$n++] = $sensor . ": " . $current;
  359. if ($battery) {
  360. $sensor = "battery";
  361. $current = "Error";
  362. $current = "ok" if ($battery eq "batt_ok");
  363. $current = "low" if ($battery eq "bat_low");
  364. $def->{READINGS}{$sensor}{TIME} = $tm;
  365. $def->{READINGS}{$sensor}{VAL} = $current;
  366. $def->{CHANGED}[$n++] = $sensor . ": " . $current;
  367. }
  368. # sd90 does not have a delay switch
  369. if (0 && $delay) {
  370. $sensor = "delay";
  371. $current = "Error";
  372. $current = "min" if ($delay eq "min_delay");
  373. $current = "max" if ($delay eq "max_delay");
  374. $def->{READINGS}{$sensor}{TIME} = $tm;
  375. $def->{READINGS}{$sensor}{VAL} = $current;
  376. $def->{CHANGED}[$n++] = $sensor . ": " . $current;
  377. }
  378. } elsif ($device_type eq "ms10a") {
  379. $current = $command;
  380. $sensor = $def->{RFXX10REC_devicelog};
  381. $val .= $current;
  382. $def->{READINGS}{$sensor}{TIME} = $tm;
  383. $def->{READINGS}{$sensor}{VAL} = $current;
  384. $def->{CHANGED}[$n++] = $sensor . ": " . $current;
  385. if (($def->{STATE} ne $val)) {
  386. $sensor = "statechange";
  387. $def->{READINGS}{$sensor}{TIME} = $tm;
  388. $def->{READINGS}{$sensor}{VAL} = $current;
  389. $def->{CHANGED}[$n++] = $sensor . ": " . $current;
  390. }
  391. if ($battery ne '') {
  392. $sensor = "battery";
  393. $current = "Error";
  394. $current = "ok" if ($battery eq "batt_ok");
  395. $current = "low" if ($battery eq "batt_low");
  396. $def->{READINGS}{$sensor}{TIME} = $tm;
  397. $def->{READINGS}{$sensor}{VAL} = $current;
  398. $def->{CHANGED}[$n++] = $sensor . ": " . $current;
  399. }
  400. } elsif ($device_type eq "kr18") {
  401. $current = $command;
  402. #$sensor = $def->{RFXX10REC_devicelog};
  403. $val = $current;
  404. #$def->{READINGS}{$sensor}{TIME} = $tm;
  405. #$def->{READINGS}{$sensor}{VAL} = $current;
  406. #$def->{CHANGED}[$n++] = $sensor . ": " . $current;
  407. my @cmd_split = split(/-/, $command);
  408. $sensor = $cmd_split[0];
  409. $current = $cmd_split[1];
  410. $def->{READINGS}{$sensor}{TIME} = $tm;
  411. $def->{READINGS}{$sensor}{VAL} = $current;
  412. $def->{CHANGED}[$n++] = $sensor . ": " . $current;
  413. } else {
  414. Log 1, "RFXX10REC: error unknown sensor type=$device_type $name devn=$device_name first=$firstdevice type=$command, user=$device, delay=$delay, batt=$battery (hex $hexdata)";
  415. return "RFXX10REC error unknown sensor type=$device_type for $device_name device=$device";
  416. }
  417. if (($firstdevice == 1) && $val) {
  418. $def->{STATE} = $val;
  419. $def->{TIME} = $tm;
  420. $def->{CHANGED}[$n++] = $val;
  421. }
  422. DoTrigger($name, undef);
  423. return "";
  424. }
  425. sub
  426. RFXX10REC_Parse($$)
  427. {
  428. my ($hash, $msg) = @_;
  429. my $time = time();
  430. if ($time_old ==0) {
  431. Log 5, "RFXX10REC: decoding delay=0 hex=$msg";
  432. } else {
  433. my $time_diff = $time - $time_old ;
  434. Log 5, "RFXX10REC: decoding delay=$time_diff hex=$msg";
  435. }
  436. $time_old = $time;
  437. # convert to binary
  438. my $bin_msg = pack('H*', $msg);
  439. # convert string to array of bytes. Skip length byte
  440. my @rfxcom_data_array = ();
  441. foreach (split(//, substr($bin_msg,1))) {
  442. push (@rfxcom_data_array, ord($_) );
  443. }
  444. my $bits = ord($bin_msg);
  445. my $num_bytes = $bits >> 3; if (($bits & 0x7) != 0) { $num_bytes++; }
  446. my $res = "";
  447. if ($bits == 41) {
  448. Log 1, "RFXX10REC: bits=$bits num_bytes=$num_bytes hex=$msg" if ($RFXX10REC_debug == 1);
  449. $res = RFXX10REC_parse_X10Sec(\@rfxcom_data_array);
  450. Log 1, "RFXX10REC: unsupported hex=$msg" if ($res ne "" && $res !~ /^UNDEFINED.*/);
  451. return $res;
  452. } elsif ($bits == 32) {
  453. Log 1, "RFXX10REC: bits=$bits num_bytes=$num_bytes hex=$msg" if ($RFXX10REC_debug == 1);
  454. $res = RFXX10REC_parse_X10(\@rfxcom_data_array);
  455. Log 1, "RFXX10REC: unsupported hex=$msg" if ($res ne "" && $res !~ /^UNDEFINED.*/);
  456. return $res;
  457. } else {
  458. Log 0, "RFXX10REC: bits=$bits num_bytes=$num_bytes hex=$msg";
  459. }
  460. return "";
  461. }
  462. 1;
  463. =pod
  464. =begin html
  465. <a name="RFXX10REC"></a>
  466. <h3>RFXX10REC</h3>
  467. <ul>
  468. The RFXX10REC module interprets X10 security and X10 lighting messages received by a RFXCOM RF receiver. Reported also to work with KlikAanKlikUit. You need to define an RFXCOM receiver first.
  469. See <a href="#RFXCOM">RFXCOM</a>.
  470. <br><br>
  471. <a name="RFXX10RECdefine"></a>
  472. <b>Define</b>
  473. <ul>
  474. <code>define &lt;name&gt; RFXX10REC &lt;type&gt; &lt;deviceid&gt; &lt;devicelog&gt; [&lt;deviceid&gt; &lt;devicelog&gt;] </code> <br>
  475. <br>
  476. <code>&lt;type&gt;</code>
  477. <ul>
  478. specifies the type of the X10 device: <br>
  479. X10 security devices:
  480. <ul>
  481. <li> <code>ds10a</code> (X10 security ds10a Door/Window Sensor or compatible devices. This device type reports the status of the switch [Open/Closed], status of the delay switch [min|max]], and battery status [ok|low].)</li>
  482. <li> <code>ms10a</code> (X10 security ms10a motion sensor. This device type reports the status of motion sensor [normal|alert] and battery status [ok|low].))</li>
  483. <li> <code>sd90</code> (Marmitek sd90 smoke detector. This device type reports the status of the smoke detector [normal|alert] and battery status [ok|low].)</li>
  484. <li> <code>kr18</code> (X10 security remote control. Report the Reading "Security" with values [Arm|Disarm], "ButtonA" and "ButtonB" with values [on|off] )</li>
  485. </ul>
  486. X10 lighting devices:
  487. <ul>
  488. <li> <code>ms14a</code> (X10 motion sensor. Reports [normal|alert] on the first deviceid (motion sensor) and [on|off] for the second deviceid (light sensor)) </li>
  489. <li> <code>x10</code> (All other x10 devices. Report [on|off] on both deviceids.)</li>
  490. </ul>
  491. </ul>
  492. <br>
  493. <code>&lt;deviceid&gt;</code>
  494. <ul>
  495. specifies the first device id of the device. X10 security have a a 16-Bit device id which has to be written as a hex-string (example "5a54").
  496. A X10 lighting device has a house code A..P followed by a unitcode 1..16 (example "B1").
  497. </ul>
  498. <br>
  499. <code>&lt;devicelog&gt;</code>
  500. <ul>
  501. is the name of the Reading used to report. Suggested: "Window" or "Door" for ds10a, "motion" for motion sensors, "Smoke" for sd90.
  502. </ul>
  503. <br>
  504. <code>&lt;deviceid2&gt;</code>
  505. <ul>
  506. is optional and specifies the second device id of the device if it exists. For example sd90 smoke sensors can be configured to report two device ids. ms14a motion sensors report motion status on the first deviceid and the status of the light sensor on the second deviceid.
  507. </ul>
  508. <br>
  509. <code>&lt;devicelog2&gt;</code>
  510. <ul>
  511. is optional for the name used for the Reading of <code>&lt;deviceid2&gt;</code>.
  512. </ul>
  513. <br>
  514. Example: <br>
  515. <code>define livingroom_window RFXX10REC ds10a 72cd Window</code>
  516. <br>
  517. <code>define motion_sensor1 RFXX10REC ms10a 55c6 motion</code>
  518. <br>
  519. <code>define smoke_sensor1 RFXX10REC sd90 54d3 Smoke 54d3 Smoketest</code>
  520. <br>
  521. <code>define motion_sensor2 RFXX10REC ms14a A1 motion A2 light</code>
  522. <br>
  523. </ul>
  524. <br>
  525. <a name="RFXX10RECset"></a>
  526. <b>Set</b> <ul>N/A</ul><br>
  527. <a name="RFXX10RECget"></a>
  528. <b>Get</b> <ul>N/A</ul><br>
  529. <a name="RFXX10RECattr"></a>
  530. <b>Attributes</b>
  531. <ul>
  532. <li><a href="#ignore">ignore</a></li><br>
  533. <li><a href="#do_not_notify">do_not_notify</a></li><br>
  534. </ul>
  535. </ul>
  536. =end html
  537. =cut