88_HMCCUDEV.pm 34 KB

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