88_HMCCUDEV.pm 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974
  1. #####################################################################
  2. #
  3. # 88_HMCCUDEV.pm
  4. #
  5. # $Id: 88_HMCCUDEV.pm 13300 2017-02-01 17:45:04Z zap $
  6. #
  7. # Version 3.9
  8. #
  9. # (c) 2016 zap (zap01 <at> t-online <dot> de)
  10. #
  11. #####################################################################
  12. #
  13. # define <name> HMCCUDEV {<ccudev>|virtual} [<statechannel>] [readonly] [defaults]
  14. # [{group={<device>|<channel>}[,...]|groupexp=<regexp>}] [iodev=<iodevname>]
  15. #
  16. # set <name> clear [<regexp>]
  17. # set <name> config [<channel-number>] <parameter>=<value> [...]
  18. # set <name> control <value>
  19. # set <name> datapoint [<channel-number>.]<datapoint> <value>
  20. # set <name> defaults
  21. # set <name> devstate <value>
  22. # set <name> on-till <timestamp>
  23. # set <name> on-for-timer <ontime>
  24. # set <name> pct <level> [{<ontime>|0} [<ramptime>]]
  25. # set <name> <stateval_cmds>
  26. # set <name> toggle
  27. #
  28. # get <name> config [<channel-number>] [<filter-expr>]
  29. # get <name> configdesc [<channel-number>]
  30. # get <name> configlist [<channel-number>]
  31. # get <name> datapoint [<channel-number>.]<datapoint>
  32. # get <name> defaults
  33. # get <name> devstate
  34. # get <name> update
  35. #
  36. # attr <name> ccuackstate { 0 | 1 }
  37. # attr <name> ccucalculate <value>:<reading>[:<dp-list>][...]
  38. # attr <name> ccuflags { altread, nochn0, trace }
  39. # attr <name> ccuget { State | Value }
  40. # attr <name> ccureadings { 0 | 1 }
  41. # attr <name> ccureadingformat { address[lc] | name[lc] | datapoint[lc] }
  42. # attr <name> ccureadingfilter <filter-rule>[,...]
  43. # attr <name> ccureadingname <oldname>:<newname>[,...]
  44. # attr <name> ccuscaleval <datapoint>:<factor>[:<min>:<max>][,...]
  45. # attr <name> ccuverify { 0 | 1 | 2}
  46. # attr <name> controldatapoint <channel-number>.<datapoint>
  47. # attr <name> disable { 0 | 1 }
  48. # attr <name> hmstatevals <subst-rule>[;...]
  49. # attr <name> statechannel <channel>
  50. # attr <name> statedatapoint [<channel-number>.]<datapoint>
  51. # attr <name> statevals <text1>:<subtext1>[,...]
  52. # attr <name> substexcl <reading-expr>
  53. # attr <name> substitute <subst-rule>[;...]
  54. #
  55. #####################################################################
  56. # Requires module 88_HMCCU
  57. #####################################################################
  58. package main;
  59. use strict;
  60. use warnings;
  61. use SetExtensions;
  62. # use Data::Dumper;
  63. # use Time::HiRes qw( gettimeofday usleep );
  64. sub HMCCUDEV_Define ($@);
  65. sub HMCCUDEV_Set ($@);
  66. sub HMCCUDEV_Get ($@);
  67. sub HMCCUDEV_Attr ($@);
  68. #####################################
  69. # Initialize module
  70. #####################################
  71. sub HMCCUDEV_Initialize ($)
  72. {
  73. my ($hash) = @_;
  74. $hash->{DefFn} = "HMCCUDEV_Define";
  75. $hash->{SetFn} = "HMCCUDEV_Set";
  76. $hash->{GetFn} = "HMCCUDEV_Get";
  77. $hash->{AttrFn} = "HMCCUDEV_Attr";
  78. $hash->{parseParams} = 1;
  79. $hash->{AttrList} = "IODev ccuackstate:0,1 ccucalculate ccuflags:multiple-strict,altread,nochn0,trace ccureadingfilter:textField-long ccureadingformat:name,namelc,address,addresslc,datapoint,datapointlc ccureadingname ccureadings:0,1 ccuget:State,Value ccuscaleval ccuverify:0,1,2 disable:0,1 hmstatevals:textField-long statevals substexcl substitute:textField-long statechannel statedatapoint controldatapoint stripnumber ". $readingFnAttributes;
  80. }
  81. #####################################
  82. # Define device
  83. #####################################
  84. sub HMCCUDEV_Define ($@)
  85. {
  86. my ($hash, $a, $h) = @_;
  87. my $name = $hash->{NAME};
  88. my $usage = "Usage: define $name HMCCUDEV {device|'virtual'} [state-channel] " .
  89. "['readonly'] ['defaults'] [iodev={iodev-name}] [{groupexp=regexp|group={device|channel}[,...]]";
  90. return $usage if (@$a < 3);
  91. my $devname = shift @$a;
  92. my $devtype = shift @$a;
  93. my $devspec = shift @$a;
  94. my $gdcount = 0;
  95. my $hmccu_hash = undef;
  96. # IO device can be set by command line parameter iodev
  97. if (exists ($h->{iodev})) {
  98. $hmccu_hash = $defs{$h->{iodev}} if (exists ($defs{$h->{iodev}}));
  99. }
  100. if ($devspec eq 'virtual') {
  101. # Virtual device FHEM only
  102. $hmccu_hash = HMCCU_GetHash (0);
  103. return "Cannot detect IO device" if (!defined ($hmccu_hash));
  104. my $no = 0;
  105. foreach my $d (sort keys %defs) {
  106. my $ch = $defs{$d};
  107. next if (!exists ($ch->{TYPE}));
  108. next if ($ch->{TYPE} ne 'HMCCUDEV');
  109. next if ($d eq $name);
  110. next if ($ch->{ccuif} ne 'VirtualDevices' || $ch->{ccuname} ne 'none');
  111. $no++;
  112. }
  113. $hash->{ccuif} = "VirtualDevices";
  114. $hash->{ccuaddr} = sprintf ("VIR%07d", $no+1);
  115. $hash->{ccuname} = "none";
  116. $hash->{statevals} = 'readonly';
  117. }
  118. else {
  119. $hmccu_hash = HMCCU_FindIODevice ($devspec) if (!defined ($hmccu_hash));
  120. return "Cannot detect IO device" if (!defined ($hmccu_hash));
  121. return "Invalid or unknown CCU device name or address"
  122. if (! HMCCU_IsValidDevice ($hmccu_hash, $devspec));
  123. my ($di, $da, $dn, $dt, $dc) = HMCCU_GetCCUDeviceParam ($hmccu_hash, $devspec);
  124. return "Invalid or unknown CCU device name or address: $devspec" if (!defined ($da));
  125. $hash->{ccuif} = $di;
  126. $hash->{ccuaddr} = $da;
  127. $hash->{ccuname} = $dn;
  128. $hash->{ccutype} = $dt;
  129. $hash->{channels} = $dc;
  130. $hash->{statevals} = 'devstate';
  131. }
  132. # Parse optional command line parameters
  133. foreach my $arg (@$a) {
  134. if ($arg eq 'readonly') {
  135. $hash->{statevals} = $arg;
  136. }
  137. elsif ($arg eq 'defaults') {
  138. HMCCU_SetDefaults ($hash);
  139. }
  140. elsif ($arg =~ /^[0-9]+$/) {
  141. $attr{$name}{statechannel} = $arg;
  142. }
  143. else {
  144. return $usage;
  145. }
  146. }
  147. # Parse group options
  148. if ($hash->{ccuif} eq "VirtualDevices") {
  149. if (exists ($h->{groupexp}) && $hash->{ccuif} eq "VirtualDevices") {
  150. my @devlist;
  151. $gdcount = HMCCU_GetMatchingDevices ($hmccu_hash, $h->{groupexp}, 'dev', \@devlist);
  152. return "No matching CCU devices found" if ($gdcount == 0);
  153. $hash->{ccugroup} = join (',', @devlist);
  154. }
  155. elsif (exists ($h->{group}) && $hash->{ccuif} eq "VirtualDevices") {
  156. my @gdevlist = split (",", $h->{group});
  157. $hash->{ccugroup} = '' if (@gdevlist > 0);
  158. foreach my $gd (@gdevlist) {
  159. my ($gda, $gdc, $gdo) = ('', '', '', '');
  160. return "Invalid device or channel $gd" if (!HMCCU_IsValidDevice ($hmccu_hash, $gd));
  161. if (HMCCU_IsDevAddr ($gd, 0) || HMCCU_IsChnAddr ($gd, 1)) {
  162. $gdo = $gd;
  163. }
  164. else {
  165. ($gda, $gdc) = HMCCU_GetAddress ($hmccu_hash, $gd, '', '');
  166. $gdo = $gda;
  167. $gdo .= ':'.$gdc if ($gdc ne '');
  168. }
  169. if (exists ($hash->{ccugroup}) && $hash->{ccugroup} ne '') {
  170. $hash->{ccugroup} .= ",".$gdo;
  171. }
  172. else {
  173. $hash->{ccugroup} = $gdo;
  174. }
  175. $gdcount++;
  176. }
  177. }
  178. return "No devices in group" if ($hash->{ccuif} eq "VirtualDevices" && $gdcount == 0);
  179. }
  180. AssignIoPort ($hash, $hmccu_hash->{NAME});
  181. readingsSingleUpdate ($hash, "state", "Initialized", 1);
  182. $hash->{ccudevstate} = 'Active';
  183. return undef;
  184. }
  185. #####################################
  186. # Set attribute
  187. #####################################
  188. sub HMCCUDEV_Attr ($@)
  189. {
  190. my ($cmd, $name, $attrname, $attrval) = @_;
  191. my $hash = $defs{$name};
  192. if ($cmd eq "set") {
  193. return "Missing attribute value" if (!defined ($attrval));
  194. if ($attrname eq 'IODev') {
  195. $hash->{IODev} = $defs{$attrval};
  196. }
  197. elsif ($attrname eq "statevals") {
  198. return "Device is read only" if ($hash->{statevals} eq 'readonly');
  199. $hash->{statevals} = 'devstate';
  200. my @states = split /,/,$attrval;
  201. foreach my $st (@states) {
  202. my @statesubs = split /:/,$st;
  203. return "value := text:substext[,...]" if (@statesubs != 2);
  204. $hash->{statevals} .= '|'.$statesubs[0];
  205. }
  206. }
  207. }
  208. elsif ($cmd eq "del") {
  209. if ($attrname eq "statevals") {
  210. $hash->{statevals} = "devstate";
  211. }
  212. }
  213. return;
  214. }
  215. #####################################
  216. # Set commands
  217. #####################################
  218. sub HMCCUDEV_Set ($@)
  219. {
  220. my ($hash, $a, $h) = @_;
  221. my $name = shift @$a;
  222. my $opt = shift @$a;
  223. # Valid commands for read only devices
  224. my $rocmds = "clear config defaults:noArg";
  225. # Get I/O device
  226. my $hmccu_hash = HMCCU_GetHash ($hash);
  227. return HMCCU_SetError ($hash, -3) if (!defined ($hmccu_hash));
  228. my $hmccu_name = $hmccu_hash->{NAME};
  229. # Handle read only and disabled devices
  230. return undef if ($hash->{statevals} eq 'readonly' && $opt ne '?'
  231. && $opt !~ /^(clear|config|defaults)$/);
  232. my $disable = AttrVal ($name, "disable", 0);
  233. return undef if ($disable == 1);
  234. # Check if CCU is busy
  235. if (HMCCU_IsRPCStateBlocking ($hmccu_hash)) {
  236. return undef if ($opt eq '?');
  237. return "HMCCUDEV: CCU busy";
  238. }
  239. # Get parameters of current device
  240. my $ccutype = $hash->{ccutype};
  241. my $ccuaddr = $hash->{ccuaddr};
  242. my $ccuif = $hash->{ccuif};
  243. my $statevals = AttrVal ($name, "statevals", '');
  244. my ($sc, $sd, $cc, $cd) = HMCCU_GetSpecialDatapoints ($hash, '', 'STATE', '', '');
  245. my $result = '';
  246. my $rc;
  247. if ($opt eq 'datapoint') {
  248. my $objname = shift @$a;
  249. my $objvalue = shift @$a;
  250. if ($ccutype eq 'HM-Dis-EP-WM55' && !defined ($objvalue)) {
  251. $objvalue = '';
  252. foreach my $t (keys %{$h}) {
  253. if ($objvalue eq '') {
  254. $objvalue = $t.'='.$h->{$t};
  255. }
  256. else {
  257. $objvalue .= ','.$t.'='.$h->{$t};
  258. }
  259. }
  260. }
  261. return HMCCU_SetError ($hash, "Usage: set $name datapoint [{channel-number}.]{datapoint} {value}")
  262. if (!defined ($objname) || !defined ($objvalue) || $objvalue eq '');
  263. if ($objname =~ /^([0-9]+)\..+$/) {
  264. my $chn = $1;
  265. return HMCCU_SetError ($hash, -7) if ($chn >= $hash->{channels});
  266. }
  267. else {
  268. return HMCCU_SetError ($hash, -11) if ($sc eq '');
  269. $objname = $sc.'.'.$objname;
  270. }
  271. return HMCCU_SetError ($hash, -8)
  272. if (!HMCCU_IsValidDatapoint ($hash, $ccutype, 0, $objname, 2));
  273. $objvalue =~ s/\\_/%20/g;
  274. $objvalue = HMCCU_Substitute ($objvalue, $statevals, 1, undef, '');
  275. $objname = $ccuif.'.'.$ccuaddr.':'.$objname;
  276. $rc = HMCCU_SetDatapoint ($hash, $objname, $objvalue);
  277. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  278. HMCCU_SetState ($hash, "OK");
  279. return undef;
  280. }
  281. elsif ($opt eq 'control') {
  282. return HMCCU_SetError ($hash, -12) if ($cc eq '');
  283. return HMCCU_SetError ($hash, -14) if ($cd eq '');
  284. return HMCCU_SetError ($hash, -7) if ($cc >= $hash->{channels});
  285. my $objvalue = shift @$a;
  286. return HMCCU_SetError ($hash, "Usage: set $name control {value}") if (!defined ($objvalue));
  287. return HMCCU_SetError ($hash, -8) if (!HMCCU_IsValidDatapoint ($hash, $ccutype, $cc, $cd, 2));
  288. $objvalue =~ s/\\_/%20/g;
  289. $objvalue = HMCCU_Substitute ($objvalue, $statevals, 1, undef, '');
  290. my $objname = $ccuif.'.'.$ccuaddr.':'.$cc.'.'.$cd;
  291. $rc = HMCCU_SetDatapoint ($hash, $objname, $objvalue);
  292. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  293. HMCCU_SetState ($hash, "OK");
  294. return undef;
  295. }
  296. elsif ($opt =~ /^($hash->{statevals})$/) {
  297. my $cmd = $1;
  298. my $objvalue = ($cmd ne 'devstate') ? $cmd : shift @$a;
  299. return HMCCU_SetError ($hash, -11) if ($sc eq '');
  300. return HMCCU_SetError ($hash, -13) if ($sd eq '');
  301. return HMCCU_SetError ($hash, -8) if (!HMCCU_IsValidDatapoint ($hash, $ccutype, $sc, $sd, 2));
  302. return HMCCU_SetError ($hash, "Usage: set $name devstate {value}") if (!defined ($objvalue));
  303. $objvalue =~ s/\\_/%20/g;
  304. $objvalue = HMCCU_Substitute ($objvalue, $statevals, 1, undef, '');
  305. my $objname = $ccuif.'.'.$ccuaddr.':'.$sc.'.'.$sd;
  306. $rc = HMCCU_SetDatapoint ($hash, $objname, $objvalue);
  307. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  308. HMCCU_SetState ($hash, "OK");
  309. return undef;
  310. }
  311. elsif ($opt eq 'toggle') {
  312. return HMCCU_SetError ($hash, -15) if ($statevals eq '' || !exists($hash->{statevals}));
  313. return HMCCU_SetError ($hash, -11) if ($sc eq '');
  314. return HMCCU_SetError ($hash, -13) if ($sd eq '');
  315. return HMCCU_SetError ($hash, -8) if (!HMCCU_IsValidDatapoint ($hash, $ccutype, $sc, $sd, 2));
  316. my $tstates = $hash->{statevals};
  317. $tstates =~ s/devstate\|//;
  318. my @states = split /\|/, $tstates;
  319. my $stc = scalar (@states);
  320. my $objname = $ccuif.'.'.$ccuaddr.':'.$sc.'.'.$sd;
  321. # Read current value of datapoint
  322. ($rc, $result) = HMCCU_GetDatapoint ($hash, $objname);
  323. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  324. my $objvalue = '';
  325. my $st = 0;
  326. while ($st < $stc) {
  327. if ($states[$st] eq $result) {
  328. $objvalue = ($st == $stc-1) ? $states[0] : $states[$st+1];
  329. last;
  330. }
  331. else {
  332. $st++;
  333. }
  334. }
  335. return HMCCU_SetError ($hash, "Current device state doesn't match statevals")
  336. if ($objvalue eq '');
  337. $objvalue = HMCCU_Substitute ($objvalue, $statevals, 1, undef, '');
  338. $rc = HMCCU_SetDatapoint ($hash, $objname, $objvalue);
  339. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  340. HMCCU_SetState ($hash, "OK");
  341. return undef;
  342. }
  343. elsif ($opt eq 'pct') {
  344. return HMCCU_SetError ($hash, -11) if ($sc eq '');
  345. return HMCCU_SetError ($hash, "Can't find LEVEL datapoint for device type $ccutype")
  346. if (!HMCCU_IsValidDatapoint ($hash, $ccutype, $sc, "LEVEL", 2));
  347. my $objname = '';
  348. my $objvalue = shift @$a;
  349. return HMCCU_SetError ($hash, "Usage: set $name pct {value} [{ontime} [{ramptime}]]")
  350. if (!defined ($objvalue));
  351. my $timespec = shift @$a;
  352. my $ramptime = shift @$a;
  353. # Set on time
  354. if (defined ($timespec)) {
  355. return HMCCU_SetError ($hash, "Can't find ON_TIME datapoint for device type $ccutype")
  356. if (!HMCCU_IsValidDatapoint ($hash, $ccutype, $sc, "ON_TIME", 2));
  357. if ($timespec =~ /^[0-9]{2}:[0-9]{2}/) {
  358. $timespec = HMCCU_GetTimeSpec ($timespec);
  359. return HMCCU_SetError ($hash, "Wrong time format. Use HH:MM[:SS]") if ($timespec < 0);
  360. }
  361. if ($timespec > 0) {
  362. $objname = $ccuif.'.'.$ccuaddr.':'.$sc.'.ON_TIME';
  363. $rc = HMCCU_SetDatapoint ($hash, $objname, $timespec);
  364. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  365. }
  366. }
  367. # Set ramp time
  368. if (defined ($ramptime)) {
  369. return HMCCU_SetError ($hash, "Can't find RAMP_TIME datapoint for device type $ccutype")
  370. if (!HMCCU_IsValidDatapoint ($hash, $ccutype, $sc, "RAMP_TIME", 2));
  371. $objname = $ccuif.'.'.$ccuaddr.':'.$sc.'.RAMP_TIME';
  372. $rc = HMCCU_SetDatapoint ($hash, $objname, $ramptime);
  373. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  374. }
  375. # Set level
  376. $objname = $ccuif.'.'.$ccuaddr.':'.$sc.'.LEVEL';
  377. $rc = HMCCU_SetDatapoint ($hash, $objname, $objvalue);
  378. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  379. HMCCU_SetState ($hash, "OK");
  380. return undef;
  381. }
  382. elsif ($opt eq 'on-for-timer' || $opt eq 'on-till') {
  383. return HMCCU_SetError ($hash, -15) if ($statevals eq '' || !exists($hash->{statevals}));
  384. return HMCCU_SetError ($hash, "No state value for 'on' defined")
  385. if ("on" !~ /($hash->{statevals})/);
  386. return HMCCU_SetError ($hash, -11) if ($sc eq '');
  387. return HMCCU_SetError ($hash, -13) if ($sd eq '');
  388. return HMCCU_SetError ($hash, -8) if (!HMCCU_IsValidDatapoint ($hash, $ccutype, $sc, $sd, 2));
  389. return HMCCU_SetError ($hash, "Can't find ON_TIME datapoint for device type")
  390. if (!HMCCU_IsValidDatapoint ($hash, $ccutype, $sc, "ON_TIME", 2));
  391. my $timespec = shift @$a;
  392. return HMCCU_SetError ($hash, "Usage: set $name $opt {ontime-spec}")
  393. if (!defined ($timespec));
  394. if ($opt eq 'on-till') {
  395. $timespec = HMCCU_GetTimeSpec ($timespec);
  396. return HMCCU_SetError ($hash, "Wrong time format. Use HH:MM[:SS]") if ($timespec < 0);
  397. }
  398. # Set time
  399. my $objname = $ccuif.'.'.$ccuaddr.':'.$sc.'.ON_TIME';
  400. $rc = HMCCU_SetDatapoint ($hash, $objname, $timespec);
  401. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  402. # Set state
  403. $objname = $ccuif.'.'.$ccuaddr.':'.$sc.'.'.$sd;
  404. my $objvalue = HMCCU_Substitute ("on", $statevals, 1, undef, '');
  405. $rc = HMCCU_SetDatapoint ($hash, $objname, $objvalue);
  406. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  407. HMCCU_SetState ($hash, "OK");
  408. return undef;
  409. }
  410. elsif ($opt eq 'clear') {
  411. my $rnexp = shift @$a;
  412. $rnexp = '.*' if (!defined ($rnexp));
  413. my @readlist = keys %{$hash->{READINGS}};
  414. foreach my $rd (@readlist) {
  415. delete ($hash->{READINGS}{$rd}) if ($rd ne 'state' && $rd ne 'control' && $rd =~ /$rnexp/);
  416. }
  417. }
  418. elsif ($opt eq 'config') {
  419. return HMCCU_SetError ($hash, "Usage: set $name config [{channel-number}] {parameter}={value} [...]") if ((scalar keys %{$h}) < 1);
  420. my $objname = $ccuaddr;
  421. # Channel number is optional because parameter can be related to device or channel
  422. if ((scalar @$a) > 0 && $$a[0] =~ /^([0-9]{1,2})$/) {
  423. return HMCCU_SetError ($hash, -7) if ($1 >= $hash->{channels});
  424. $objname .= ':'.$1;
  425. }
  426. my $rc = HMCCU_RPCSetConfig ($hash, $objname, $h);
  427. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  428. HMCCU_SetState ($hash, "OK");
  429. return undef;
  430. }
  431. elsif ($opt eq 'defaults') {
  432. my $rc = HMCCU_SetDefaults ($hash);
  433. return HMCCU_SetError ($hash, "HMCCU: No default attributes found") if ($rc == 0);
  434. HMCCU_SetState ($hash, "OK");
  435. return undef;
  436. }
  437. else {
  438. return "HMCCUCHN: Unknown argument $opt, choose one of ".$rocmds
  439. if ($hash->{statevals} eq 'readonly');
  440. my $retmsg = "HMCCUDEV: Unknown argument $opt, choose one of clear config control datapoint defaults:noArg";
  441. if ($sc ne '') {
  442. $retmsg .= " devstate";
  443. if ($hash->{statevals} ne '') {
  444. my @cmdlist = split /\|/,$hash->{statevals};
  445. shift @cmdlist;
  446. $retmsg .= ':'.join(',',@cmdlist) if (@cmdlist > 0);
  447. foreach my $sv (@cmdlist) {
  448. $retmsg .= ' '.$sv.':noArg';
  449. }
  450. $retmsg .= " toggle:noArg";
  451. $retmsg .= " on-for-timer on-till"
  452. if (HMCCU_IsValidDatapoint ($hash, $hash->{ccutype}, $sc, "ON_TIME", 2));
  453. $retmsg .= " pct"
  454. if (HMCCU_IsValidDatapoint ($hash, $hash->{ccutype}, $sc, "LEVEL", 2));
  455. }
  456. }
  457. return $retmsg;
  458. }
  459. }
  460. #####################################
  461. # Get commands
  462. #####################################
  463. sub HMCCUDEV_Get ($@)
  464. {
  465. my ($hash, $a, $h) = @_;
  466. my $name = shift @$a;
  467. my $opt = shift @$a;
  468. # Get I/O device
  469. my $hmccu_hash = HMCCU_GetHash ($hash);
  470. return HMCCU_SetError ($hash, -3) if (!defined ($hmccu_hash));
  471. my $hmccu_name = $hmccu_hash->{NAME};
  472. # Handle disabled devices
  473. my $disable = AttrVal ($name, "disable", 0);
  474. return undef if ($disable == 1);
  475. # Check if CCU is busy
  476. if (HMCCU_IsRPCStateBlocking ($hmccu_hash)) {
  477. return undef if ($opt eq '?');
  478. return "HMCCUDEV: CCU busy";
  479. }
  480. # Get parameters of current device
  481. my $ccutype = $hash->{ccutype};
  482. my $ccuaddr = $hash->{ccuaddr};
  483. my $ccuif = $hash->{ccuif};
  484. my $ccureadings = AttrVal ($name, 'ccureadings', 1);
  485. my ($sc, $sd, $cc, $cd) = HMCCU_GetSpecialDatapoints ($hash, '', 'STATE', '', '');
  486. my $result = '';
  487. my $rc;
  488. if ($ccuif eq "VirtualDevices" && $hash->{ccuname} eq "none" && $opt ne 'update') {
  489. return "HMCCUDEV: Unknown argument $opt, choose one of update:noArg";
  490. }
  491. if ($opt eq 'devstate') {
  492. return HMCCU_SetError ($hash, -11) if ($sc eq '');
  493. return HMCCU_SetError ($hash, -13) if ($sd eq '');
  494. return HMCCU_SetError ($hash, -8) if (!HMCCU_IsValidDatapoint ($hash, $ccutype, $sc, $sd, 1));
  495. my $objname = $ccuif.'.'.$ccuaddr.':'.$sc.'.'.$sd;
  496. ($rc, $result) = HMCCU_GetDatapoint ($hash, $objname);
  497. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  498. return $ccureadings ? undef : $result;
  499. }
  500. elsif ($opt eq 'datapoint') {
  501. my $objname = shift @$a;
  502. return HMCCU_SetError ($hash, "Usage: get $name datapoint [{channel-number}.]{datapoint}")
  503. if (!defined ($objname));
  504. if ($objname =~ /^([0-9]+)\..+$/) {
  505. my $chn = $1;
  506. return HMCCU_SetError ($hash, -7) if ($chn >= $hash->{channels});
  507. }
  508. else {
  509. return HMCCU_SetError ($hash, -11) if ($sc eq '');
  510. $objname = $sc.'.'.$objname;
  511. }
  512. return HMCCU_SetError ($hash, -8)
  513. if (!HMCCU_IsValidDatapoint ($hash, $ccutype, $0, $objname, 1));
  514. $objname = $ccuif.'.'.$ccuaddr.':'.$objname;
  515. ($rc, $result) = HMCCU_GetDatapoint ($hash, $objname);
  516. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  517. HMCCU_SetState ($hash, "OK") if (exists ($hash->{STATE}) && $hash->{STATE} eq "Error");
  518. return $ccureadings ? undef : $result;
  519. }
  520. elsif ($opt eq 'update') {
  521. my $ccuget = shift @$a;
  522. $ccuget = 'Attr' if (!defined ($ccuget));
  523. if ($ccuget !~ /^(Attr|State|Value)$/) {
  524. return HMCCU_SetError ($hash, "Usage: get $name update [{'State'|'Value'}]");
  525. }
  526. if ($hash->{ccuname} ne 'none') {
  527. $rc = HMCCU_GetUpdate ($hash, $ccuaddr, $ccuget);
  528. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  529. }
  530. # Update other devices belonging to group
  531. if ($hash->{ccuif} eq "VirtualDevices" && exists ($hash->{ccugroup})) {
  532. my @vdevs = split (",", $hash->{ccugroup});
  533. foreach my $vd (@vdevs) {
  534. $rc = HMCCU_GetUpdate ($hash, $vd, $ccuget);
  535. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  536. }
  537. }
  538. return undef;
  539. }
  540. elsif ($opt eq 'deviceinfo') {
  541. my $ccuget = shift @$a;
  542. $ccuget = 'Attr' if (!defined ($ccuget));
  543. if ($ccuget !~ /^(Attr|State|Value)$/) {
  544. return HMCCU_SetError ($hash, "Usage: get $name deviceinfo [{'State'|'Value'}]");
  545. }
  546. $result = HMCCU_GetDeviceInfo ($hash, $ccuaddr, $ccuget);
  547. return HMCCU_SetError ($hash, -2) if ($result eq '');
  548. return HMCCU_FormatDeviceInfo ($result);
  549. }
  550. elsif ($opt eq 'config') {
  551. my $channel = undef;
  552. my $ccuobj = $ccuaddr;
  553. my $par = shift @$a;
  554. if (defined ($par)) {
  555. if ($par =~ /^([0-9]{1,2})$/) {
  556. return HMCCU_SetError ($hash, -7) if ($1 >= $hash->{channels});
  557. $ccuobj .= ':'.$1;
  558. $par = shift @$a;
  559. }
  560. }
  561. $par = '.*' if (!defined ($par));
  562. my ($rc, $res) = HMCCU_RPCGetConfig ($hash, $ccuobj, "getParamset", $par);
  563. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  564. HMCCU_SetState ($hash, "OK") if (exists ($hash->{STATE}) && $hash->{STATE} eq "Error");
  565. return $ccureadings ? undef : $res;
  566. }
  567. elsif ($opt eq 'configlist') {
  568. my $channel = undef;
  569. my $ccuobj = $ccuaddr;
  570. my $par = shift @$a;
  571. if (defined ($par)) {
  572. if ($par =~ /^([0-9]{1,2})$/) {
  573. return HMCCU_SetError ($hash, -7) if ($1 >= $hash->{channels});
  574. $ccuobj .= ':'.$1;
  575. $par = shift @$a;
  576. }
  577. }
  578. $par = '.*' if (!defined ($par));
  579. my ($rc, $res) = HMCCU_RPCGetConfig ($hash, $ccuobj, "listParamset", $par);
  580. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  581. HMCCU_SetState ($hash, "OK") if (exists ($hash->{STATE}) && $hash->{STATE} eq "Error");
  582. return $res;
  583. }
  584. elsif ($opt eq 'configdesc') {
  585. my $channel = undef;
  586. my $ccuobj = $ccuaddr;
  587. my $par = shift @$a;
  588. if (defined ($par)) {
  589. if ($par =~ /^([0-9]{1,2})$/) {
  590. return HMCCU_SetError ($hash, -7) if ($1 >= $hash->{channels});
  591. $ccuobj .= ':'.$1;
  592. }
  593. else {
  594. return HMCCU_SetError ($hash, -7) if ($1 >= $hash->{channels});
  595. }
  596. }
  597. my ($rc, $res) = HMCCU_RPCGetConfig ($hash, $ccuobj, "getParamsetDescription", undef);
  598. return HMCCU_SetError ($hash, $rc) if ($rc < 0);
  599. HMCCU_SetState ($hash, "OK") if (exists ($hash->{STATE}) && $hash->{STATE} eq "Error");
  600. return $res;
  601. }
  602. elsif ($opt eq 'defaults') {
  603. $result = HMCCU_GetDefaults ($hash, 0);
  604. return $result;
  605. }
  606. else {
  607. my $retmsg = "HMCCUDEV: Unknown argument $opt, choose one of datapoint";
  608. my @valuelist;
  609. my $valuecount = HMCCU_GetValidDatapoints ($hash, $ccutype, -1, 1, \@valuelist);
  610. $retmsg .= ":".join(",", @valuelist) if ($valuecount > 0);
  611. $retmsg .= " defaults:noArg update:noArg config configlist configdesc deviceinfo:noArg";
  612. $retmsg .= ' devstate:noArg' if ($sc ne '');
  613. return $retmsg;
  614. }
  615. }
  616. 1;
  617. =pod
  618. =item device
  619. =item summary controls HMCCU client devices for Homematic CCU2 - FHEM integration
  620. =begin html
  621. <a name="HMCCUDEV"></a>
  622. <h3>HMCCUDEV</h3>
  623. <ul>
  624. The module implements Homematic CCU devices as client devices for HMCCU. A HMCCU I/O device must
  625. exist before a client device can be defined. If a CCU channel is not found execute command
  626. 'get devicelist' in I/O device.<br/>
  627. This reference contains only commands and attributes which differ from module
  628. <a href="#HMCCUCHN">HMCCUCHN</a>.
  629. </br></br>
  630. <a name="HMCCUDEVdefine"></a>
  631. <b>Define</b><br/><br/>
  632. <ul>
  633. <code>define &lt;name&gt; HMCCUDEV {&lt;device&gt; | 'virtual'} [&lt;statechannel&gt;]
  634. [readonly] [defaults] [{group={device|channel}[,...]|groupexp=regexp]
  635. [iodev=&lt;iodev-name&gt;]</code>
  636. <br/><br/>
  637. If option 'readonly' is specified no set command will be available. With option 'defaults'
  638. some default attributes depending on CCU device type will be set. Default attributes are only
  639. available for some device types. Parameter <i>statechannel</i> corresponds to attribute
  640. 'statechannel'.<br/>
  641. A HMCCUDEV device supports CCU group devices. The CCU devices or channels related to a group
  642. device are specified by using options 'group' or 'groupexp' followed by the names or
  643. addresses of the CCU devices or channels. By using 'groupexp' one can specify a regular
  644. expression for CCU device or channel names.<br/>
  645. It's also possible to group any kind of CCU devices or channels without defining a real
  646. group in CCU by using option 'virtual' instead of a CCU device specification.
  647. <br/><br/>
  648. Examples:<br/>
  649. <code>
  650. # Simple device by using CCU device name<br/>
  651. define window_living HMCCUDEV WIN-LIV-1<br/>
  652. # Simple device by using CCU device address and with state channel<br/>
  653. define temp_control HMCCUDEV BidCos-RF.LEQ1234567 1<br/>
  654. # Simple read only device by using CCU device address and with default attributes<br/>
  655. define temp_sensor HMCCUDEV BidCos-RF.LEQ2345678 1 readonly defaults
  656. # Group device by using CCU group device and 3 group members<br/>
  657. define heating_living HMCCUDEV GRP-LIV group=WIN-LIV,HEAT-LIV,THERM-LIV
  658. </code>
  659. <br/>
  660. </ul>
  661. <br/>
  662. <a name="HMCCUDEVset"></a>
  663. <b>Set</b><br/><br/>
  664. <ul>
  665. <li><b>set &lt;name&gt; clear [&lt;reading-exp&gt;]</b><br/>
  666. <a href="#HMCCUCHNset">see HMCCUCHN</a>
  667. </li><br/>
  668. <li><b>set &lt;name&gt; config [&lt;channel-number&gt;] &lt;parameter&gt;=&lt;value&gt;
  669. [...]</b><br/>
  670. Set configuration parameter of CCU device or channel. Valid parameters can be listed by
  671. using command 'get configdesc'.
  672. </li><br/>
  673. <li><b>set &lt;name&gt; datapoint [&lt;channel-number&gt;.]&lt;datapoint&gt;
  674. &lt;value&gt;</b><br/>
  675. Set value of a datapoint of a CCU device channel. If channel number is not specified
  676. state channel is used. String \_ is substituted by blank.
  677. <br/><br/>
  678. Example:<br/>
  679. <code>set temp_control datapoint 1.SET_TEMPERATURE 21</code>
  680. </li><br/>
  681. <li><b>set &lt;name&gt; defaults</b><br/>
  682. Set default attributes for CCU device type. Default attributes are only available for
  683. some device types.
  684. </li><br/>
  685. <li><b>set &lt;name&gt; devstate &lt;value&gt;</b><br/>
  686. Set state of a CCU device channel. Channel and state datapoint must be defined as
  687. attribute 'statedatapoint'. If <i>value</i> contains string \_ it is substituted by blank.
  688. </li><br/>
  689. <li><b>set &lt;name&gt; on-for-timer &lt;ontime&gt;</b><br/>
  690. <a href="#HMCCUCHNset">see HMCCUCHN</a>
  691. </li><br/>
  692. <li><b>set &lt;name&gt; on-till &lt;timestamp&gt;</b><br/>
  693. <a href="#HMCCUCHNset">see HMCCUCHN</a>
  694. </li><br/>
  695. <li><b>set &lt;name&gt; pct &lt;value;&gt; [&lt;ontime&gt; [&lt;ramptime&gt;]]</b><br/>
  696. <a href="#HMCCUCHNset">see HMCCUCHN</a>
  697. </li><br/>
  698. <li><b>set &lt;name&gt; &lt;statevalue&gt;</b><br/>
  699. State datapoint of a CCU device channel is set to 'statevalue'. State channel and state
  700. datapoint must be defined as attribute 'statedatapoint'. Values for <i>statevalue</i>
  701. are defined by setting attribute 'statevals'.
  702. <br/><br/>
  703. Example:<br/>
  704. <code>
  705. attr myswitch statedatapoint 1.STATE<br/>
  706. attr myswitch statevals on:true,off:false<br/>
  707. set myswitch on
  708. </code>
  709. </li><br/>
  710. <li><b>set &lt;name&gt; toggle</b><br/>
  711. <a href="#HMCCUCHNset">see HMCCUCHN</a>
  712. </li><br/>
  713. <li><b>ePaper Display</b><br/><br/>
  714. This display has 5 text lines. The lines 1,2 and 4,5 are accessible via config parameters
  715. TEXTLINE_1 and TEXTLINE_2 in channels 1 and 2. Example:<br/><br/>
  716. <code>
  717. define HM_EPDISP HMCCUDEV CCU_EPDISP<br/>
  718. set HM_EPDISP config 2 TEXTLINE_1=Line1<br/>
  719. set HM_EPDISP config 2 TEXTLINE_2=Line2<br/>
  720. set HM_EPDISP config 1 TEXTLINE_1=Line4<br/>
  721. set HM_EPDISP config 1 TEXTLINE_2=Line5<br/>
  722. </code>
  723. <br/>
  724. The lines 2,3 and 4 of the display can be accessed by setting the datapoint SUBMIT of the
  725. display to a string containing command tokens in format 'parameter=value'. The following
  726. commands are allowed:
  727. <br/><br/>
  728. <ul>
  729. <li>text1-3=Text - Content of display line 2-4</li>
  730. <li>icon1-3=IconCode - Icons of display line 2-4</li>
  731. <li>sound=SoundCode - Sound</li>
  732. <li>signal=SignalCode - Optical signal</li>
  733. <li>pause=Seconds - Pause between signals (1-160)</li>
  734. <li>repeat=Count - Repeat count for sound (0-15)</li>
  735. </ul>
  736. <br/>
  737. IconCode := ico_off, ico_on, ico_open, ico_closed, ico_error, ico_ok, ico_info,
  738. ico_newmsg, ico_svcmsg<br/>
  739. SignalCode := sig_off, sig_red, sig_green, sig_orange<br/>
  740. SoundCode := snd_off, snd_longlong, snd_longshort, snd_long2short, snd_short, snd_shortshort,
  741. snd_long<br/><br/>
  742. Example:<br/>
  743. <code>
  744. set HM_EPDISP datapoint 3.SUBMIT text1=Line2,text2=Line3,text3=Line4,sound=snd_short,
  745. signal=sig_red
  746. </code>
  747. </li>
  748. </ul>
  749. <br/>
  750. <a name="HMCCUDEVget"></a>
  751. <b>Get</b><br/><br/>
  752. <ul>
  753. <li><b>get &lt;name&gt; config [&lt;channel-number&gt;] [&lt;filter-expr&gt;]</b><br/>
  754. Get configuration parameters of CCU device. If attribute 'ccureadings' is set to 0
  755. parameters are displayed in browser window (no readings set). Parameters can be filtered
  756. by <i>filter-expr</i>.
  757. </li><br/>
  758. <li><b>get &lt;name&gt; configdesc [&lt;channel-number&gt;] [&lt;rpcport&gt;]</b><br/>
  759. Get description of configuration parameters for CCU device. Default value for Parameter
  760. <i>rpcport</i> is 2001 (BidCos-RF). Other valid values are 2000 (wired) and 2010 (HMIP).
  761. </li><br/>
  762. <li><b>get &lt;name&gt; configlist [&lt;channel-number&gt;] [&lt;filter-expr&gt;]</b><br/>
  763. Display configuration parameters of CCU device. Parameters can be filtered by
  764. <i>filter-expr</i>.
  765. </li><br/>
  766. <li><b>get &lt;name&gt; datapoint [&lt;channel-number&gt;.]&lt;datapoint&gt;</b><br/>
  767. Get value of a CCU device datapoint. If <i>channel-number</i> is not specified state
  768. channel is used.
  769. </li><br/>
  770. <li><b>get &lt;name&gt; defaults</b><br/>
  771. <a href="#HMCCUCHNget">see HMCCUCHN</a>
  772. </li><br/>
  773. <li><b>get &lt;name&gt; deviceinfo [{State | <u>Value</u>}]</b><br/>
  774. Display all channels and datapoints of device with datapoint values and types.
  775. </li><br/>
  776. <li><b>get &lt;name&gt; devstate</b><br/>
  777. Get state of CCU device. Attribute 'statechannel' must be set. Default state datapoint
  778. STATE can be modified by attribute 'statedatapoint'.
  779. </li><br/>
  780. <li><b>get &lt;name&gt; update [{State | <u>Value</u>}]</b><br/>
  781. <a href="#HMCCUCHNget">see HMCCUCHN</a>
  782. </li><br/>
  783. </ul>
  784. <br/>
  785. <a name="HMCCUDEVattr"></a>
  786. <b>Attributes</b><br/><br/>
  787. <ul>
  788. To reduce the amount of events it's recommended to set attribute 'event-on-change-reading'
  789. to '.*'.<br/><br/>
  790. <li><b>ccuackstate {<u>0</u> | 1}</b><br/>
  791. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  792. </li><br/>
  793. <li><b>ccucalculate &lt;value&gt;:&lt;reading&gt;[:&lt;dp-list&gt;[;...]</b><br/>
  794. Calculate special values like dewpoint based on datapoints specified in
  795. <i>dp-list</i>. Datapoints in <i>dp-list</i> must be specified in format
  796. &lt;channelno&gt;.&lt;datapoint&gt;. The result is stored in <i>reading</i>.
  797. The following <i>values</i> are supported:<br/>
  798. dewpoint = calculate dewpoint, <i>dp-list</i> = &lt;temperature&gt;,&lt;humidity&gt;
  799. </li><br/>
  800. <li><b>ccuflags {nochn0, trace}</b><br/>
  801. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  802. </li><br/>
  803. <li><b>ccuget {State | <u>Value</u>}</b><br/>
  804. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  805. </li><br/>
  806. <li><b>ccureadings {0 | <u>1</u>}</b><br/>
  807. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  808. </li><br/>
  809. <li><b>ccureadingfilter &lt;filter-rule[,...]&gt;</b><br/>
  810. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  811. </li><br/>
  812. <li><b>ccureadingformat {address[lc] | name[lc] | datapoint[lc]}</b><br/>
  813. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  814. </li><br/>
  815. <li><b>ccureadingname &lt;old-readingname-expr&gt;:&lt;new-readingname&gt;[,...]</b><br/>
  816. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  817. </li><br/>
  818. <li><b>ccuscaleval &lt;datapoint&gt;:&lt;factor&gt;[,...]</b><br/>
  819. ccuscaleval &lt;[!]datapoint&gt;:&lt;min&gt;:&lt;max&gt;:&lt;minn&gt;:&lt;maxn&gt;[,...]<br/>
  820. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  821. </li><br/>
  822. <li><b>ccuverify {0 | 1 | 2}</b><br/>
  823. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  824. </li><br/>
  825. <li><b>controldatapoint &lt;channel-number.datapoint&gt;</b><br/>
  826. Set channel number and datapoint for device control.
  827. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  828. </li><br/>
  829. <li><b>disable {<u>0</u> | 1}</b><br/>
  830. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  831. </li><br/>
  832. <li><b>hmstatevals &lt;subst-rule&gt;[;...]</b><br/>
  833. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  834. </li><br/>
  835. <li><b>statechannel &lt;channel-number&gt;</b><br/>
  836. Channel for setting device state by devstate command. Deprecated, use attribute
  837. 'statedatapoint' instead.
  838. </li><br/>
  839. <li><b>statedatapoint [&lt;channel-number&gt;.]&lt;datapoint&gt;</b><br/>
  840. Set state channel and state datapoint for setting device state by devstate command.
  841. Default is STATE. If 'statedatapoint' is not defined at least attribute 'statechannel'
  842. must be set.
  843. </li><br/>
  844. <li><b>statevals &lt;text&gt;:&lt;text&gt;[,...]</b><br/>
  845. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  846. </li><br/>
  847. <li><b>stripnumber {0 | 1 | 2 | -n}</b><br/>
  848. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  849. </li><br/>
  850. <li><b>substexcl &lt;reading-expr&gt;</b><br/>
  851. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  852. </li><br/>
  853. <li><b>substitute &lt;subst-rule&gt;[;...]</b><br/>
  854. <a href="#HMCCUCHNattr">see HMCCUCHN</a>
  855. </li><br/>
  856. </ul>
  857. </ul>
  858. =end html
  859. =cut