98_LW12.pm 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. # $Id: 98_LW12.pm 9440 2015-10-11 19:24:02Z kuzl $
  2. # ############################################################################
  3. #
  4. # FHEM Modue for WLAN based LED Driver
  5. #
  6. # ############################################################################
  7. #
  8. # This is absolutley open source. Please feel free to use just as you
  9. # like. Please note, that no warranty is given and no liability
  10. # granted
  11. #
  12. # ############################################################################
  13. #
  14. # we have the following readings
  15. # state on|off
  16. # dim 0-100
  17. # hsv the rgb in hsv-spectrum
  18. # mode 1-21
  19. # rgb color in rgb
  20. # speed 0-255
  21. #
  22. # ############################################################################
  23. #
  24. # we have the following attributes
  25. # timeout the timeout in seconds for the TCP connection
  26. # updateInterval the interval for automatic Statusupdate
  27. #
  28. # ############################################################################
  29. # we have the following internals (all UPPERCASE)
  30. # RED (helper) last red value
  31. # GREEN (helper) last green value
  32. # BLUE (helper) last blue value
  33. # IP the IP of the device
  34. #
  35. # ############################################################################
  36. # TODO:
  37. # ############################################################################
  38. package main;
  39. use strict;
  40. use warnings;
  41. use feature qw/say switch/;
  42. use IO::Socket;
  43. # include this for the self-calling timer we use later on
  44. use Time::HiRes qw(gettimeofday);
  45. # for the color picker module
  46. use Color;
  47. use SetExtensions;
  48. #global Variable
  49. my $offset = 36;
  50. sub LW12_UpdateRGB($);
  51. sub LW12_updateStatus($);
  52. # ----------------------------------------------------------------------------
  53. # Initialisation routine called upon start-up of FHEM
  54. # ----------------------------------------------------------------------------
  55. sub LW12_Initialize( $ ) {
  56. my ($hash) = @_;
  57. # the commands we provide to FHEM
  58. # installs the respecitive call-backs for FHEM. The call back in quotes
  59. # must be realised as a sub later on in the file
  60. $hash->{DefFn} = "LW12_Define";
  61. $hash->{UndefFn} = "LW12_Undefine";
  62. $hash->{SetFn} = "LW12_Set";
  63. $hash->{GetFn} = "LW12_Get";
  64. $hash->{AttrFn} = "LW12_Attr";
  65. # the attributes we have. Space separated list of attribute values in
  66. # the form name:default1,default2
  67. $hash->{AttrList} = "disable:0,1 timeout updateInterval ".
  68. $readingFnAttributes;
  69. # initialize the color picker
  70. FHEM_colorpickerInit();
  71. }
  72. # ----------------------------------------------------------------------------
  73. # Definition of a module instance
  74. # called when defining an element via fhem.cfg
  75. # ----------------------------------------------------------------------------
  76. sub LW12_Define( $$ ) {
  77. my ( $hash, $def ) = @_;
  78. my $name = $hash->{NAME};
  79. my @a = split("[ \t][ \t]*", $def);
  80. # do we have the right number of arguments?
  81. if( @a != 3 ) {
  82. Log3 $name, 3, "LW12_Define: falsche Anzahl an Argumenten";
  83. return( "wrong syntax: define <name> LW12 <serverip> " );
  84. }
  85. # preset the internals
  86. $hash->{IP} = $a[ 2 ];
  87. $hash->{".dim"} = {
  88. bri => 100,
  89. channels => [(255) x 3],
  90. };
  91. # Erstes Update verzoegern, falls beim fhem Start
  92. # ein Attribut gesetzt wird, damit nicht zwei Timer laufen.
  93. InternalTimer(gettimeofday()+ 10, "LW12_updateStatus", $hash, 0);
  94. return undef;
  95. }
  96. # ----------------------------------------------------------------------------
  97. # Undefinition of a module instance
  98. # called when undefining an element via fhem.cfg
  99. # ----------------------------------------------------------------------------
  100. sub LW12_Undefine($$) {
  101. my ($hash,$arg) = @_;
  102. RemoveInternalTimer($hash);
  103. return undef;
  104. }
  105. # ----------------------------------------------------------------------------
  106. # Set of a module
  107. # called upon set <name> cmd, arg1, arg2, ....
  108. # ----------------------------------------------------------------------------
  109. sub LW12_Set( $@ ) {
  110. my ( $hash, $name, $cmd, @arg ) = @_;
  111. # check if we have received a command
  112. if( !defined( $cmd ) ) {
  113. return( "$name: set needs at least one parameter" );
  114. }
  115. RemoveInternalTimer($hash);
  116. if ( AttrVal($name,'updateInterval',60) != 0) {
  117. InternalTimer(gettimeofday()+ AttrVal($name,'updateInterval',60) , "LW12_updateStatus", $hash, 0);
  118. }
  119. my $cmdList = "" .
  120. "on off next:noArg prev:noArg animation mode speed:slider,0,1,255 run:noArg stop:noArg " .
  121. "color dim:slider,1,1,100 " .
  122. "rgb:colorpicker,rgb hsv";
  123. # now parse the commands
  124. if( $cmd eq "?" ) {
  125. # this one should give us a drop down list
  126. return SetExtensions( $hash, $cmdList, $name, $cmd, @arg );
  127. } elsif( $cmd eq "on" ) {
  128. LW12_Write( $hash, "\x{CC}\x{23}\x{33}" );
  129. readingsSingleUpdate( $hash, "state", "on", 1 );
  130. Log3 $name, 4, "$name switched on" ;
  131. } elsif( $cmd eq "off" ) {
  132. LW12_Write( $hash, "\x{CC}\x{24}\x{33}" );
  133. readingsSingleUpdate( $hash, "state", "off", 1 );
  134. Log3 $name, 4, "$name switched off";
  135. } elsif( $cmd eq "run" ) {
  136. LW12_Write( $hash, "\x{CC}\x{21}\x{33}" );
  137. } elsif( $cmd eq "stop" ) {
  138. LW12_Write( $hash, "\x{CC}\x{22}\x{33}" );
  139. } elsif( $cmd eq "next" ) {
  140. my $mode = $hash->{READINGS}{mode}{VAL};
  141. if( $mode == 20 ) { $mode = 1; }
  142. else { $mode = $mode + 1; }
  143. LW12_Write( $hash, "\x{BB}" . chr( $mode + $offset ) . "\x{AA}\x{44}" );
  144. readingsSingleUpdate( $hash, "mode", $mode, 1 );
  145. } elsif( $cmd eq "prev" ) {
  146. my $mode = $hash->{READINGS}{mode}{VAL};
  147. if( $mode == 1 ) { $mode = 20; }
  148. else { $mode = $mode - 1; }
  149. LW12_Write( $hash, "\x{BB}" . chr( $mode + $offset ) . "\x{AA}\x{44}" );
  150. readingsSingleUpdate( $hash, "mode", $mode, 1 );
  151. } elsif( $cmd eq "mode" ){
  152. if( @arg > 2 || @arg < 1 ) {
  153. my $msg = "LW12_Set: wrong number of arguments for set mode";
  154. Log3 $name, 3, $msg ;
  155. return( $msg );
  156. } else {
  157. if( ( $arg[ 0 ] < 1 ) || ( $arg[ 0 ] > 21 ) ) {
  158. my $msg = "LW12_Set: wrong mode number given";
  159. Log3 $name, 3, $msg ;
  160. return( $msg );
  161. }
  162. readingsSingleUpdate( $hash, "mode", $arg[ 0 ], 1 );
  163. if( @arg == 2 ) {
  164. if( ( $arg[ 1 ] < 0 ) || ( $arg[ 1 ] > 255 ) ) {
  165. my $msg = "LW12_Set: wrong speed value given";
  166. Log3 $name, 3, $msg ;
  167. return( $msg );
  168. }
  169. LW12_Write( $hash, "\x{BB}" . chr( $arg[ 0 ] + $offset ) . chr ( 255 - $arg[ 1 ] ) . "\x{44}" );
  170. readingsSingleUpdate( $hash, "mode", $arg[ 0 ], 1 );
  171. readingsSingleUpdate( $hash, "speed", $arg[ 1 ], 1 );
  172. } else {
  173. LW12_Write( $hash, "\x{BB}" . chr( $arg[ 0 ] + $offset ) . chr ( 255 - ReadingsVal($name,'speed',0) ) . "\x{44}" );
  174. readingsSingleUpdate( $hash, "mode", $arg[ 0 ], 1 );
  175. }
  176. }
  177. } elsif( $cmd eq "speed" ){
  178. if( @arg != 1 ) {
  179. my $msg = "LW12_Set: wrong number of arguments for set speed";
  180. Log3 $name, 3, $msg ;
  181. return( $msg );
  182. } else {
  183. if( ( $arg[ 0 ] < 0 ) || ( $arg[ 0 ] > 255 ) ) {
  184. my $msg = "LW12_Set: wrong speed value given";
  185. Log3 $name, 3, $msg ;
  186. return( $msg );
  187. }
  188. LW12_Write( $hash, "\x{BB}" . chr( $hash->{READINGS}{mode}{VAL} + $offset ) . chr ( 255 - $arg[ 0 ] ) . "\x{44}" );
  189. readingsSingleUpdate( $hash, "speed", $arg[ 0 ], 1 );
  190. }
  191. } elsif( $cmd eq "animation" ){
  192. if( @arg < 3 ) {
  193. my $msg = "LW12_Set: wrong number of arguments for set animation";
  194. Log3 $name, 3, $msg ;
  195. return( $msg );
  196. } else {
  197. if( ( $arg[ (@arg - 1) ] < 0 ) || ( $arg[ (@arg - 1) ] > 2 ) ) {
  198. my $msg = "LW12_Set: wrong mode value given";
  199. Log3 $name, 3, $msg ;
  200. return( $msg );
  201. }
  202. if( ( $arg[ (@arg - 2) ] < 0 ) || ( $arg[ (@arg - 2) ] > 255 ) ) {
  203. my $msg = "LW12_Set: wrong speed value given";
  204. Log3 $name, 3, $msg ;
  205. return( $msg );
  206. }
  207. my $it = 0;
  208. my @red;
  209. my @green;
  210. my @blue;
  211. my $colorstring = "";
  212. for ( $it = 0; $it < 16; $it++){
  213. $red [ $it ] = hex( 0x01 );
  214. $green[ $it ] = hex( 0x02 );
  215. $blue [ $it ] = hex( 0x03 );
  216. }
  217. for( $it = 0; $it < @arg - 2; $it++){
  218. $arg[ $it ] = uc( $arg[ $it ] );
  219. my @colors = ( $arg[ $it ] =~ m/..?/g );
  220. if( @colors != 3 ) {
  221. my $msg = "LW12_Set: malformed RBG [ $it ] given: $colors[ 0 ] $colors[ 1 ] $colors[ 2 ]";
  222. Log3 $name, 3, $msg ;
  223. return( $msg );
  224. } else {
  225. $red [ $it ] = hex( $colors[ 0 ] );
  226. $green[ $it ] = hex( $colors[ 1 ] );
  227. $blue [ $it ] = hex( $colors[ 2 ] );
  228. }
  229. }
  230. for( $it = 0; $it < 16; $it++){
  231. $colorstring = $colorstring . chr( $red[ $it ] ) . chr( $green[ $it ] ) . chr( $blue[ $it ] );
  232. }
  233. my $mode = 0;
  234. if($arg[ (@arg - 1) ] == 0){ $mode = hex("3A");
  235. }elsif($arg[ (@arg - 1) ] == 1){ $mode = hex("3B");
  236. }elsif($arg[ (@arg - 1) ] == 2){ $mode = hex("3C");}
  237. Log3 $name, 4, "Sending string: 99 " . sprintf ("%*v2.2X\n", ' ', $colorstring) . " " . ( 255 - $arg[ (@arg - 2) ] ) . " " . sprintf ("%*v2.2X\n", ' ', $mode ) . " FF" . " 66";
  238. LW12_Write( $hash, "\x{99}" . $colorstring . chr ( 255 - $arg[ (@arg - 2) ] ) . chr ( $mode ) . "\x{FF}" . "\x{66}" );
  239. }
  240. } elsif( $cmd eq "color" ) {
  241. if( @arg != 3 ) {
  242. my $msg = "LW12_Set: wrong number of arguments for set color";
  243. Log3 $name, 3, $msg ;
  244. return( $msg );
  245. } else {
  246. @{$hash->{".bri"}->{channels}} = @arg;
  247. LW12_Write( $hash, "\x{56}" .
  248. chr( $arg[ 0 ] ) .
  249. chr( $arg[ 1 ] ) .
  250. chr( $arg[ 2 ] ) .
  251. "\x{AA}" );
  252. Log3 $name, 4, "$name set to @{$hash->{'.bri'}->{channels}}";
  253. }
  254. } elsif( $cmd eq "hsv" ) {
  255. if( ( @arg != 3 ) || ( $arg[ 0 ] > 360 ) || ( $arg[ 1 ] > 100 )|| ( $arg[ 2 ] > 100 ) ) {
  256. if( @arg != 3 ){
  257. my $msg = "LW12_Set: wrong number of arguments for set hsv";
  258. Log3 $name, 3, $msg ;
  259. return( $msg );
  260. }else {
  261. my $msg = "LW12_Set: wrong values for set hsv. use h:[0-360]; s:[0-100]; v:[0-100]";
  262. Log3 $name, 3, $msg ;
  263. return( $msg );
  264. }
  265. } else {
  266. my @rgb = Color::hsv2rgb(( $arg[ 0 ]/360 ), ( $arg[ 1 ]/100 ), ( $arg[ 2 ] / 100 ));
  267. foreach (@rgb){
  268. $_ = $_ * 255;
  269. }
  270. @{$hash->{".bri"}->{channels}} = @rgb;
  271. LW12_Write( $hash, "\x{56}" .
  272. chr( @{$hash->{".bri"}->{channels}}[0] ) .
  273. chr( @{$hash->{".bri"}->{channels}}[1] ) .
  274. chr( @{$hash->{".bri"}->{channels}}[2] ) .
  275. "\x{AA}" );
  276. Log3 $name, 4, "$name set to @{$hash->{'.bri'}->{channels}}";
  277. }
  278. } elsif( $cmd eq "rgb" ) {
  279. if( @arg != 1 ) {
  280. my $msg = "LW12_Set: wrong number of arguments for set rgb";
  281. Log3 $name, 3, $msg ;
  282. return( $msg );
  283. } else {
  284. $arg[ 0 ] = uc( $arg[ 0 ] );
  285. my @channels = ( $arg[ 0 ] =~ m/..?/g );
  286. foreach (@channels){
  287. $_ = hex( $_ );
  288. }
  289. if( @channels != 3 ) {
  290. my $msg = "LW12_Set: malformed RBG given.";
  291. Log3 $name, 3, $msg ;
  292. return( $msg );
  293. } else {
  294. @{$hash->{".bri"}->{channels}} = @channels;
  295. LW12_Write( $hash, "\x{56}" .
  296. chr( @{$hash->{".bri"}->{channels}}[0] ) .
  297. chr( @{$hash->{".bri"}->{channels}}[1] ) .
  298. chr( @{$hash->{".bri"}->{channels}}[2] ) .
  299. "\x{AA}" );
  300. Log3 $name, 4, "$name set to @{$hash->{'.bri'}->{channels}}";
  301. }
  302. }
  303. } elsif( $cmd eq "dim" ) {
  304. if( @arg != 1 ) {
  305. my $msg = "LW12_Set: wrong number of arguments for set brightness";
  306. Log3 $name, 3, $msg ;
  307. return( $msg );
  308. } else {
  309. return 'Dim value 0 not allowed!' if( $arg[0] == 0);
  310. $hash->{".dim"}->{bri} = $arg[0];
  311. @{$hash->{".bri"}->{channels}} = Color::BrightnessToChannels($hash->{".dim"});
  312. LW12_Write( $hash, "\x{56}" .
  313. chr( @{$hash->{".bri"}->{channels}}[0] ) .
  314. chr( @{$hash->{".bri"}->{channels}}[1] ) .
  315. chr( @{$hash->{".bri"}->{channels}}[2] ) .
  316. "\x{AA}" );
  317. Log3 $name, 4, "$name set to @{$hash->{'.bri'}->{channels}}";
  318. }
  319. } else {
  320. return SetExtensions ($hash, $cmdList, $name, $cmd, @arg);
  321. }
  322. LW12_UpdateRGB( $hash );
  323. return( undef );
  324. }
  325. # ----------------------------------------------------------------------------
  326. # Get of a module
  327. # called upon get <name> arg1
  328. # ----------------------------------------------------------------------------
  329. sub LW12_Get( $@ ) {
  330. my ( $hash, $name, $cmd, @arg ) = @_;
  331. my $cmdList = "updateStatus:noArg";
  332. # check if we have received a command
  333. if( !defined( $cmd ) ) {
  334. return( "$name: set needs at least one parameter" );
  335. }
  336. if( $cmd eq "updateStatus" ) {
  337. LW12_updateStatus( $hash );
  338. Log3 $name, 4, "$name updateStatus requested" ;
  339. } else {
  340. return "Unknown argument $cmd, choose one of $cmdList";
  341. }
  342. }
  343. sub LW12_Attr(@) {
  344. my @a = @_;
  345. my ($command, $name, $attrName, $attrValue) = @a;
  346. my $hash = $defs{$name};
  347. given($attrName) {
  348. when("updateInterval") {
  349. RemoveInternalTimer($hash);
  350. if ($command eq 'set') {
  351. $attr{$name}{$attrName} = $attrValue;
  352. } else {
  353. CommandDeleteAttr($name,$attrName);
  354. }
  355. InternalTimer(gettimeofday()+ $attrValue, "LW12_updateStatus", $hash, 0);
  356. }
  357. default {
  358. if ($command eq 'set') {
  359. $attr{$name}{$attrName} = $attrValue;
  360. } else {
  361. CommandDeleteAttr($name,$attrName);
  362. }
  363. }
  364. }
  365. return undef;
  366. }
  367. # ----------------------------------------------------------------------------
  368. # write something to the WIFI LED
  369. # ----------------------------------------------------------------------------
  370. sub LW12_Write( $$ ) {
  371. my ( $hash, $out ) = @_;
  372. my $name = $hash->{NAME};
  373. my $s = new IO::Socket::INET( PeerAddr => $hash->{IP},
  374. PeerPort => 5577,
  375. Proto => 'tcp',
  376. Timeout => int( AttrVal($name,'timeout',2) ) );
  377. if( defined $s ) {
  378. my $res = "";
  379. $s->autoflush( 1 );
  380. $s->send($out);
  381. if ($out eq "\x{EF}\x{01}\x{77}"){
  382. $s->recv($res,11);
  383. my $res = unpack "H*", $res;
  384. return $res;
  385. }
  386. $s->close();
  387. }
  388. else {
  389. Log3 $name, 4, "LW12: Can't connect to LW12!";
  390. return "0";
  391. }
  392. }
  393. # ----------------------------------------------------------------------------
  394. # Update the RGB Readings for the color picker
  395. # ----------------------------------------------------------------------------
  396. sub LW12_UpdateRGB( $ ) {
  397. my ( $hash, @rest ) = @_;
  398. my $name = $hash->{NAME};
  399. my @channels = @{$hash->{".bri"}->{channels}};
  400. my @hsv = Color::rgb2hsv( $channels[0] / 255.0, $channels[1] / 255.0, $channels[2] / 255.0 );
  401. my $hsv_reading = "". sprintf('%d', $hsv[ 0 ] * 360 ) . " " . sprintf('%d', $hsv[ 1 ] * 100 ) . " " . sprintf('%d', $hsv[ 2 ] * 100 );
  402. $hash->{".dim"} = Color::ChannelsToBrightness(@channels);
  403. readingsBeginUpdate( $hash );
  404. readingsBulkUpdate( $hash, "rgb", Color::ChannelsToRgb(@channels) );
  405. readingsBulkUpdate( $hash, "hsv", $hsv_reading );
  406. readingsBulkUpdate( $hash, "dim", $hash->{".dim"}->{bri} );
  407. readingsEndUpdate( $hash,1 );
  408. return;
  409. }
  410. # ----------------------------------------------------------------------------
  411. # Request and update the Readings from the LW12
  412. # ----------------------------------------------------------------------------
  413. sub LW12_updateStatus( $ ) {
  414. my ( $hash, @rest ) = @_;
  415. my $name = $hash->{NAME};
  416. RemoveInternalTimer($hash);
  417. if ( AttrVal($name,'updateInterval',60) != 0) {
  418. InternalTimer(gettimeofday()+ AttrVal($name,'updateInterval',60), "LW12_updateStatus", $hash, 0);
  419. }
  420. return if IsDisabled($name);
  421. my $res = LW12_Write( $hash, "\x{EF}\x{01}\x{77}" );
  422. if ($res ne "0"){
  423. $res = uc($res);
  424. my @colors = ( $res =~ m/..?/g );
  425. readingsBeginUpdate( $hash );
  426. readingsBulkUpdate( $hash, "mode", hex( $colors[ 3 ] ) - $offset );
  427. readingsBulkUpdate( $hash, "speed", 255 - hex( $colors[ 5 ] ) );
  428. if($colors[2] eq "23"){
  429. readingsBulkUpdate( $hash, "state", "on");
  430. }else{
  431. readingsBulkUpdate( $hash, "state", "off",);
  432. }
  433. readingsEndUpdate( $hash,1 );
  434. @{$hash->{".bri"}->{channels}}[0] = hex( $colors[ 6 ] );
  435. @{$hash->{".bri"}->{channels}}[1] = hex( $colors[ 7 ] );
  436. @{$hash->{".bri"}->{channels}}[2] = hex( $colors[ 8 ] );
  437. LW12_UpdateRGB( $hash );
  438. }
  439. }
  440. # DO NOT WRITE BEYOND THIS LINE
  441. 1;
  442. =pod
  443. =begin html
  444. <a name="LW12"></a>
  445. <h3>LW12</h3>
  446. <ul>
  447. Define a WIFI LED Controler.
  448. <br><br>
  449. <a name="LW12define"></a>
  450. <b>Define</b>
  451. <ul>
  452. <code>define &lt;name&gt; LW12 &lt;ip&gt;</code>
  453. <br><br>
  454. Example:
  455. define myled LW12 192.168.38.17
  456. <ul>
  457. </ul>
  458. </ul>
  459. <br>
  460. <a name="LW12_Readings"></a>
  461. <b>Readings</b>
  462. <ul>
  463. <li>dim<br>
  464. the brightness of the device. The value can be betwen 1 and 100</li>
  465. <li>RGB/rgb<br>
  466. the current color in format rrggbb</li>
  467. <li>speed<br>
  468. the current animation speed</li>
  469. <li>speed<br>
  470. the current state (on|off)</li>
  471. </ul><br>
  472. <a name="LW12_Set"></a>
  473. <b>Set</b>
  474. <ul>
  475. <li>on </li>
  476. <li>off </li>
  477. <li>toggle </li>
  478. <li>color &lt;red&gt; &lt;green&gt; &lt;blue&gt;<br>
  479. set color to the given decimal-number per channel. range is 0-255</li>
  480. <li>dim &lt;value&gt;<br>
  481. set brighness to &lt;value&gt;; range is 0-100.</li>
  482. <li>mode &lt;mode&gt; [&lt;speed&gt;] <br>
  483. set controller animation mode to &lt;mode&gt; with &lt;speed&gt;; mode-range is 0-19 speed-range is 0-255</li>
  484. <li>animation &lt;rrggbb&gt; &lt;rrggbb&gt; &larr; up to 16 colors &lt;speed&gt; &lt;mode&gt; <br>
  485. set controller animation with the given colors and the given speed. <br>
  486. mode: <br>
  487. 0 = fade<br>
  488. 1 = jump<br>
  489. 2 = strobe<br>
  490. mode-range is 0-2, speed-range is 0-255 <br></li>
  491. <li>next<br>
  492. set next controller animation mode </li>
  493. <li>prev<br>
  494. set previous controller animation mode </li>
  495. <li>run<br>
  496. run controller animation </li>
  497. <li>stop<br>
  498. stop controller animation </li>
  499. <li>rgb &lt;rrggbb&gt;</li>
  500. <li><a href="#setExtensions"> set extensions</a> are supported.</li>
  501. <br>
  502. </ul><br>
  503. <a name="LW12get"></a>
  504. <b>Get</b>
  505. <ul>
  506. <li>updateStatus<br>
  507. Requests a status-update from the RGB-Controller. The next update is in &lt;updateInterval&gt seconds.</li>
  508. <br>
  509. </ul><br>
  510. <a name="LW12attr"></a>
  511. <b>Attributes</b>
  512. <ul>
  513. <li>disable<br>
  514. Disable tcp connection and update process. Internal Timer remains active!</li>
  515. <li>updateInterval<br>
  516. The Interval of the Statusupdates in seconds. If &lt;updateInterval&gt = 0, the automatic updates are not active. Default is 60.</li>
  517. <li>Timeout<br>
  518. The Timeout of the connection to the RGB-controller in seconds. Default is 2.</li>
  519. <br>
  520. </ul><br>
  521. </ul>
  522. =end html
  523. =cut