50_WS300.pm 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. # $Id: 50_WS300.pm 8178 2015-03-09 00:55:07Z dirkho $
  2. ################################################################
  3. #
  4. # Copyright notice
  5. #
  6. # (c) 2007 Copyright: Martin Klerx (Martin at klerx dot de)
  7. # All rights reserved
  8. #
  9. # This script free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; either version 2 of the License, or
  12. # (at your option) any later version.
  13. #
  14. # The GNU General Public License can be found at
  15. # http://www.gnu.org/copyleft/gpl.html.
  16. # A copy is found in the textfile GPL.txt and important notices to the license
  17. # from the author is found in LICENSE.txt distributed with these scripts.
  18. #
  19. # This script is distributed in the hope that it will be useful,
  20. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. # GNU General Public License for more details.
  23. #
  24. # This copyright notice MUST APPEAR in all copies of the script!
  25. #
  26. ################################################################
  27. # examples:
  28. # define WS300Device WS300 /dev/ttyUSB1 (fixed name, must be first)
  29. # define ash2200-1 WS300 0
  30. # define ash2200-2 WS300 1
  31. # ...
  32. # define ash2200-8 WS300 7
  33. # define ks300 WS300 8 (always 8)
  34. # define ws300 WS300 9 (always 9)
  35. # set WS300Device <interval(5-60 min.)> <height(0-2000 m)> <rainvalume(ml)>
  36. ################################################################
  37. package main;
  38. use strict;
  39. use warnings;
  40. my $DeviceName="";
  41. my $inbuf="";
  42. my $config;
  43. my $cmd=0x32;
  44. my $errcount=0;
  45. my $ir="no";
  46. my $willi=0;
  47. my $oldwind=0.0;
  48. my $polling=0;
  49. my $acthour=99;
  50. my $actday=99;
  51. my $actmonth=99;
  52. my $oldrain=0;
  53. my $rain_hour=0;
  54. my $rain_day=0;
  55. my $rain_month=0;
  56. #####################################
  57. sub
  58. WS300_Initialize($)
  59. {
  60. my ($hash) = @_;
  61. # Provider
  62. $hash->{AttrList} = "do_not_notify:0,1 showtime:0,1 model:ws300 ".
  63. $readingFnAttributes;
  64. $hash->{DefFn} = "WS300_Define";
  65. $hash->{GetFn} = "WS300_Get";
  66. $hash->{ParseFn} = "WS300_Parse";
  67. $hash->{SetFn} = "WS300_Set";
  68. $hash->{UndefFn} = "WS300_Undef";
  69. $hash->{Clients} = ":WS300:"; # Not needed
  70. $hash->{Match} = "^WS300.*"; # Not needed
  71. $hash->{ReadFn} = "WS300_Read"; # Not needed
  72. $hash->{Type} = "FHZ1000"; # Not needed
  73. $hash->{WriteFn} = "WS300_Write"; # Not needed
  74. }
  75. ###################################
  76. sub
  77. WS300_Set($@)
  78. {
  79. my ($hash, @a) = @_;
  80. if($hash->{NAME} eq "WS300Device")
  81. {
  82. return "wrong syntax: set WS300Device <Interval(5-60 min.)> <height(0-2000 m)> <rainvolume(ml)>" if(int(@a) < 4 || int($a[1]) < 5 || int($a[1]) > 60 || int($a[2]) > 2000);
  83. my $bstring = sprintf("%c%c%c%c%c%c%c%c",0xfe,0x30,(int($a[1])&0xff),((int($a[2])>>8)&0xff),(int($a[2])&0xff),((int($a[3])>>8)&0xff),(int($a[3])&0xff),0xfc);
  84. $hash->{PortObj}->write($bstring);
  85. Log 1,"WS300 synchronization started (".unpack('H*',$bstring).")";
  86. return "the ws300pc will now synchronize for 10 minutes";
  87. }
  88. return "No set function implemented";
  89. }
  90. ###################################
  91. sub
  92. WS300_Get(@)
  93. {
  94. my ($hash, @a) = @_;
  95. if($hash->{NAME} eq "WS300Device")
  96. {
  97. Log 5,"WS300_Get $a[0] $a[1]";
  98. WS300_Poll($hash);
  99. return undef;
  100. }
  101. return "No get function implemented";
  102. }
  103. #####################################
  104. sub
  105. WS300_Define($$)
  106. {
  107. my ($hash, $def) = @_;
  108. my @a = split("[ \t][ \t]*", $def);
  109. my $po;
  110. if($a[0] eq "WS300Device")
  111. {
  112. $modules{WS300}{defptr}{10} = $hash;
  113. return "wrong syntax: define WS300Device WS300 <DeviceName>" if(int(@a) < 3);
  114. $DeviceName = $a[2];
  115. $hash->{STATE} = "Initializing";
  116. $hash->{SENSOR} = 10;
  117. $hash->{READINGS}{WS300Device}{VAL} = "Initializing";
  118. $hash->{READINGS}{WS300Device}{TIME} = TimeNow;
  119. if ($^O=~/Win/) {
  120. eval ("use Win32::SerialPort;");
  121. $po = new Win32::SerialPort ($DeviceName);
  122. }else{
  123. eval ("use Device::SerialPort;");
  124. $po = new Device::SerialPort ($DeviceName);
  125. }
  126. if(!$po)
  127. {
  128. $hash->{STATE} = "error opening device";
  129. $hash->{READINGS}{WS300Device}{VAL} = "error opening device";
  130. $hash->{READINGS}{WS300Device}{TIME} = TimeNow;
  131. Log 1,"Error opening WS300 Device $a[2]";
  132. return "Can't open $a[2]: $!\n";
  133. }
  134. $po->reset_error();
  135. $po->baudrate(19200);
  136. $po->databits(8);
  137. $po->parity('even');
  138. $po->stopbits(1);
  139. $po->handshake('none');
  140. $po->rts_active(1);
  141. $po->dtr_active(1);
  142. sleep(1);
  143. $po->rts_active(0);
  144. $po->write_settings;
  145. $hash->{PortObj} = $po;
  146. $hash->{DeviceName} = $a[2];
  147. $hash->{STATE} = "opened";
  148. $hash->{READINGS}{WS300Device}{VAL} = "opened";
  149. $hash->{READINGS}{WS300Device}{TIME} = TimeNow;
  150. CommandDefine(undef,"WS300Device_timer at +*00:00:05 get WS300Device data");
  151. Log 1,"WS300 Device $a[2] opened";
  152. return undef;
  153. }
  154. return "wrong syntax: define <name> WS300 <sensor (0-9)>\n0-7=ASH2200\n8=KS300\n9=WS300" if(int(@a) < 3);
  155. return "no device: define WS300Device WS300 <DeviceName> first" if($DeviceName eq "");
  156. return "Define $a[0]: wrong sensor number." if($a[2] !~ m/^[0-9]$/);
  157. $hash->{SENSOR} = $a[2];
  158. $modules{WS300}{defptr}{$a[2]} = $hash;
  159. return undef;
  160. }
  161. #####################################
  162. sub
  163. WS300_Undef($$)
  164. {
  165. my ($hash, $name) = @_;
  166. return undef if(!defined($hash->{SENSOR}));
  167. delete($modules{WS300}{defptr}{$hash->{SENSOR}});
  168. return undef;
  169. }
  170. #####################################
  171. sub
  172. WS300_Parse($$)
  173. {
  174. my ($hash, $msg) = @_;
  175. my $ll = GetLogLevel("WS300Device");
  176. $ll = 5 if($ll == 2);
  177. my @c = split("", $config);
  178. my @cmsg = split("",unpack('H*',$config));
  179. my $dmsg = unpack('H*',$msg);
  180. my @a = split("", $dmsg);
  181. my $val = "";
  182. my $tm;
  183. my $h;
  184. my $t;
  185. my $b;
  186. my $l;
  187. my $value;
  188. my $offs=0;
  189. my $ref;
  190. my $def;
  191. my $zeit;
  192. my @txt = ( "temperature", "humidity", "wind", "rain_raw", "israining", "battery", "lost_receives", "pressure", "rain_cum", "rain_hour", "rain_day", "rain_month");
  193. # 1 2 3 4 5 6 7 8
  194. # 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
  195. # 3180800001005d4e00000000000000000000000000000000000000000000594a0634001e00f62403f1fc stored
  196. # aaaatttthhtttthhtttthhtttthhtttthhtttthhtttthhtttthhtttthhrrrrwwwwtttthhpppp
  197. # 3300544a0000000000000000000000000000000000000000000057470634002c00f32303ee32fc current
  198. # tttthhtttthhtttthhtttthhtttthhtttthhtttthhtttthhtttthhrrrrwwwwtttthhppppss
  199. # 3210000000000000001005003a0127fc config
  200. # 001122334455667788iihhhhmmmm
  201. $offs = 2 if(hex($a[0].$a[1]) == 0x33);
  202. $offs = 10 if(hex($a[0].$a[1]) == 0x31);
  203. if($offs == 0)
  204. {
  205. Log 1,"WS300 illegal data in WS300_Parse";
  206. return undef;
  207. }
  208. $zeit = time;
  209. my $wind = hex($a[58+$offs].$a[59+$offs].$a[60+$offs].$a[61+$offs]);
  210. $wind /= 10.0;
  211. if(hex($a[0].$a[1]) == 0x33)
  212. {
  213. return undef if(hex($a[74].$a[75]) == $willi && $wind == $oldwind );
  214. $willi = hex($a[74].$a[75]);
  215. $ir="no";
  216. $ir="yes" if(($willi&0x80));
  217. }
  218. else
  219. {
  220. $zeit -= (hex($a[6].$a[7].$a[8].$a[9])*60);
  221. }
  222. my @lt = localtime($zeit);
  223. $tm = sprintf("%04d-%02d-%02d %02d:%02d:%02d",$lt[5]+1900, $lt[4]+1, $lt[3], $lt[2], $lt[1], $lt[0]);
  224. $oldwind = $wind;
  225. my $press = hex($a[68+$offs].$a[69+$offs].$a[70+$offs].$a[71+$offs]);
  226. my $hpress = hex($cmsg[22].$cmsg[23].$cmsg[24].$cmsg[25]);
  227. $hpress /= 8.5;
  228. $press += $hpress;
  229. $press = sprintf("%.1f",$press);
  230. my $rainc = hex($a[54+$offs].$a[55+$offs].$a[56+$offs].$a[57+$offs]);
  231. my $rain = hex($cmsg[26].$cmsg[27].$cmsg[28].$cmsg[29]);
  232. $rain *= $rainc;
  233. $rain /= 1000;
  234. $rain = sprintf("%.1f",$rain);
  235. for(my $s=0;$s<9;$s++)
  236. {
  237. if((ord($c[$s+1])&0x10))
  238. {
  239. my $p=($s*6)+$offs;
  240. Log $ll,"Sensor $s vorhanden";
  241. if(!defined($modules{WS300}{defptr}{$s}))
  242. {
  243. Log 3, "WS300 Unknown device $s, please define it";
  244. return "UNDEFINED WS300_$s WS300 $s";
  245. }
  246. else
  247. {
  248. $def = $modules{WS300}{defptr}{$s};
  249. $def->{READINGS}{$txt[0]}{VAL} = 0 if(!$def->{READINGS});
  250. $ref = $def->{READINGS};
  251. $t = hex($a[$p].$a[$p+1].$a[$p+2].$a[$p+3]);
  252. $t -= 65535 if( $t > 32767 );
  253. $t /= 10.0;
  254. $h = hex($a[$p+4].$a[$p+5]);
  255. if((ord($c[$s+1])&0xe0))
  256. {
  257. $b = "Empty"
  258. }
  259. else
  260. {
  261. $b = "Ok"
  262. }
  263. $l = (ord($c[$s+1])&0x0f);
  264. if($s < 8)
  265. {
  266. readingsBeginUpdate($def);
  267. # state
  268. $val = "T: $t H: $h Bat: $b LR: $l";
  269. $def->{STATE} = $val;
  270. $hash->{".updateTimestamp"};
  271. readingsBulkUpdate($def, 'state', $val);
  272. $def->{CHANGETIME}[0] = $tm;
  273. # temperature
  274. readingsBulkUpdate($def, $txt[0], $t);
  275. # humidity
  276. readingsBulkUpdate($def, $txt[1], $h);
  277. # battery
  278. readingsBulkUpdate($def, $txt[5], $b);
  279. # lost receives
  280. readingsBulkUpdate($def, $txt[6], $l);
  281. Log $ll, "WS300 $def->{NAME}: $val";
  282. readingsEndUpdate($def, 1);
  283. }
  284. else
  285. {
  286. readingsBeginUpdate($def);
  287. # state
  288. $val = "T: $t H: $h W: $wind R: $rain IR: $ir Bat: $b LR: $l";
  289. $def->{STATE} = $val;
  290. $hash->{".updateTimestamp"};
  291. readingsBulkUpdate($def, 'state', $val);
  292. $def->{CHANGETIME}[0] = $tm;
  293. # temperature
  294. readingsBulkUpdate($def, $txt[0], $t);
  295. # humidity
  296. readingsBulkUpdate($def, $txt[1], $h);
  297. # wind
  298. readingsBulkUpdate($def, $txt[2], $wind);
  299. # rain counter
  300. readingsBulkUpdate($def, $txt[3], $rainc);
  301. # is raining
  302. readingsBulkUpdate($def, $txt[4], $ir);
  303. # battery
  304. readingsBulkUpdate($def, $txt[5], $b);
  305. # lost receives
  306. readingsBulkUpdate($def, $txt[6], $l);
  307. # rain cumulative
  308. readingsBulkUpdate($def, $txt[8], $rain);
  309. # statistics
  310. if($actday == 99)
  311. {
  312. $oldrain = $rain;
  313. $acthour = $ref->{acthour}{VAL} if(defined($ref->{acthour}{VAL}));
  314. $actday = $ref->{actday}{VAL} if(defined($ref->{actday}{VAL}));
  315. $actmonth = $ref->{actmonth}{VAL} if(defined($ref->{actmonth}{VAL}));
  316. $rain_day = $ref->{rain_day}{VAL} if(defined($ref->{rain_day}{VAL}));
  317. $rain_month = $ref->{rain_month}{VAL} if(defined($ref->{rain_month}{VAL}));
  318. $rain_hour = $ref->{rain_hour}{VAL} if(defined($ref->{rain_hour}{VAL}));
  319. }
  320. if($acthour != $lt[2])
  321. {
  322. $acthour = $lt[2];
  323. $rain_hour = sprintf("%.1f",$rain_hour);
  324. $rain_day = sprintf("%.1f",$rain_day);
  325. $rain_month = sprintf("%.1f",$rain_month);
  326. $ref->{acthour}{TIME} = $tm;
  327. $ref->{acthour}{VAL} = "$acthour";
  328. readingsBulkUpdate($def, $txt[9], $rain_hour);
  329. readingsBulkUpdate($def, $txt[10], $rain_day);
  330. readingsBulkUpdate($def, $txt[11], $rain_month);
  331. $rain_hour=0;
  332. }
  333. if($actday != $lt[3])
  334. {
  335. $actday = $lt[3];
  336. $ref->{actday}{TIME} = $tm;
  337. $ref->{actday}{VAL} = "$actday";
  338. $rain_day=0;
  339. }
  340. if($actmonth != $lt[4]+1)
  341. {
  342. $actmonth = $lt[4]+1;
  343. $ref->{actmonth}{TIME} = $tm;
  344. $ref->{actmonth}{VAL} = "$actmonth";
  345. $rain_month=0;
  346. }
  347. if($rain != $oldrain)
  348. {
  349. $rain_hour += ($rain-$oldrain);
  350. $rain_hour = sprintf("%.1f",$rain_hour);
  351. $rain_day += ($rain-$oldrain);
  352. $rain_day = sprintf("%.1f",$rain_day);
  353. $rain_month += ($rain-$oldrain);
  354. $rain_month = sprintf("%.1f",$rain_month);
  355. $oldrain = $rain;
  356. $ref->{acthour}{TIME} = $tm;
  357. $ref->{acthour}{VAL} = "$acthour";
  358. readingsBulkUpdate($def, $txt[9], $rain_hour);
  359. readingsBulkUpdate($def, $txt[10], $rain_day);
  360. readingsBulkUpdate($def, $txt[11], $rain_month);
  361. }
  362. Log $ll,"WS300 $def->{NAME}: $val";
  363. readingsEndUpdate($def, 1);
  364. }
  365. }
  366. }
  367. }
  368. if(!defined($modules{WS300}{defptr}{9}))
  369. {
  370. Log 3, "WS300 Unknown device 9, please define it";
  371. return "UNDEFINED WS300_9 WS300 9";
  372. }
  373. else
  374. {
  375. $def = $modules{WS300}{defptr}{9};
  376. $def->{READINGS}{$txt[0]}{VAL} = 0 if(!$def->{READINGS});
  377. $ref = $def->{READINGS};
  378. readingsBeginUpdate($def);
  379. $t = hex($a[62+$offs].$a[63+$offs].$a[64+$offs].$a[65+$offs]);
  380. $t -= 65535 if( $t > 32767 );
  381. $t /= 10.0;
  382. $h = hex($a[66+$offs].$a[67+$offs]);
  383. # state
  384. $val = "T: $t H: $h P: $press Willi: $willi";
  385. $def->{STATE} = $val;
  386. $hash->{".updateTimestamp"};
  387. $def->{CHANGETIME}[0] = $tm;
  388. readingsBulkUpdate($def, 'state', $val);
  389. # temperature
  390. readingsBulkUpdate($def, $txt[0], $t);
  391. # humidity
  392. readingsBulkUpdate($def, $txt[1], $h);
  393. # pressure
  394. readingsBulkUpdate($def, $txt[7], $press);
  395. # willi
  396. readingsBulkUpdate($def, 'willi', $willi);
  397. Log $ll,"WS300 $def->{NAME}: $val";
  398. readingsEndUpdate($def, 1);
  399. }
  400. return undef;
  401. }
  402. #####################################
  403. sub
  404. WS300_Read($)
  405. {
  406. my ($hash) = @_;
  407. }
  408. #####################################
  409. sub
  410. WS300_Write($$$)
  411. {
  412. my ($hash,$fn,$msg) = @_;
  413. }
  414. #####################################
  415. sub
  416. WS300_Poll($)
  417. {
  418. my $hash = shift;
  419. my $bstring=" ";
  420. my $count;
  421. my $po;
  422. my $inchar='';
  423. my $escape=0;
  424. my $ll = GetLogLevel("WS300Device");
  425. $ll = 5 if($ll == 2);
  426. if(!$hash || !defined($hash->{PortObj}))
  427. {
  428. return;
  429. }
  430. return if($polling);
  431. $polling=1;
  432. NEXTPOLL:
  433. $inbuf = $hash->{PortObj}->input();
  434. $bstring = sprintf("%c%c%c",0xfe,$cmd,0xfc);
  435. my $ret = $hash->{PortObj}->write($bstring);
  436. if($ret <= 0)
  437. {
  438. my $devname = $hash->{DeviceName};
  439. Log 1, "USB device $devname disconnected, waiting to reappear";
  440. $hash->{PortObj}->close();
  441. $hash->{STATE} = "disconnected";
  442. $hash->{READINGS}{WS300Device}{VAL} = "disconnected";
  443. $hash->{READINGS}{WS300Device}{TIME} = TimeNow;
  444. sleep(1);
  445. if ($^O=~/Win/) {
  446. $po = new Win32::SerialPort ($devname);
  447. }else{
  448. $po = new Device::SerialPort ($devname);
  449. }
  450. if($po)
  451. {
  452. $po->reset_error();
  453. $po->baudrate(19200);
  454. $po->databits(8);
  455. $po->parity('even');
  456. $po->stopbits(1);
  457. $po->handshake('none');
  458. $po->rts_active(1);
  459. $po->dtr_active(1);
  460. sleep(1);
  461. $po->rts_active(0);
  462. $po->write_settings;
  463. Log 1, "USB device $devname reappeared";
  464. $hash->{PortObj} = $po;
  465. $hash->{STATE} = "opened";
  466. $hash->{READINGS}{WS300Device}{VAL} = "opened";
  467. $hash->{READINGS}{WS300Device}{TIME} = TimeNow;
  468. $polling=0;
  469. return;
  470. }
  471. }
  472. $inbuf = "";
  473. my $start=0;
  474. my $tout=time();
  475. my $rcount=0;
  476. my $ic=0;
  477. for(;;)
  478. {
  479. ($count,$inchar) = $hash->{PortObj}->read(1);
  480. if($count == 0)
  481. {
  482. last if($tout < time());
  483. }
  484. else
  485. {
  486. $ic = hex(unpack('H*',$inchar));
  487. if(!$start)
  488. {
  489. if($ic == 0xfe)
  490. {
  491. $start = 1;
  492. }
  493. }
  494. else
  495. {
  496. if($ic == 0xf8)
  497. {
  498. $escape = 1;
  499. $count = 0;
  500. }
  501. else
  502. {
  503. if($escape)
  504. {
  505. $ic--;
  506. $inbuf .= chr($ic);
  507. $escape = 0;
  508. }
  509. else
  510. {
  511. $inbuf .= $inchar;
  512. last if($ic == 0xfc);
  513. }
  514. }
  515. }
  516. $rcount += $count;
  517. $tout=time();
  518. }
  519. }
  520. Log($ll,"WS300/RAW: ".$rcount." ".unpack('H*',$inbuf));
  521. if($ic != 0xfc)
  522. {
  523. $errcount++ if($errcount < 10);
  524. if($errcount == 10)
  525. {
  526. $hash->{STATE} = "timeout";
  527. $hash->{READINGS}{WS300Device}{VAL} = "timeout";
  528. $hash->{READINGS}{WS300Device}{TIME} = TimeNow;
  529. $errcount++;
  530. }
  531. Log 1,"WS300: no data" if($rcount == 0);
  532. Log 1,"WS300: wrong data ".unpack('H*',$inbuf) if($rcount > 0);
  533. $polling=0;
  534. return;
  535. }
  536. if($hash->{STATE} ne "connected" && $errcount > 10)
  537. {
  538. $hash->{STATE} = "connected";
  539. $hash->{READINGS}{WS300Device}{VAL} = "connected";
  540. $hash->{READINGS}{WS300Device}{TIME} = TimeNow;
  541. }
  542. $errcount = 0;
  543. $ic = ord(substr($inbuf,0,1));
  544. if($ic == 0x32)
  545. {
  546. $config = $inbuf if($rcount == 16);
  547. $cmd=0x31;
  548. goto NEXTPOLL;
  549. }
  550. if($ic == 0x31)
  551. {
  552. if($rcount == 42)
  553. {
  554. WS300_Parse($hash, $inbuf);
  555. goto NEXTPOLL;
  556. }
  557. else
  558. {
  559. $cmd=0x33;
  560. goto NEXTPOLL;
  561. }
  562. }
  563. if($ic == 0x33)
  564. {
  565. WS300_Parse($hash, $inbuf) if($rcount == 39);
  566. $cmd=0x32;
  567. }
  568. $polling=0;
  569. }
  570. 1;
  571. =pod
  572. =begin html
  573. <a name="WS300"></a>
  574. <h3>WS300</h3>
  575. <ul>
  576. <br>
  577. <a name="WS300define"></a>
  578. <b>Define</b>
  579. <ul>
  580. <code>define WS300Device WS300 &lt;serial device&gt;</code><br>
  581. or<br>
  582. <code>define &lt;devname&gt WS300 [0-9]</code><br>
  583. <br>
  584. The first line is mandatory if you have a WS300 device: it defines the
  585. input device with its USB port. The name of this device is fixed and must
  586. be WS300Device. It must be the first defined WS300 device.<br>
  587. For each additional device (with number 0 to 9) you have to define another
  588. WS300 device, with an arbitrary name. The WS300 device which reports the
  589. readings will be defined with the port number 9, an optional KS300 with the
  590. port number 8.<br><br>
  591. Examples:
  592. <pre>
  593. define WS300Device WS300 /dev/ttyUSB1
  594. define ash2200.1 WS300 0
  595. define ks300 WS300 8
  596. define ws300 WS300 9
  597. </pre>
  598. </ul>
  599. <br>
  600. <a name="WS300set"></a>
  601. <b>Set </b>
  602. <ul>
  603. <code>set WS300Device &lt;interval(min.)&gt; &lt;height(m)&gt; &lt;rainvalume(ml)&gt;</code>
  604. <br><br>
  605. Set some WS300 configuration parameters.
  606. </ul>
  607. <a name="WS300get"></a>
  608. <b>Get</b>
  609. <ul>
  610. N/A
  611. </ul>
  612. <br>
  613. <a name="WS300attr"></a>
  614. <b>Attributes</b>
  615. <ul>
  616. <li><a href="#do_not_notify">do_not_notify</a></li>
  617. <li><a href="#model">model</a> (ws300)</li>
  618. <li><a href="#readingFnAttributes">readingFnAttributes</a></li>
  619. </ul>
  620. <br>
  621. </ul>
  622. =end html
  623. =cut