HMCCU_README.txt 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955
  1. =======================================================================
  2. *** HMCCU/HMCCUDEV - Modules for FHEM - Homematic CCU integration ***
  3. =======================================================================
  4. * Document covers HMCCU/HMCCUDEV/HMCCUCHN version 2.8
  5. * Please read carefully before using the modules.
  6. * Last modified: 24.02.2016
  7. ----------------------------------------------
  8. Content
  9. ----------------------------------------------
  10. 1 HMCCU Introduction
  11. 1.1 HMCCU Description
  12. 1.2 HMCCU Requirements & Installation
  13. 2 HMCCU Usage
  14. 2.1 HMCCU Set Commands
  15. 2.2 HMCCU Get Commands
  16. 2.3 HMCCU Attributes
  17. 2.4 HMCCU Parameter File
  18. 2.5 RPC daemon
  19. 2.6 Events
  20. 3 HMCCUDEV Introduction
  21. 3.1 HMCCUDEV Description
  22. 3.2 HMCCUDEV Requirements
  23. 4 HMCCUDEV Usage
  24. 4.1 HMCCUDEV Set Commands
  25. 4.2 HMCCUDEV Get Commands
  26. 4.3 HMCCUDEV Attributes
  27. 5 HMCCUCHN Usage
  28. 5.1 HMCCUCHN Set Commands
  29. 5.2 HMCCUCHN Get Commands
  30. 5.3 HMCCUCHN Attributes
  31. 6 Hints and Tips
  32. 6.1 Requesting information from CCU
  33. 6.2 Executing FHEM commands on CCU
  34. 6.3 Use RAM disk for /tmp on Raspbian
  35. ----------------------------------------------
  36. ====================================
  37. 1 HMCCU Introduction
  38. ====================================
  39. ------------------------------------
  40. 1.1 HMCCU Description
  41. ------------------------------------
  42. The modules HMCCU, HMCCUDEV and HMCCUCHN provide a simple interface between FHEM
  43. and a Homematic CCU2. HMCCU is the IO device for the communication with the CCU.
  44. The states and values of CCU channels and variables are not updated automatically
  45. in FHEM. You have to define AT devices with get commands to ensure a continuous
  46. update of CCU readings in FHEM or use the external RPC server.
  47. NOTE: Because FHEM doesn't support the same set of special characters for devices
  48. and channels some characters are replaced automatically when storing CCU values
  49. as readings in FHEM. The character ':' is replaced by '.'. All characters which
  50. are not matching the expression [A-Za-z\d_\.-] are replaced by '_'.
  51. --------------------------------------
  52. 1.2 HMCCU Requirements & Installation
  53. --------------------------------------
  54. The module HMCCU no longer requires the XML-API CCU addon. The FHEM module requires
  55. the packages LWP::UserAgent, Time::HiRes, RPC::XML::Client and RPCQueue.
  56. The RPC server ccurpcd.pl requires the packages RPC::XML::Server, RPC::XML::Client,
  57. RPCQueue and IO::Socket::INET.
  58. All module files 88_HMCCU*, RPCQueue.pm and the RPC daemon ccurpcd.pl must be copied
  59. into the folder FHEM under the FHEM installation directory.
  60. NOTE: RPCQueue.pm is a bug fixed copy of File::Queue and part of the HMCCU installation
  61. package. It's not available via CPAN!
  62. ====================================
  63. 2 HMCCU Usage
  64. ====================================
  65. Define a new IO device for communication with Homematic CCU:
  66. define <name> HMCCU <hostname_or_IP>
  67. The only parameter is the name or the IP address of the Homematic CCU. All
  68. other adjustments are done by setting attributes.
  69. Some commands use device, channel or datapoint addresses. A channel address has
  70. the following format:
  71. [<interface>.]<device-address>:<channel-number>
  72. A device address is a channel address without the channel number. The default
  73. value for <interface> is "BidCoS-RF". A datapoint is identified by
  74. <channel-address>.<datapoint-name>
  75. or
  76. <channel-name>.<datapoint-name>
  77. A <channel-name> or a <device-name> is the alias for an device or channel defined
  78. in the CCU.
  79. If a command allows parameters <device> or <channel> either name or address can
  80. be used.
  81. IMPORTANT NOTE: During device definition HMCCU reads the available CCU devices.
  82. This request must be repeated by using command 'get devicelist' after a reload
  83. of the module or after modification or definition of devices in the CCU. Otherwise
  84. HMCCU, HMCCUDEV and HMCCUCHN won't work correctly. It's recommended to define
  85. an automatic daily device synchronization with AT and command 'get <name> devicelist'.
  86. ------------------------------------
  87. 2.1 HMCCU Set commands
  88. ------------------------------------
  89. If attribute 'stateval' is set the specified string substitutions are applied
  90. for values before setting the device state, a variable or a datapoint value.
  91. This is important because CCU states are often 'true' or 'false' while in FHEM
  92. one like to use 'on' or 'off'. So i.e. setting 'stateval' to 'on:true,off:false'
  93. will ensure that FHEM commands 'on' and 'off' are replaced by 'true' and 'false'
  94. before transmitting them to the CCU.
  95. Set configuration parameters of CCU device or channel:
  96. set <name> config {<device>|<channel>} [<rpcport>] <parameter>=<value> [...]
  97. Set configuration parameters via RPC set request. If <rpcport> is not specified
  98. port 2001 (BidCos) is used.
  99. NOTE: Some parameter sets (i.e. time schedules for thermostat devices) must
  100. always be set completely (at least for one day). Otherwise command is not
  101. executed.
  102. Set state of a CCU channel:
  103. set <name> devstate <channel> <value> [...]
  104. Parameter <channel> refers to the CCU device channel with datapoint STATE.
  105. This default datapoint can be changed by setting attribute 'statedatapoint'.
  106. If more than one <value> is specified the values are concatinated by blanks
  107. to one text string.
  108. Set value of a CCU device datapoint:
  109. set <name> datapoint <channel>.<datapoint> <value> [...]
  110. Parameters correspond to 'devstate' command. In addition the name of a CCU
  111. channel datapoint must be specified.
  112. Set value of a CCU system variable:
  113. set <name> var <variable> <value> [...]
  114. The variable must exist in CCU. It's not created automatically.
  115. Execute CCU program:
  116. set <name> execute <program>
  117. The program is executed even if it's deactivated in CCU.
  118. Execute Homematic script:
  119. set <name> hmscript <script-file>
  120. If script returns parameter=value pairs separated by newlines via standard
  121. output these values are stored as readings.
  122. Restart RPC server:
  123. set <name> restartrpc
  124. The command will fail if RPC server is not running. The restart may take up
  125. to 4 minutes. During this time HMCCU devices cannot be used.
  126. ------------------------------------
  127. 2.2 HMCCU Get commands
  128. ------------------------------------
  129. If attribute 'ccureadings' is set to 1 (default) the results of the get commands
  130. are stored in readings. By default the reading names correspond to the CCU
  131. datapoints, including the channel-name. This behaviour can be changed by setting
  132. the attribute 'ccureadingformat'. If attribute 'ccureadings' is set to 0 the
  133. results of the get commands are displayed in the browser window. No readings will
  134. be set in this case. Some get commands allow an optional parameter <reading>. If
  135. this parameter is specified the CCU value is stored in FHEM using this reading name.
  136. The attribute 'updatemode' controls wether readings are updated in the IO device,
  137. in client devices only or both in IO device and client devices.
  138. With attribute 'substitute' one can define expressions which are substituted by
  139. strings before CCU values are stored in readings. For example if CCU reports
  140. device states as "true" or "false" these values can be replaced by "open" or
  141. "closed" by setting 'substitute' to "true:open,false:closed". The attribute
  142. 'substitute' is ignored if the same attribute is defined in a client device.
  143. If substitutions should apply only to some datapoints the datapoint name can be
  144. added as a prefix to the substitution rules. Several rules can be separated by
  145. a semicolon. Example: define 2 datapoint related rules and 1 standard rule:
  146. STATE!(1|true):on,(0|false):off;LOWBAT!(1|true):yes,(0|false):no;true:ok,false:error
  147. For datapoint STATE 1/true and 0/false are replaced by on and off. For datapoint
  148. LOWBAT 1/true and 0/false are replaced by yes and no. For all other datapoints
  149. true and false are subsituted by ok and error.
  150. Get values of channel datapoints (supports multiple channels):
  151. get <name> channel <channel>[.<datapoint_exp>] [...]
  152. Attention: There's no blank between channel and datapoint. If no regular
  153. expression datapoint_exp is specified all datapoints will be read.
  154. Get value of datapoint:
  155. get <name> datapoint <channel>.<datapoint> [<reading>]
  156. Display list of channels and datapoints of a device:
  157. get <name> deviceinfo <device>
  158. Read list of devices and channels from CCU:
  159. get <name> devicelist [dump]
  160. This command must be executed after HMCCU is reloaded or after devices are
  161. defined, modified or deleted in the CCU. Otherwise HMCCU does not know
  162. the alias names of CCU devices and most of the get/set commands will fail.
  163. With option 'dump' all devices/channels are displayed in browser window.
  164. Get state of channel:
  165. get <name> devstate <channel> [<reading>]
  166. Specified channel must contain the datapoint 'STATE'. This default datapoint
  167. can be modified by setting attribute 'statedatapoint'.
  168. Update all client device datapoints / readings:
  169. get <name> update [<devexp> [{ State | Value }]]
  170. If parameter <devexp> is specified only client devices with device name
  171. matching regular expression will be updated. A client device is only updated
  172. if its attribute 'ccureadings' is set to 1.
  173. For more information about 'State' and 'Value' see description of attribute
  174. 'ccuget' in HMCCU section.
  175. Get multiple channels and datapoints:
  176. get <name> parfile [<parfile>]
  177. If attribute 'parfile' is set parameter <parfile> can be omitted. See
  178. parameter file description below.
  179. Get CCU variable values:
  180. get <name> vars <varname_exp>
  181. Variable name can be a regular expression. Variables are stored as readings
  182. with same name as in CCU.
  183. Check if RPC server process is running:
  184. get <name> rpcstate
  185. The state of the RPC process(es) is displayed in browser window.
  186. ------------------------------------
  187. 2.3 HMCCU Attributes
  188. ------------------------------------
  189. Set filter for datapoint readings (default is '.*'):
  190. attr <name> ccureadingfilter <rule>[,...]
  191. Only datapoints matching the specified expression will be stored as
  192. readings. Filter is ignored by commands 'get datapoint' and 'get channel'.
  193. Filter is used by command 'get update' and for RPC server events.
  194. The syntax of a filter rule is:
  195. [<channel-name-exp>!]<datapoint-exp>
  196. If a regular expression for channel name is specified the rule applies
  197. only to datapoints of this channel. Example: A virtual device group contains
  198. channels and datapoints of different devices. For channel G_Heat we want
  199. to get datapoint CONTROL_MODE. For all channels starting with D_Heat we
  200. want to get datapoints LOWBAT and every datapoint witch match TEMP:
  201. attr <name> ccureadingfilter G_Heat!CONTROL_MODE,^D_Heat!(LOWBAT|TEMP)
  202. Set query method for CCU device datapoints (default is 'Value'):
  203. attr <name> ccuget { State | Value }
  204. Datapoint values can be queried by State() or Value(). The Value() method
  205. returns the datapoint value stored in the CCU. The State() method queries
  206. the device directly. The response time of State() is slightly higher and
  207. it will consume battery power of the queried device because a connection
  208. is established. But in some cases it can be necessary to use State(). In
  209. those cases one should set the 'ccuget' attribute in the affected client
  210. device. Setting this attribute in the IO device will slow down the
  211. communication between FHEM and CCU because this setting applies to all
  212. client devices. Set commands always use State().
  213. Set reading name format (default is 'name'):
  214. attr <name> ccureadingformat { name | address }
  215. Enable tracing of get commands:
  216. attr <name> ccutrace <expression>
  217. Enable tracing (loglevel 1) for devices / channels where CCU device name
  218. or device address matches specified expression. Using '.*' as expression
  219. is not a good idea because it will generate a lot of log data ;-)
  220. Control reading update in IO and client devices (default is 'hmccu'):
  221. attr <name> updatemode { hmccu | both | client }
  222. NOTE: If one use client devices this attribute should be set to 'client'.
  223. Otherwise all readings of client devices will be stored in the IO device
  224. too. As an alternative one can set attribute 'ccureadings' to 0.
  225. Control reading creation (default is 1):
  226. attr <name> ccureadings { 0 | 1 }
  227. If one uses the IO device only for communication of client devices with
  228. CCU set this attribute to 0.
  229. Set datapoint for "get/set devstate" commands (default is 'STATE'):
  230. attr <name> statedatapoint <datapoint>
  231. The value of this datapoint is stored in internal STATE of the FHEM device
  232. and in reading 'state'.
  233. Remove character from CCU device or variable specification in set commands:
  234. attr <name> stripchar <character>
  235. If a variable name ends with the specified character this character will be
  236. removed.
  237. Specify name of parameter file for command "get parfile":
  238. attr <name> parfile <parfile>
  239. Set interval for RPC event processing:
  240. attr <name> rpcinterval { 3 | 5 | 10 }
  241. Set interval in seconds for reading RPC events from RPC event queue.
  242. Set port(s) of CCU RPC interface (default is 2001):
  243. attr <name> rpcport <port>[,...]
  244. For each port specified a separate instance of the RPC server process will
  245. be started when setting attribute 'rpcserver' to 'on'.
  246. Usual ports: 2000=Wired, 2001=BidCos-RF
  247. Set RPC event queue file (default is /tmp/ccuqueue):
  248. attr <name> rpcqueue <filename>
  249. Parameter <filename> is a prefix. The RPC event queue consists of two files
  250. with extension .idx and .dat. The RPC port is part of the names too.
  251. Start/stop RPC server:
  252. attr <name> rpcserver { on | off }
  253. After starting the RPC server it takes 3 minutes until events from CCU arrive.
  254. Stopping RPC server can take up to 30 seconds.
  255. Specify text substitutions for values in set commands:
  256. attr <name> statevals <text>:<subtext>[,...]
  257. NOTE: Parameter <text> is not a regular expression. Example: set datapoint to
  258. true/false if on/off is specified in set command:
  259. attr <name> statevals on:true,off:false
  260. Set format of readings with floating point numbers (default is 0):
  261. attr <name> stripnumber { 0 | 1 | 2 }
  262. 0 = Floating point numbers are stored as read from CCU.
  263. 1 = Trailing zeros are stripped except one digit.
  264. 2 = All trailing zeros and the decimal point are stripped.
  265. Specify text substitution rules for values returned by get commands:
  266. attr <name> substitute <subst_rule>[;...]
  267. The substitution rules are applied to values read from CCU before they are
  268. stored as readings. The syntax of a substitution rule is:
  269. [<datapoint>!]<regexp>:<subtext>[,...]
  270. If a datapoint is specified the rule applies only to values of this datapoint.
  271. NOTE: Floating point numbers are ignored. Integer numbers are only substituted
  272. if they match the complete regular expression.
  273. Example: Substitute values of datapoints STATE and LOWBAT.
  274. STATE!(1|true):on,(0|false):off;LOWBAT!(1|true):yes,(0|false):no
  275. NOTE: get commands return true/false for boolean values while RPC server
  276. returns 1/0.
  277. ------------------------------------
  278. 2.4 HMCCU Parameter files
  279. ------------------------------------
  280. A parameter file contains a list of CCU channel or datapoint definitions. Each
  281. line can contain a text substitution rule. A parameter file is used by command
  282. "get parfile". The format of a parfile entry is:
  283. <channel>[.<datapoint_exp>] [<substitution_rule>[;...]]
  284. First part corresponds to command 'get channel'. Empty lines and lines starting
  285. with a '#' are ignored.
  286. ------------------------------------
  287. 2.5 RPC daemon
  288. ------------------------------------
  289. Because of several restrictions of FHEM regarding socket communication and
  290. forking external processes the RPC daemon is realized as a standalone process.
  291. The communication between ccurpcd and FHEM happens by using a file based FIFO
  292. queue. On systems running on SD cards like Raspberry PI it's recommended to
  293. set the attribute 'rpcqueue' pointing to a file located on a RAM disk (see
  294. section 6.3 for more information about setting up a RAM disk on Raspbian).
  295. ccurpcd is started under user 'fhem'. So this user must have the permission to
  296. read and write data on from/into queue file and also write log file entries in
  297. the standard FHEM log directory. The daemon writes error messages to file
  298. ccurpcd_<port>.log in the FHEM log directory.
  299. The RPC daemon is controlled via attribute 'rpcserver'. After setting this
  300. attribute to "on" the HMCCU module will start ccurpcd as a separate process.
  301. The RPC process is started even if attribute 'rpcserver' is already set to
  302. "on".
  303. The PID of ccurpcd is stored in the INTERNAL "RPCPID". After start of ccurpcd
  304. it takes 3 minnutes until first events from CCU arrive in FHEM (don't know
  305. why - ask EQ-3 ;-)
  306. The RPC daemon is stopped when setting 'rpcserver' to "off" or by sending a
  307. signal "INT" to the process. Because ccurpcd will gracefully shutdown the
  308. CCU interface it can take some time until process disappears. After process
  309. has been terminated the internal "RPCPID" is deleted.
  310. The current state of the RPC process is stored in the INTERNAL 'RPCState':
  311. starting = RPC server is starting. This phase can take 3 minutes.
  312. running = RPC server is started an waiting for CCU events.
  313. stopping = RPC server is shutting down. Signal SIGINT sent to process.
  314. stopped = RPC server stopped.
  315. restarting = RPC server is restarting.
  316. For more information see attributes 'rpcport', 'rpcserver', 'rpcqueue' and
  317. 'rpcinterval'.
  318. ------------------------------------
  319. 2.6 Events
  320. ------------------------------------
  321. In some situations HMCCU will trigger events:
  322. "RPC server restarting"
  323. "RPC server starting"
  324. "RPC server running"
  325. "RPC server stopped"
  326. "No events from CCU since 300 seconds"
  327. "n devices deleted in CCU"
  328. "n devices added in CCU"
  329. FHEM can react on these events by using command 'notify'. Example: If new
  330. devices added in CCU the IO device should execute command 'get devicelist'
  331. to enable the usage of the new devices in FHEM.
  332. ====================================
  333. 3 HMCCUDEV Introduction
  334. ====================================
  335. ------------------------------------
  336. 3.1 HMCCUDEV Description
  337. ------------------------------------
  338. HMCCUDEV is used to define HMCCU client devices for CCU devices. NOTE: HMCCU
  339. can be used standalone without defining client devices but it's highly
  340. recommended to use client devices because every Homematic device type has
  341. its own functionality which must be handled different.
  342. ------------------------------------
  343. 3.2 HMCCUDEV Requirements
  344. ------------------------------------
  345. See 1.2 HMCCU Requirements. The module 88_HMCCUDEV.pm must be copied into folder
  346. FHEM under the FHEM installation directory. An IO device of type HMCCU must be
  347. defined before defining any client devices.
  348. ====================================
  349. 4 HMCCUDEV Usage
  350. ====================================
  351. Define a new client device:
  352. define <name> HMCCUDEV <device> [<state-channel>] [readonly]
  353. Define a new client device group:
  354. define <name> HMCCUDEV <ccu-group-device> [<state-channel>] [readonly]
  355. {group={<device>|<channel>}[,...]|groupexp=<expression>}
  356. Define a new virtual device:
  357. define <name> HMCCUDEV virtual
  358. {group={<device>|<channel>}[,...]|groupexp=<expression>}
  359. The parameter <device> is the CCU device name or address. The CCU device must
  360. be known by HMCCU. If the device can't be found the device list of the HMCCU
  361. device must be updated with command 'get devicelist'.
  362. The default channel number for devstate commands can be specified with parameter
  363. <state-channel> or via attribute 'statechannel'. The keyword 'readonly' declares
  364. a device as read only (i.e. a sensor). For read only devices no set command is
  365. available.
  366. HMCCUDEV also supports CCU group devices (i.e. groups of heating controls). The
  367. member devices of a CCU group device must be specified with options 'group' or
  368. 'groupexp'. If readings of the member devices are updated the readings in the
  369. group devices will be updated too.
  370. Virtual devices are a special kind of group devices. A virtual device is a group
  371. of client devices which only exists in FHEM. The only available command for
  372. virtual devices is 'get update'.
  373. ------------------------------------
  374. 4.1 HMCCUDEV Set Commands
  375. ------------------------------------
  376. Set value of control datapoint:
  377. set <name> control <value>
  378. Attribute 'controldatapoint' must be set.
  379. Set value of datapoint:
  380. set <name> datapoint <channel-number>.<datapoint-name> <value> [...]
  381. Set state of device:
  382. set <name> devstate <value>
  383. set <name> <state-value>
  384. If attribute 'statevals' is defined 'devstate' can be ommitted. The channel
  385. number which contains datapoint 'STATE' must be set via attribute 'statechannel'.
  386. If no state channel is specified the command is not available. The default
  387. datapoint 'STATE' can be modified by setting attribute 'statedatapoint'.
  388. Toggle device state:
  389. set <name> toggle
  390. This command requires that attribute 'statevals' contains at least 2 states.
  391. ------------------------------------
  392. 4.2 HMCCUDEV Get Commands
  393. ------------------------------------
  394. Get value of datapoint:
  395. get <name> datapoint <channel-number>[.<datapoint-name>]
  396. If no datapoibt is specified all datapoints for specified channel are read.
  397. Get multiple datapoints of channel (supports multiple channels):
  398. get <name> channel <channel-number>[.<datapoint-expr>] [...]
  399. Parameter <datapoint-expr> is a regular expression. Default is .* (query all
  400. datapoints of a channel).
  401. Display list of channels and datapoints of a device:
  402. get <name> deviceinfo
  403. Get state of device:
  404. get <name> devstate
  405. Requires the specification of the channel number which contains datapoint
  406. "STATE" by using attribute 'statechannel'. The default datapoint "STATE"
  407. can be modified by setting attribute 'statedatapoint'.
  408. Update all datapoints / readings of channel:
  409. get <name> update [{ State | Value }]
  410. For more information about 'State' and 'Value' see description of attribute
  411. 'ccuget' in HMCCU section.
  412. ------------------------------------
  413. 4.3 HMCCUDEV Attributes
  414. ------------------------------------
  415. Client device attributes overwrite corresponding HMCCU attributes!
  416. Set query method for CCU device datapoints (default is 'Value'):
  417. attr <name> ccuget { State | Value }
  418. For more information see description of attribute 'ccuget' in HMCCU section.
  419. Force IO device to verify set commands by get commands (default is 0):
  420. attr <name> ccuverify { 0 | 1 }
  421. Note: This won't work if set/get datapoints are different. i.e. auto operation
  422. modes of thermostat devices is set with datapoint AUTO_MODE but for reading
  423. the operation mode datapoint CONTROL_MODE must be used. In this case command
  424. verification will fail.
  425. Set filter for datapoint readings (default is '.*'):
  426. attr <name> ccureadingfilter <datapoint-expr>
  427. Only datapoints matching the specified expression will be stored as
  428. readings. Filter is ignored by commands 'get datapoint' and 'get channel'.
  429. Filter is used by command 'get update' and for RPC server events.
  430. Set reading name format (default is 'name'):
  431. attr <name> ccureadingformat { name | address | datapoint }
  432. If set to 'datapoint' the reading name is the datapoint name without channel.
  433. Control reading creation (default is 1):
  434. attr <name> ccureadings { 0 | 1 }
  435. Enable support for FHEM UI widgets like sliders:
  436. attr <name> controldatapoint <channel-number>.<datapoint-name>
  437. The following example demonstrates how to define a slider for setting the
  438. destination temperature of a thermostat device in range from 10 up to 25
  439. degrees:
  440. attr mythermodev controldatapoint 2.SET_TEMPERATURE
  441. attr mythermodev webCmd control
  442. attr mythermodev widgetOverride control:slider,10,1,25
  443. When this attribute is set HMCCU inserts a new reading 'control'. This is
  444. necessary to set widget to current value of the datapoint.
  445. Set datapoint for 'devstate' command (default is "STATE"):
  446. attr <name> statedatapoint <datapoint>
  447. Set format of internal STATE:
  448. attr <name> ccustate <format-string>
  449. The parameter <format-string> is identical to standard attribute 'stateFormat'.
  450. In addition attribute 'stateFormat' must be set to {HMCCU_State()}.
  451. Specify IO device for client device:
  452. attr <name> IODev <HMCCU-Device>
  453. Normally this is set automatically during HMCCUDEV device definition.
  454. Specify channel number of STATE datapoint:
  455. attr <name> statechannel <channel-number>
  456. If no statechannel is set the commands 'get/set devstate' are not available.
  457. Specify text substitutions for values in set commands:
  458. attr <name> stateval <text1>:<subtext1>[,...]
  459. The values <textn> are available as set commands, i.e.
  460. attr switch1 stateval on:true,off:false
  461. set switch1 on
  462. set switch1 off
  463. set switch1 devstate on
  464. Set format of readings with floating point numbers (default is 0):
  465. attr <name> stripnumber { 0 | 1 | 2 }
  466. 0 = Floating point numbers are stored as read from CCU (i.e. with trailing zeros).
  467. 1 = Trailing zeros are stripped from floating point numbers except one digit.
  468. 2 = All trailing zeros are stripped from floating point numbers.
  469. Specify text substitutions for values returned by get commands:
  470. attr <name> substitute <substitution_rule>[;...]
  471. For detailed information see description of HMCCU attribute 'substitute'.
  472. ====================================
  473. 5 HMCCUCHN Usage
  474. ====================================
  475. Define a new client device:
  476. define <name> HMCCUCHN {<Channel-Name>|<Channel-Address>} [readonly]
  477. Parameter <Channel-Address> is the CCU channel address including the channel
  478. number. If <Channel-Name> is specified it must be known by HMCCU. If the channel
  479. can't be found the device list of the HMCCU device must be updated with command
  480. 'get devicelist'. The keyword 'readonly' declares a channel as read only (i.e.
  481. a sensor). For read only channels no set command is available.
  482. ------------------------------------
  483. 5.1 HMCCUCHN Set Commands
  484. ------------------------------------
  485. Set value of control datapoint:
  486. set <name> control <value>
  487. Attribute 'controldatapoint' must be set.
  488. Set value of datapoint:
  489. set <name> datapoint <datapoint-name> <value> [...]
  490. Set state of channel:
  491. set <name> devstate <value>
  492. set <name> <state-value>
  493. If attribute 'statevals' is defined 'devstate' can be ommitted. The default
  494. datapoint "STATE" can be modified by setting attribute 'statedatapoint'.
  495. Toggle channel state:
  496. set <name> toggle
  497. This command requires that attribute 'statevals' contains at least 2 states.
  498. ------------------------------------
  499. 4.2 HMCCUCHN Get Commands
  500. ------------------------------------
  501. Get value of datapoint:
  502. get <name> datapoint [<datapoint-name>]
  503. If no datapoint is specified all datapoints are read.
  504. Get multiple datapoints:
  505. get <name> channel [<datapoint-exp>]
  506. Parameter <datapoint-expr> is a regular expression. Default is .* (query all
  507. datapoints of a channel).
  508. Get state of device:
  509. get <name> devstate
  510. The default datapoint "STATE" can be modified by setting attribute
  511. 'statedatapoint'.
  512. Update all datapoints / readings of channel:
  513. get <name> update [{ State | Value }]
  514. For more information about 'State' and 'Value' see description of attribute
  515. 'ccuget' in HMCCU section.
  516. ------------------------------------
  517. 4.3 HMCCUCHN Attributes
  518. ------------------------------------
  519. Client device attributes overwrite corresponding HMCCU attributes!
  520. Set query method for CCU device datapoints (default is 'Value'):
  521. attr <name> ccuget { State | Value }
  522. For more information see description of attribute 'ccuget' in HMCCU section.
  523. Force IO device to verify set commands by get commands (default is 0):
  524. attr <name> ccuverify { 0 | 1 }
  525. Note: This won't work if set/get datapoints are different. i.e. auto operation
  526. modes of thermostat devices is set with datapoint AUTO_MODE but for reading
  527. the operation mode datapoint CONTROL_MODE must be used. In this case command
  528. verification will fail.
  529. Set filter for datapoint readings (default is '.*'):
  530. attr <name> ccureadingfilter <datapoint-expr>
  531. Only datapoints matching the specified expression will be stored as
  532. readings. Filter is ignored by commands 'get datapoint' and 'get channel'.
  533. Filter is used by command 'get update' and for RPC server events.
  534. Set reading name format (default is 'name'):
  535. attr <name> ccureadingformat { name | address | datapoint }
  536. If set to 'datapoint' the reading name is the datapoint name without channel.
  537. Control reading creation (default is 1):
  538. attr <name> ccureadings { 0 | 1 }
  539. Enable support for FHEM UI widgets like sliders:
  540. attr <name> controldatapoint <datapoint-name>
  541. The following example demonstrates how to define a slider for setting the
  542. destination temperature of a thermostat device in range from 10 up to 25
  543. degrees:
  544. attr mythermodev controldatapoint SET_TEMPERATURE
  545. attr mythermodev webCmd control
  546. attr mythermodev widgetOverride control:slider,10,1,25
  547. When this attribute is set HMCCU inserts a new reading 'control'. This is
  548. necessary to set widget to current value of the datapoint.
  549. Set datapoint for "devstate" command (default is "STATE"):
  550. attr <name> statedatapoint <datapoint>
  551. Set format of internal STATE:
  552. attr <name> ccustate <format-string>
  553. The parameter <format-string> is identical to standard attribute 'stateFormat'.
  554. In addition attribute 'stateFormat' must be set to {HMCCU_State()}.
  555. Specify IO device for client device:
  556. attr <name> IODev <HMCCU-Device>
  557. Normally this is set automatically during HMCCUDEV device definition.
  558. Specify text substitutions for values in set commands:
  559. attr <name> stateval <text1>:<subtext1>[,...]
  560. The values <textn> are available as set commands, i.e.
  561. attr switch1 stateval on:true,off:false
  562. set switch1 on
  563. set switch1 off
  564. set switch1 devstate on
  565. Set format of readings with floating point numbers (default is 0):
  566. attr <name> stripnumber { 0 | 1 | 2 }
  567. 0 = Floating point numbers are stored as read from CCU (i.e. with trailing zeros).
  568. 1 = Trailing zeros are stripped from floating point numbers except one digit.
  569. 2 = All trailing zeros are stripped from floating point numbers.
  570. Specify text substitutions for values returned by get commands:
  571. attr <name> substitute <substitution_rule>[;...]
  572. For detailed information see description of HMCCU attribute 'substitute'.
  573. ====================================
  574. 6 Hints and tipps
  575. ====================================
  576. ------------------------------------
  577. 6.1 Requesting information from CCU
  578. ------------------------------------
  579. By using XML-API one can query device names, channel names, channel addresses
  580. and datapoint names from CCU. The following request queries device and channel
  581. information:
  582. http://ccuname-or-ip/config/xmlapi/devicelist.cgi?show_internal=1
  583. The following request returns a list of datapoints with current values:
  584. http://ccuname-or-ip/config/xmlapi/statelist.cgi?show_internal=1
  585. ------------------------------------
  586. 6.2 Executing FHEM commands on CCU
  587. ------------------------------------
  588. It's possible to execute FHEM commands from CCU via the FHEM telnet port.
  589. The following shell script encapsulates the necessary commands. It can
  590. be placed somewhere under /etc/config/addons directory in CCU. The script
  591. requires the installation of the netcat command (nc) on CCU (search for
  592. the binary in google and install it somewhere in /etc/config/addons).
  593. --- Start of script ---
  594. #!/bin/sh
  595. # Set name or IP address and port of FHEM server
  596. FHEM_SERVER="myfhem"
  597. FHEM_PORT=7072
  598. # Set path to nc command
  599. NCCMD="/etc/config/addons/scripts"
  600. if [ $# -ne 1 ]; then
  601. echo "Usage: $0 Command"
  602. exit 1
  603. fi
  604. echo -e "$1\nquit\n" | $NCCMD/nc $FHEM_SERVER $FHEM_PORT
  605. --- End of script ---
  606. The script should be called from a CCU program by using the CUXD exec object
  607. (requires installation of CUxD). If FHEM command contains blanks it should be
  608. enclosed in double quotes.
  609. --------------------------------------
  610. 6.3 Use RAM disk for /tmp on Raspbian
  611. --------------------------------------
  612. By default ccurpcd creates the queue files in directory /tmp. On systems which
  613. are running on a SD card like Raspbian this can shorten the lifetime of the
  614. SD card. To avoid this /tmp can be moved to a RAM disk:
  615. 1) Edit file /etc/fstab as user 'root' and append the following line
  616. tmpfs /tmp tmpfs nodev,nosuid,relatime,size=100M 0 0
  617. This will define /tmp as a RAM disk with a size of 100 MByte.
  618. 2) Restart the system.
  619. *** Have fun! zap ***