commandref_frame.html 67 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <title>FHEM reference</title>
  5. <script type="text/javascript" src="fhemdoc.js"></script>
  6. <noscript>
  7. <link rel="stylesheet" type="text/css" href="../www/pgm2/style.css" />
  8. </noscript>
  9. <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
  10. <link rel="shortcut icon" href="/fhem/icons/favicon.ico"/>
  11. </head>
  12. <body style="word-wrap: break-word;">
  13. <div id="menuScrollArea">
  14. <div id="logo"></div>
  15. <div id="menu">
  16. <h3>fhem.pl reference</h3>
  17. Version: <b>EN</b>&nbsp;<a href="commandref_DE.html">DE</a>
  18. <br><br>
  19. <a href="#doctop">Scroll to top</a>
  20. <br><br>
  21. <a style="display:none" href="#" name="loadAll">Load complete doc</a>
  22. <br><br>
  23. <a id="otherLang" style="display:none" href="#" name="otherLang">
  24. Load <span style="display:none" lang="DE">german</span>
  25. <span style="display:none" lang="EN">english</span>
  26. doc for <span class="mod"></span>
  27. </a>
  28. </div>
  29. </div>
  30. <div id="right">
  31. <a name="doctop"></a>
  32. <h3>Contents</h3>
  33. <ul>
  34. <a href="#intro">Introduction</a><br>
  35. <a href="#command">FHEM command types</a><br>
  36. <a href="#devspec">Device specification</a><br>
  37. <a href="#attributes">Attributes</a><br>
  38. <br>
  39. <b>FHEM commands</b>
  40. <ul>
  41. <!-- header:command -->
  42. <a href="#apptime">apptime</a> &nbsp; <!-- provides information about execution times -->
  43. <a href="#attr">attr</a> &nbsp; <!-- set an attribute for a FHEM device -->
  44. <a href="#cancel">cancel</a> &nbsp; <!-- cancel sleep -->
  45. <a href="#createlog">createlog</a> &nbsp; <!-- add a FileLog and an SVG to an existing device -->
  46. <a href="#define">define</a> &nbsp; <!-- define/create a FHEM device -->
  47. <a href="#defmod">defmod</a> &nbsp; <!-- define or modify a FHEM device -->
  48. <a href="#delete">delete</a> &nbsp; <!-- delete a FHEM device -->
  49. <a href="#deleteattr">deleteattr</a> &nbsp; <!-- delete an attribute -->
  50. <a href="#deletereading">deletereading</a> &nbsp; <!-- delete a reading -->
  51. <a href="#displayattr">displayattr</a> &nbsp; <!-- show attributes -->
  52. <a href="#get">get</a> &nbsp; <!-- retrieve a value from a FHEM device -->
  53. <a href="#IF">IF</a> &nbsp; <!-- conditionally execute FHEM commands -->
  54. <a href="#include">include</a> &nbsp; <!-- read in a file with FHEM commands -->
  55. <a href="#inform">inform</a> &nbsp; <!-- show events in a telnet connection -->
  56. <a href="#list">list</a> &nbsp; <!-- display definition,readings and attributes of a FHEM device -->
  57. <a href="#modify">modify</a> &nbsp; <!-- change the definition of a FHEM device -->
  58. <a href="#notice">notice</a> &nbsp; <!-- view and confirm of system messages -->
  59. <a href="#quit">quit</a> &nbsp; <!-- end a telnet connection to FHEM -->
  60. <a href="#reload">reload</a> &nbsp; <!-- reload a FHEM module (program definition) -->
  61. <a href="#rename">rename</a> &nbsp; <!-- rename a FHEM device -->
  62. <a href="#rereadcfg">rereadcfg</a> &nbsp; <!-- reread the FHEM configuration -->
  63. <a href="#save">save</a> &nbsp; <!-- save the FHEM configuration -->
  64. <a href="#set">set</a> &nbsp; <!-- set a value in a FHEM device -->
  65. <a href="#setdefaultattr">setdefaultattr</a> &nbsp; <!-- define a default attribute -->
  66. <a href="#setreading">setreading</a> &nbsp; <!-- set a reading for a FHEM device -->
  67. <a href="#setstate">setstate</a> &nbsp; <!-- set the main state of a FHEM device -->
  68. <a href="#shutdown">shutdown</a> &nbsp; <!-- shut down (terminate) FHEM -->
  69. <a href="#sleep">sleep</a> &nbsp; <!-- sleep (delay execution) for a while -->
  70. <a href="#trigger">trigger</a> &nbsp; <!-- generate a FHEM event -->
  71. <a href="#usb">usb</a> &nbsp; <!-- discover USB devices -->
  72. </ul>
  73. <br>
  74. <b>Devices</b>
  75. <ul>
  76. <a href="#global">global</a><br>
  77. <!-- header:device -->
  78. </ul>
  79. <br>
  80. <b>Helper modules</b>
  81. <ul>
  82. <!-- header:helper -->
  83. <a href="#CustomReadings">CustomReadings</a> &nbsp;
  84. <a href="#DOIF">DOIF</a> &nbsp;
  85. <a href="#Dashboard">Dashboard</a> &nbsp;
  86. <a href="#dewpoint">dewpoint</a> &nbsp;
  87. <a href="#FLOORPLAN">FLOORPLAN</a> &nbsp;
  88. <a href="#HCS">HCS</a> &nbsp;
  89. <a href="#Heating_Control">Heating_Control</a> &nbsp;
  90. <a href="#HMinfo">HMinfo</a> &nbsp;
  91. <a href="#HourCounter">HourCounter</a> &nbsp;
  92. <a href="#MaxScanner">MaxScanner</a> &nbsp;
  93. <a href="#PachLog">PachLog</a> &nbsp;
  94. <a href="#RandomTimer">RandomTimer</a> &nbsp;
  95. <a href="#rain">rain</a> &nbsp;
  96. <a href="#remotecontrol">remotecontrol</a> &nbsp;
  97. <a href="#statistics">statistics</a> &nbsp;
  98. <a href="#Twilight">Twilight</a> &nbsp;
  99. <a href="#THRESHOLD">THRESHOLD</a> &nbsp;
  100. <a href="#WeekdayTimer">WeekdayTimer</a> &nbsp;
  101. <a href="#WOL">WOL</a> &nbsp;
  102. <!-- header end -->
  103. </ul>
  104. <br>
  105. <a href="#perl">Perl specials</a><br>
  106. <a href="#gnuplot-syntax">gnuplot file syntax</a><br>
  107. </ul>
  108. <a name="intro"></a>
  109. <h3>Introduction</h3>
  110. <ul>
  111. FHEM is mainly used for home automation, but it is suitable for other tasks
  112. too, where notification, timers and logging plays an important role.<br>
  113. <br>
  114. It supports different hardware devices to interface with certain protocols
  115. (e.g. FHZ1000PC to interface FS20 and HMS, CM11 to access X10), and logical
  116. devices like FS20 or FHT to digest the messages for a certain device type using
  117. this protocol.<br>
  118. <br>
  119. FHEM is modular. The different devices are represented through modules which
  120. implement certain functions (e.g. define, get, set). Even seemingly integral
  121. parts of FHEM like triggers (<a href="#notify">notify</a>) and timers (<a
  122. href="#at">at</a>) are implemented this way, giving the possibility to
  123. replace/extend this functionality.<br> <br>
  124. FHEM is controlled through readable / ascii commands, which are specified in
  125. files (e.g. the configuration file), or issued over a TCP/IP connection, either
  126. directly in a telnet session, with a fhem.pl in client mode or from one of the
  127. web frontends.<br> <br>
  128. When starting the server you have to specify a configuration file:<br>
  129. <ul>
  130. <code>perl fhem.pl fhem.cfg</code>
  131. </ul>
  132. <br>
  133. A minimal configuration file looks like: <pre>
  134. attr global <a href="#logfile">logfile</a> log/fhem.log
  135. attr global <a href="#modpath">modpath</a> .
  136. attr global <a href="#statefile">statefile</a> log/fhem.save
  137. attr global <a href="#verbose">verbose</a> 3
  138. define telnetPort <a href="#telnet">telnet</a> 7072 global
  139. define WEB <a href="#FHEMWEB">FHEMWEB</a> 8083 global</pre>
  140. Note: the last two lines are optional and assume you wish to use the
  141. builtin telnet and WEB interface.<br>
  142. <br>
  143. The web interface can be reached at
  144. <ul>
  145. http://&lt;fhemhost&gt;:8083
  146. </ul>
  147. <br>
  148. TCP/IP communication with FHEM can either happen in a "session" (via
  149. telnet) or single client command (via fhem.pl). Example:
  150. <ul>
  151. <code>telnet &lt;fhemhost&gt; 7072<br>
  152. &lt;NL&gt; </code>(This newline switches into "prompt" mode)<code><br>
  153. &lt;command&gt;...<br>
  154. quit</code><br>
  155. </ul>
  156. or
  157. <ul>
  158. <code>fhem.pl &lt;fhemhost&gt;:7072 "&lt;fhem-command&gt" "..."</code>
  159. </ul>
  160. </ul>
  161. <!-- intro end - diese Zeile nicht entfernen! -->
  162. <a name="command"></a>
  163. <h3>FHEM command types</h3>
  164. <ul>
  165. There are three types of commands: "fhem" commands (described in this
  166. document), shell commands (they must be enclosed in double quotes ") and perl
  167. expressions (enclosed in curly brackets {}). shell commands or perl expressions
  168. are needed for complex <a href="#at">at</a> or <a href="#notify">notify</a>
  169. arguments, but can also issued as a "normal" command.<br>
  170. <br>
  171. E.g. the following three commands all do the same when issued from a telnet
  172. prompt:<br>
  173. <ul>
  174. set lamp off<br>
  175. "fhem.pl 7072 "set lamp off""<br>
  176. {fhem("set lamp off")}<br>
  177. </ul>
  178. <br>
  179. Shell commands will be executed in the background, perl expressions and
  180. FHEM commands will be executed in the main "thread". In order to make perl
  181. expressions easier to write, some special functions and variables are
  182. available. See the section <a href="#perl">Perl special</a> for a description.
  183. To trigger FHEM commands from a shell script (this is the "other way round"),
  184. use the client form of fhem.pl (described above).<br>
  185. <br>
  186. Multiple FHEM commands are separated by semicolon (;). In order to use semicolon
  187. in perl code or shell programs, they have to be escaped by the double semicolon
  188. (;;). See the <b>Notes</b> section of the <a href="#notify">notify</a>
  189. chapter on command parameters and escape rules.<br>
  190. E.g. the following first command switches Lamp1 off at 07:00 and Lamp2
  191. immediately (at the point of definition), the second one switches both lamps
  192. off at 07:00.<br>
  193. <ul>
  194. define lampoff at 07:00 set Lamp1 off; set Lamp2 off<br>
  195. define lampoff at 07:00 set Lamp1 off;; set Lamp2 off<br>
  196. </ul>
  197. For every further indirection you need to double the semicolons:, e.g. to
  198. switch on every day 2 devices at 7:00 for 10 minutes you have to write:<br>
  199. <ul>
  200. define onAt at 07:00 set Lamp1 on;;set Lamp2 on;; define offAt at +00:10 set Lamp1 off;;;;set Lamp2 off
  201. </ul>
  202. Don't dispair, the previous example can also be written as
  203. <ul>
  204. define onAt at 07:00 set Lamp1,Lamp2 on-for-timer 600
  205. </ul>
  206. <br>
  207. Commands can be either typed in plain, or read from a file (e.g. the
  208. configuration file at startup). The commands are either executed directly, or
  209. later if they are arguments to the <a href="#at">at</a> and <a
  210. href="#notify">notify</a> FHEM commands.<br>
  211. <br>
  212. A line ending with \ will be concatenated with the next one, so long lines
  213. (e.g. multiple perl commands) can be split in multiple lines. Some web fronteds
  214. (e.g. webpgm2) make editing of multiline commands transparent for you (i.e. there is no need for \) .<br>
  215. <br>
  216. </ul>
  217. <!-- command end - diese Zeile nicht entfernen! -->
  218. <a name="devspec"></a>
  219. <h3>Device specification (devspec)</h3>
  220. <ul>
  221. The commands
  222. <a href="#attr">attr</a>,
  223. <a href="#deleteattr">deleteattr</a>,
  224. <a href="#displayattr">displayattr</a>,
  225. <a href="#delete">delete</a>,
  226. <a href="#get">get</a>,
  227. <a href="#list">list</a>,
  228. <a href="#set">set</a>,
  229. <a href="#setreading">setreading</a>,
  230. <a href="#setstate">setstate</a>,
  231. <a href="#trigger">trigger</a>
  232. can take a more complex device specification as argument, which will be
  233. expanded to a list of devices. A device specification (short devspec) can be:
  234. <ul>
  235. <li>a single device name. This is the most common case.</li>
  236. <li>a list of devices, separated by comma (,)</li>
  237. <li>a regular expression</li>
  238. <li>a NAME=VALUE pair, where NAME can be an internal value like TYPE, a
  239. Reading-Name or an attribute. VALUE is a regexp. To negate the
  240. comparison, use NAME!=VALUE. To restrict the search, use i: as prefix
  241. for internal values, r: for readings and a: for attributes. See the
  242. example below.</li>
  243. <li>if the spec is followed by the expression :FILTER=NAME=VALUE, then the
  244. values found in the first round are filtered by the second expression.
  245. </ul>
  246. Examples:
  247. <ul>
  248. <code>set lamp1 on</code><br>
  249. <code>set lamp1,lamp2,lamp3 on</code><br>
  250. <code>set lamp.* on</code><br>
  251. <code>set room=kitchen off</code><br>
  252. <code>set room=kitchen:FILTER=STATE=on off</code><br>
  253. <code>set room=kitchen:FILTER=STATE!=off off</code><br>
  254. <code>list disabled=</code><br>
  255. <code>list TYPE=FS20 STATE</code><br>
  256. <code>list i:TYPE=FS20 STATE</code><br>
  257. </ul>
  258. Notes:
  259. <ul>
  260. <li>the spec may not contain space characters.</n>
  261. <li>if there is a device which exactly corresponds to the spec, then
  262. no special processing is done.</li>
  263. <li>first the spec is separated by comma, then the regular expression and
  264. filter operations are executed.</li>
  265. <li>the returned list can contain the same device more than once, so
  266. "set lamp3,lamp3 on" switches lamp3 twice.</li>
  267. <li>for more complex structuring demands see the <a href="#structure">
  268. structure</a> device.
  269. </ul>
  270. </ul>
  271. <!-- devspec end - diese Zeile nicht entfernen! -->
  272. <a name="attributes"></a>
  273. <h3>Attributes</h3>
  274. All devices have attributes. These can be set by means of the <a
  275. href="#attr">attr</a> command, displayed with the <a
  276. href="#displayattr">displayattr</a> command, and deleted by the <a
  277. href="#deleteattr">deleteattr</a> command.<p>
  278. There are global attributes that are used by all devices and local attributes
  279. that apply to individual device classes only.<p>
  280. Some devices (like <a href="#FHEMWEB">FHEMWEB</a>) automatically define new
  281. global attributes on the first definition of a device of such type.<p>
  282. You can use the command <p><code>attr global userattr
  283. &lt;attributelist&gt;</code><p> for the <a href="#global">global</a> device to
  284. declare new global attributes and <p><code>attr &lt;devicespec&gt; userattr
  285. &lt;attributelist&gt;</code><p> for individual devices according to <a
  286. href="#devspec">devspec</a> to declare new local attributes.
  287. <code>&lt;attributelist&gt;</code> is a space-separated list which contains the
  288. names of the additional attributes. See the documentation of the <a
  289. href="#attr">attr</a> command for examples.<p>
  290. Be careful not to overwrite additional global attributes previously defined by
  291. yourself or a device. Use the <code>attr global userattr
  292. &lt;attributelist&gt;</code> as early in your configuration as possible.
  293. <h4>Device specific attributes</h4>
  294. Device specific attributes are documented in the corresponding device section.
  295. <h4>Global attributes used by all devices</h4>
  296. <ul>
  297. <a name="alias"></a>
  298. <li>alias<br>
  299. Used by FHEMWEB to display a device with another name e.g. when using
  300. special characters/spaces not accepted by device definition.
  301. </li><br>
  302. <a name="comment"></a>
  303. <li>comment<br>
  304. Add an arbitrary comment.
  305. </li><br>
  306. <a name="eventMap"></a>
  307. <li>eventMap<br>
  308. Replace event names and set arguments. The value of this attribute
  309. consists of a list of space separated values, each value is a colon
  310. separated pair. The first part specifies the "old" value, the second
  311. the new/desired value. If the first character is slash(/) or comma(,)
  312. then split not by space but by this character, enabling to embed spaces.
  313. Examples:<ul><code>
  314. attr store eventMap on:open off:closed<br>
  315. attr store eventMap /on-for-timer 10:open/off:closed/<br>
  316. set store open
  317. </code></ul>
  318. The explicit variant of this attribute has the following syntax:
  319. <ul><code>
  320. attr store eventMap { dev=>{"on"=>"open"}, usr=>{"open"=>"on"} }<br>
  321. attr store eventMap { dev=>{"^on(-for-timer)?(.*)"=>"open$2"},
  322. usr=>{"^open(.*)"=>"on$1"},
  323. fw=>{"^open(.*)"=>"open"} }
  324. </code></ul>
  325. This variant must be used, if the mapping is not symmetrical, the first
  326. part (dev) representing the device to user mapping, i.e. if the device
  327. reports on 100 or on-for-timer 100, the user will see open 100. The
  328. second part (usr) is the other direction, if the user specified open
  329. 10, the device will receive on 10. On both occasions the key will be
  330. first compared directly with the text, and if it is not equal, then it
  331. will be tried to match it as a regexp. When using regexps in the usr
  332. part with wildcards, the fw part must be filled with the exact same
  333. keys to enable a correct display in the FHEMWEB set dropdown list in
  334. the detail view.
  335. </li><br>
  336. <a name="genericDisplayType"></a>
  337. <li>genericDisplayType<br>
  338. used by some frontends (but not FHEMWEB) to offer a default image or
  339. appropriate commands for this device. Currently the following values
  340. are supported: switch,outlet,light,blind,speaker,thermostat
  341. </li><br>
  342. <a name="group"></a>
  343. <li>group<br>
  344. Group devices. Recognized by web-pgm2 (module <a
  345. href="#FHEMWEB">FHEMWEB</a>), it makes
  346. devices in the same group appear in the same box).
  347. This is used to further group
  348. devices together. A device can appear in more than one group, in this
  349. case the groups have to be specified comma-separated.<br>
  350. If this attribute is not set then the device type is used as the
  351. grouping attribute.
  352. </li><br>
  353. <a name="room"></a>
  354. <li>room<br>
  355. Filter/group devices. Recognized by web-pgm2 and web-pgm3. A device
  356. can appear in more than one room, in this case the rooms have to be
  357. specified comma-separated.<br>
  358. Devices in the room hidden will not appear in the web output, or set
  359. the <a href="#hiddenroom"> FHEMWEB attribute to selectively disable
  360. rooms for certain FHEMWEB instances.
  361. </li><br>
  362. <a name="suppressReading"></a>
  363. <li>suppressReading<br>
  364. Used to eliminate unwanted readings. The value is a regular expression,
  365. with ^ and $ added. Only necessary in exceptional cases.
  366. </li><br>
  367. <a name="showtime"></a>
  368. <li>showtime<br>
  369. Used in the webfrontend pgm2 to show the time of last activity
  370. instead of the state in the summary view. Useful e.g. for FS20 PIRI
  371. devices.
  372. </li><br>
  373. <a name="verbose"></a>
  374. <li>verbose<br>
  375. Set the verbosity level. Possible values:
  376. <ul>
  377. <li>0 - server start/stop</li>
  378. <li>1 - error messages or unknown packets</li>
  379. <li>2 - major events/alarms.</li>
  380. <li>3 - commands sent out will be logged.</li>
  381. <li>4 - you'll see whats received by the different devices.</li>
  382. <li>5 - debugging.</li>
  383. </ul>
  384. The value for the <a href="#global">global</a> device is a default for
  385. other devices without own verbose attribute set.
  386. </li></br>
  387. </ul>
  388. <a name="readingFnAttributes"></a>
  389. <h4>readingFnAttributes</h4><p>
  390. The following global attributes are honored by the modules that make use of the
  391. standardized readings updating mechanism in fhem.pl. Check the module's
  392. attribute list if you want to know if a device supports these attributes. <br>
  393. <ul>
  394. <a name="stateFormat"></a>
  395. <li>stateFormat<br>
  396. Modifies the STATE of the device, shown by the list command or in the room
  397. overview in FHEMWEB. If not set, its value is taken from the state reading.
  398. If set, then every word in the argument is replaced by the value of the
  399. reading if such a reading for the current device exists. If the value of
  400. this attribute is enclused in {}, then it is evaluated. This attribute is
  401. evaluated each time a reading is updated.
  402. </li>
  403. <p>
  404. <a name="event-on-update-reading"></a>
  405. <li>event-on-update-reading<br>
  406. If not set, every update of any reading creates an event, which e.g. is
  407. handled by <a href="#notify">notify</a> or <a href="#FileLog">FileLog</a>.
  408. The attribute takes a comma-separated list of readings. You may use regular
  409. expressions in that list. If set, only updates of the listed readings
  410. create events.
  411. </li>
  412. <p>
  413. <a name="event-on-change-reading"></a>
  414. <li>event-on-change-reading<br>
  415. The attribute takes a comma-separated list of readings. You may use regular
  416. expressions in that list. If set, only changes of the listed readings
  417. create events. In other words, if a reading listed here is updated with the
  418. new value identical to the old value, no event is created. If an optional [:threshold]
  419. is given after a reading name events are only generated if the change is >= threshold.
  420. </li>
  421. The precedence of event-on-update-reading and event-on-change-reading is as
  422. follows:
  423. <ol>
  424. <li>If both attributes are not set, any update of any reading of the device
  425. creates an event.</li>
  426. <li>If any of the attributes is set, no events occur for updates or changes
  427. of readings not listed in any of the attributes.</li>
  428. <li>If a reading is listed in event-on-update-reading, an update of the
  429. reading creates an event no matter whether the reading is also listed
  430. in event-on-change-reading.</li>
  431. </ol>
  432. <p>
  433. <a name="timestamp-on-change-reading"></a>
  434. <li>timestamp-on-change-reading<br>
  435. The attribute takes a comma-separated list of readings. You may use regular
  436. expressions in that list. If set, the timestamps of the listed readings will
  437. not be changed if event-on-change-reading is also set and it would not create
  438. an event for this reading.
  439. </li>
  440. <p>
  441. <a name="event-aggregator"></a>
  442. <li>event-aggregator</li>
  443. The primary uses of this attribute are to calculate (time-weighted) averages of
  444. readings over time periods and to throttle the update rate of readings and thus
  445. the amount of data written to the logs.<p>
  446. This attribute takes a comma-separated list of <code>reading:interval:method:function:holdTime</code>
  447. quintuples. You may use regular expressions for <code>reading</code>. If set, updates for the
  448. listed readings are ignored and associated events are suppressed for a black-out period of at
  449. least <code>interval</code> seconds (downsampling). After the black-out period has expired, the reading is
  450. updated with a value that is calculated from the values and timestamps of the previously ignored
  451. updates within the black-out period as follows:
  452. <table>
  453. <tr><th>function</th><th>description</th></tr>
  454. <tr><td>v</td><td>the last value encountered</td></tr>
  455. <tr><td>v0</td><td>the first value encountered</td></tr>
  456. <tr><td>min</td><td>the smallest value encountered</td></tr>
  457. <tr><td>max</td><td>the largest value encountered</td></tr>
  458. <tr><td>mean</td><td>the arithmetic mean of all values</td></tr>
  459. <tr><td>sd</td><td>the standard deviation from the mean</td></tr>
  460. <tr><td>median</td><td>the median of all values (requires holdTime and function none)</td></tr>
  461. <tr><td>integral</td><td>the arithmetic sum (if not time-weighted) or integral area (if time-weighted) of all values</td></tr>
  462. <tr><td>n</td><td>number of samples</td></tr>
  463. <tr><td>t</td><td>timestamp of the last value</td></tr>
  464. <tr><td>t0</td><td>timestamp of the first value</td></tr>
  465. </table>
  466. <p>
  467. If <code>method</code> is <code>none</code>, then that's all there is. If <code>method</code>
  468. is <code>const</code> or <code>linear</code>, the time-weighted series of values is taken into
  469. account instead. The weight is the timespan between two subsequent updates.
  470. With the <code>const</code> method, the value is the value of the reading at the beginning of
  471. the timespan; with the <code>linear</code> method, the value is the arithmetic average of
  472. the values at the beginning and the end of the timespan.
  473. Rollovers of black-out periods are handled as one would expect it.<p>
  474. One would typically use the <code>linear</code> method with the <code>mean</code> function for
  475. quantities continuously varying over time like electric power consumption, temperature or speed.
  476. For cumulative quantities like energy consumed, rain fallen or distance covered,
  477. the <code>none</code> method with the <code>v</code> function is used. The <code>constant</code>
  478. method is for discrete quantities that stay constant until the corresponding reading is updated,
  479. e.g. counters, switches and the like.<p>
  480. If the <code>holdTime</code> in seconds is defined, the samples will be kept in memory allowing
  481. the calculation of floating statistics instead of blocked statistics. With <code>holdTime</code>
  482. defined the <code>interval</code> can be kept undefined so that the readings update rate is unchanged
  483. or it can be set to a value less then <code>holdTime</code> for downsampling as described above
  484. with a full history of the readings in memory. Note that the historic samples are not persistent
  485. and will be lost when restarting FHEM.<p>
  486. The event aggregator only takes into consideration those updates that remain after preprocessing
  487. according to the <code>event-on-update-reading</code> and <code>event-on-change-reading</code>
  488. directives. Besides which, any update of a reading that occurs within a timespan from the preceding
  489. update that is smaller than the resolution of FHEM's time granularity is ditched.<p>
  490. When more than one function should be calculated for the same reading, the original reading must be
  491. multiplied (e.g. by using a notify) before applying the event-aggregator to the derived readings.<p>
  492. Examples:<br>
  493. <code>attr myPowerMeter event-aggregator EP_POWER_METER:300:linear:mean,EP_ENERGY_METER:300:none:v</code><br>
  494. <code>attr myBadSensor event-aggregator TEMP::none:median:300</code><br>
  495. <code>attr mySunMeter event-aggregator SUN_INTENSITY_24H::const:integral:86400</code>
  496. </li>
  497. <p>
  498. <a name="event-min-interval"></a>
  499. <li>event-min-interval<br>
  500. This attribute takes a comma-separated list of reading:minInterval pairs.
  501. You may use regular expressions for reading. Events will only be
  502. generated, if at least minInterval seconds elapsed since the last reading
  503. of the matched type.
  504. </li>
  505. <p>
  506. <a name="userReadings"></a>
  507. <li>userReadings<br>
  508. A comma-separated list of definitions of user-defined readings. Each
  509. definition has the form:
  510. <ul>
  511. <code>
  512. &lt;reading&gt;[:&lt;trigger&gt;] [&lt;modifier&gt;] { &lt;perl code&gt; }
  513. </code>
  514. </ul>
  515. After a single or bulk readings update, the user-defined readings are set
  516. by evaluating the <a href="#perl">perl code</a><code> { &lt;perl code&gt;
  517. }</code> for all definitions and setting the value of the respective
  518. user-defined reading <code>&lt;reading&gt;</code> to the result. If
  519. &lt;trigger&gt; is given, then all processing for this specific user
  520. reading is only done if one of the just updated "reading: value"
  521. combinations matches &lt;trigger&gt;, which is treated as a regexp.
  522. <br>
  523. Examples:<br>
  524. <ul><code>
  525. attr myEnergyMeter userReadings energy
  526. { ReadingsVal("myEnergyMeter","counters.A",0)/1250.0;; }<br>
  527. attr myMultiMeter userReadings
  528. energy1:counters.A.* { ReadingsVal("myMultiMeter","counters.A",0)/1250.0;; },
  529. energy2:counters.B.* { ReadingsVal("myMultiMeter","counters.B",0)/1250.0;; }
  530. </code></ul>
  531. <code>&lt;modifier&gt;</code> can take one of these values:
  532. <ul>
  533. <li>none: the same as it would not have been given at all.</li>
  534. <li>difference: the reading is set to the difference between the current
  535. and the previously evaluated value.</li>
  536. <li>differential: the reading is set to the difference between the
  537. current and the previously evaluated value divided by the time in
  538. seconds between the current and the previous evaluation. Granularity
  539. of time is one second. No value is calculated if the time past is
  540. below one second. Useful to calculate rates.</li>
  541. <li>integral: reverse function of differential. The result is incremented
  542. by the product of the time difference between the last two readings
  543. and the avarage of the last two readings. <br>
  544. result += (time - timeold) * (oldval + value) / 2
  545. </li>
  546. <li>offset: if the current evaluated value is smaler than the previously
  547. evaluated value the reading is incremented by the previous value.
  548. the reading can then be used as an offset correct for a counter that
  549. is reset for example due to a power loss.</li>
  550. <li>monotonic: if the difference between the current and the previously
  551. evaluated value is positive the reading is incremented by this difference.
  552. this allows to derive a monotonic growing counter from an original counter
  553. even if the original will be rest by a power loss</li>
  554. </ul>
  555. Example:<br>
  556. <ul><code>attr myPowerMeter userReadings power
  557. differential { ReadingsVal("myPowerMeter","counters.A",0)/1250.0;; }
  558. </code></ul>
  559. Notes:
  560. <ul>
  561. <li>user readings with modifiers difference and differential store the
  562. calculated values internally. The user reading is set earliest at the
  563. second evaluation. Beware of stale values when changing
  564. definitions!</li>
  565. <li>the name of the defined Readings consists of alphanumeric characters
  566. with underscore (_) and the minus (-) sign.</li>
  567. </ul>
  568. </li>
  569. </ul>
  570. <h4>Common attributes</h4>
  571. The following local attributes are used by a wider range of devices:
  572. <ul>
  573. <a name="IODev"></a>
  574. <li>IODev<br>
  575. Set the IO or physical device which should be used for sending signals
  576. for this "logical" device. An example for the physical device is an FHZ
  577. or a CUL. Note: Upon startup FHEM assigns each logical device
  578. (FS20/HMS/KS300/etc) the last physical device which can receive data
  579. for this type of device. The attribute IODev needs to be used only if
  580. you attached more than one physical device capable of receiving signals
  581. for this logical device.</li><br>
  582. <li>Special: attribute disable can be toggled<br/>
  583. Attribute "disable" can be toggled by issuing the following command:<br/>
  584. <br/>
  585. <code>attr &lt;device&gt; disable toggle</code><br/>
  586. <br/>
  587. Attribute "disable" must be offered by the corresponding module</li>
  588. </ul>
  589. <!-- attributes end - diese Zeile nicht entfernen! -->
  590. <br><br>
  591. <a name="commands"></a>
  592. <a name="attr"></a>
  593. <h3>attr</h3>
  594. <ul>
  595. <code>attr &lt;devspec&gt; &lt;attrname&gt; [&lt;value&gt;] </code><br>
  596. <br>Set an attribute for a device defined by <a href="#define">define</a>.
  597. You can define your own <a href="#attributes">attributes</a> too to use them
  598. in other applications.
  599. Use "attr &lt;name&gt; ?" to get a list of possible attributes.
  600. See the <a href="#devspec">Device specification</a> section for details on
  601. &lt;devspec&gt;.
  602. After setting the attribute, the global event "ATTR" will be generated.
  603. <br><br>
  604. Examples:
  605. <ul>
  606. <code>attr global verbose 3</code><br>
  607. <code>attr lamp room kitchen</code><br>
  608. <code>attr lamp group lights</code><br>
  609. <code>attr lamp loglevel 6</code><br>
  610. <code>attr weatherstation event-on-update-reading wind,temperature,humidity</code><br>
  611. <code>attr weatherstation event-on-change-reading israining</code><br>
  612. <code>attr weatherstation event-on-change-reading israining,state</code><br>
  613. <code>attr heating stateFormat Temp:measured-temp, Valve:actuator</code><br>
  614. </ul>
  615. <br>
  616. Notes:<br>
  617. <ul>
  618. <li>See <a href="#deleteattr">deleteattr</a> to delete attributes.</li>
  619. </ul>
  620. </ul>
  621. <a name="cancel"></a>
  622. <h3>cancel</h3>
  623. <ul>
  624. <code>cancel [&lt;id&gt; [quiet]]</code>
  625. <br><br>
  626. Cancels a named <a href="#sleep">sleep</a>.
  627. </ul>
  628. <a name="define"></a>
  629. <h3>define</h3>
  630. <ul>
  631. <code>define [option] &lt;name&gt; &lt;type&gt; &lt;type-specific&gt;</code><br>
  632. <br>
  633. Define a device. You need devices if you want to manipulate them (e.g.
  634. set on/off), and the logfile is also more readable if it contains e.g.
  635. "lamp off" instead of "Device 5673, Button 00, Code 00 (off)". <br>
  636. After definition, the global event "DEFINED" will be generated, see the
  637. notify section for details.<br>
  638. <br><br>
  639. Each device takes different additional arguments at definition, see the
  640. corresponding device section for details.<br>
  641. <br>
  642. Options:<br>
  643. <ul>
  644. <li>-temporary<br>
  645. Add the TEMPORARY flag to the definition, which will prevent saving the
  646. device to fhem.cfg.
  647. </li><br>
  648. <li>-ignoreErr<br>
  649. Reduce the number of errors displayed when a certain FHEM-module cannot
  650. be loaded. Used by fhem.cfg.demo, as using the RSS example requires the
  651. installation of several uncommon perl modules.
  652. </li><br>
  653. </ul>
  654. </ul>
  655. <a name="defmod"></a>
  656. <h3>defmod</h3>
  657. <ul>
  658. <code>defmod &lt;name&gt; &lt;type&gt; &lt;type-specific&gt;</code><br>
  659. <br>
  660. Define a device or modify it, if it already exists. E.g. to switch off a lamp
  661. 10 Minutes after the last message from the motion detector, you may use
  662. <ul><code>
  663. define mdNtfy notify motionDetector defmod mdOff at +00:10 set lamp off
  664. </code></ul>
  665. Using define here for the mdOff will generate an error if the motion detector
  666. triggers within the 10 minutes after the first event, as the mdOff at
  667. definition still exists.
  668. <br>
  669. </ul>
  670. <a name="delete"></a>
  671. <h3>delete</h3>
  672. <ul>
  673. <code>delete &lt;devspec&gt;</code> <br>
  674. <br>
  675. Delete something created with the <a href="#define">define</a> command.
  676. See the <a href="#devspec">Device specification</a> section for details on
  677. &lt;devspec&gt;.<br>
  678. After deletion, the global event "DELETED" will be generated, see the notify
  679. section for details.<br>
  680. Examples:
  681. <ul>
  682. <code>delete lamp</code><br>
  683. </ul>
  684. <br>
  685. </ul>
  686. <a name="deleteattr"></a>
  687. <h3>deleteattr</h3>
  688. <ul>
  689. <code>deleteattr &lt;devspec&gt; [&lt;attrname&gt;]</code> <br>
  690. <br>
  691. Delete either a single attribute (see the <a href="#attr">attr</a> command)
  692. or all attributes for a device (if no &lt;attrname&gt; is defined).
  693. See the <a href="#devspec">Device specification</a> section for details on
  694. &lt;devspec&gt;.<br>
  695. After deleting the attribute, the global event "DELETEATTR" will be generated.
  696. <br>
  697. Examples:
  698. <ul>
  699. <code>deleteattr lamp follow-on-for-timer</code><br>
  700. <code>deleteattr lamp</code><br>
  701. </ul>
  702. <br>
  703. </ul>
  704. <a name="deletereading"></a>
  705. <h3>deletereading</h3>
  706. <ul>
  707. <code>deletereading &lt;devspec&gt; &lt;readingname&gt;</code> <br>
  708. <br>
  709. Delete the reading &lt;readingname&gt;
  710. for a device. &lt;readingname&gt; is a perl regular expression that must match the whole name of the reading.
  711. Use with greatest care! FHEM might crash if you delete vital readings of a device.
  712. See the <a href="#devspec">Device specification</a> section for details on
  713. &lt;devspec&gt;.<br>
  714. <br>
  715. Examples:
  716. <ul>
  717. <code>deletereading mySensor temp1</code><br>
  718. <code>deletereading mySensor temp\d+</code><br>
  719. </ul>
  720. <br>
  721. </ul>
  722. <a name="displayattr"></a>
  723. <h3>displayattr</h3>
  724. <ul>
  725. <code>displayattr &lt;devspec&gt; [&lt;attrname&gt;]</code> <br>
  726. <br>
  727. Display either the value of a single attribute (see the <a href="#attr">attr</a> command)
  728. or all attributes for a device (if no &lt;attrname&gt; is defined).
  729. See the <a href="#devspec">Device specification</a> section for details on
  730. &lt;devspec&gt;.<br>
  731. If more then one device is specified, then the device name will also included
  732. in the output.
  733. <br>
  734. Examples:
  735. <ul>
  736. <code>
  737. fhem&gt; di WEB<br>
  738. menuEntries AlarmOn,/fhem?cmd=set%20alarm%20on<br>
  739. room Misc.<br>
  740. fhem&gt di WEB room<br>
  741. Misc.<br>
  742. </code>
  743. </ul>
  744. <br>
  745. </ul>
  746. <a name="get"></a>
  747. <h3>get</h3>
  748. <ul>
  749. <code>get &lt;devspec&gt; &lt;type-specific&gt;</code>
  750. <br><br>
  751. Ask a value directly from the device, and wait for an answer. In general, you
  752. can get a list of possible parameters by
  753. <ul>
  754. <code>get &lt;device&gt; ?</code>
  755. </ul>
  756. See the <a href="#devspec">Device specification</a> section for details on
  757. &lt;devspec&gt;.<br>
  758. <br>
  759. Each device has different get parameters, see the corresponding device
  760. section for details.<br>
  761. <br>
  762. </ul>
  763. <a name="include"></a>
  764. <h3>include</h3>
  765. <ul>
  766. <code>include &lt;filename&gt;</code> <br>
  767. <br>
  768. Read in the file, and process every line as a FHEM command.
  769. Note: only experts should use this command.
  770. <br>
  771. </ul>
  772. <a name="inform"></a>
  773. <h3>inform</h3>
  774. <ul>
  775. <code>inform {on|off|timer|raw} [regexp]</code> <br>
  776. <br>
  777. If set to on, and a device state changes, send a notification to the current
  778. client. This command can be used by other programs/modules to receive a
  779. notification.<br>
  780. The option timer prepends a timerstamp to the line. Note: this command is
  781. a nice way to check which events are generated, to help you when creating
  782. <a href="#notify">notify</a> or <a href="#FileLog">FileLog</a> entries.
  783. <br>
  784. </ul>
  785. <a name="list"></a>
  786. <h3>list</h3>
  787. <ul>
  788. <code>list [devspec] [value]</code><br>
  789. or<br>
  790. <code>list {-r|-R} devspec</code><br>
  791. <br><br>
  792. Output a list of all definitions, all notify settings and all at
  793. entries. This is one of the few commands which return a string in a
  794. normal case.
  795. See the <a href="#devspec">Device specification</a> section for details on
  796. &lt;devspec&gt;.
  797. <br>
  798. If value is specified, then output this property (like DEF, TYPE, etc) or
  799. reading (actuator, measured-temp) for all devices from the devspec.
  800. <br><br>
  801. Example:
  802. <pre><code> fhem> list
  803. Type list <name> for detailed info.
  804. Internal:
  805. global (Internal)
  806. FHZ:
  807. FHZ (fhtbuf: 23)
  808. FS20:
  809. Btn4 (on-old-for-timer)
  810. Roll1 (on)
  811. Stehlampe (off)
  812. FHT:
  813. fl (measured-temp: 21.1 (Celsius))
  814. KS300:
  815. out1 (T: 2.9 H: 74 W: 2.2 R: 8.2 IR: no)
  816. at:
  817. at_rollup (Next: 07:00:00)
  818. notify:
  819. ntfy_btn4 (active)
  820. FileLog:
  821. avglog (active)
  822. </code></pre>
  823. If specifying <code>name</code>, then a detailed status for <code>name</code>
  824. will be displayed, e.g.:
  825. <pre><code> fhem> list fl
  826. Internals:
  827. CODE 5102
  828. DEF 5102
  829. NAME fl
  830. NR 15
  831. STATE measured-temp: 21.1 (Celsius)
  832. TYPE FHT
  833. IODev FHZ
  834. Attributes:
  835. room Heizung
  836. Readings:
  837. 2006-11-02 09:45:56 actuator 19%
  838. [...]
  839. </code></pre>
  840. With the -r (raw) option output the device definition in a format suitable
  841. for inclusion in fhem.cfg and fhem.state. -R returns the definition of the
  842. device itself, together with the definition of probably associated devices.
  843. Note: the algorithm to select associated devices is known to be imperfect.
  844. </ul>
  845. <a name="modify"></a>
  846. <h3>modify</h3>
  847. <ul>
  848. <code>modify &lt;name&gt; &lt;type-dependent-options&gt;</code>
  849. <br><br>
  850. Used to modify some definitions. Useful for changing some <a
  851. href="#at">at</a> or <a href="#notify">notify</a> definitions. If specifying
  852. one argument to an at type definition, only the time part will be changed. In
  853. case of a notify type definition, only the regex part will be changed. All
  854. other values (state, attributes, etc) will remain intact.
  855. After modify, the global event "MODIFIED" will be generated.
  856. <br><br>
  857. Example:
  858. <ul>
  859. <code>define lampon at 19:00 set lamp on</code><br>
  860. <code>modify lampon *19:00</code><br>
  861. <code>modify lampon 19:00 set lamp on-for-timer 16</code><br>
  862. </ul>
  863. </ul>
  864. <a name="quit"></a>
  865. <h3>quit</h3>
  866. <ul>
  867. <code>quit</code>
  868. <br><br>
  869. If used in a TCP/IP session, terminate the client session.<br>
  870. If used in a script, terminate the parsing of the current script.
  871. <br><br>
  872. Example:
  873. <ul>
  874. <code>quit</code>
  875. </ul>
  876. </ul>
  877. <a name="reload"></a>
  878. <h3>reload</h3>
  879. <ul>
  880. <code>reload &lt;module&gt;</code>
  881. <br><br>
  882. Reload the given module from the module directory. It is a convenient way to
  883. test modules whithout restarting the program.
  884. <br><br>
  885. Example:
  886. <ul>
  887. <code>reload 99_PRIV</code>
  888. </ul>
  889. </ul>
  890. <a name="rename"></a>
  891. <h3>rename</h3>
  892. <ul>
  893. <code>rename &lt;oldname&gt; &lt;newname&gt;</code>
  894. <br><br>
  895. Rename a device from the &lt;oldname&gt; to &lt;newname&gt;, together with
  896. its attributes. The global event RENAMED will be generated, see the notify
  897. section for details.
  898. <br><br>
  899. Example:
  900. <ul>
  901. <code>rename FHT_1234 fht.kitchen</code>
  902. </ul>
  903. </ul>
  904. <a name="rereadcfg"></a>
  905. <h3>rereadcfg</h3>
  906. <ul>
  907. <code>rereadcfg [fhem-config-file]</code>
  908. <br><br>
  909. Re-read the active configuration file, or the optionally specified file.<br>
  910. The sequence: the <a href="#statefile">statefile</a> will be saved first,
  911. then all devices will be deleted, then the currently active config file (or
  912. the specified file) will be read and at last the statefile will be
  913. reloaded.<br>
  914. Upon completion it triggers the global:REREADCFG event. All existing
  915. connections up to the one issuing the rereadcfg will be closed.
  916. <br><br>
  917. Example:
  918. <ul>
  919. <code>rereadcfg</code>
  920. </ul>
  921. </ul>
  922. <a name="save"></a>
  923. <h3>save</h3>
  924. <ul>
  925. <code>save [&lt;configfile&gt;]</code>
  926. <br><br>
  927. Save first the <a href="#statefile">statefile</a>, then the
  928. <a href="#configfile">configfile</a> information. If a parameter is specified,
  929. it will be used instead the global configfile attribute.<br><br>
  930. Notes:
  931. <ul>
  932. <li>save only writes out definitions and attributes, but no (set/get)
  933. commands which were previously part of the config file. If you need such
  934. commands after the initialization (e.g. <a href="#FHZset">FHTcode</a>), you
  935. should trigger them via <a href="#notify">notify</a>, when receiving the
  936. INITIALIZED event.</li>
  937. <li>save tries to preserve comments (lines starting with #) and include
  938. structures, but it won't work correctly if some of these files are not
  939. writeable.</li>
  940. </ul>
  941. </ul>
  942. <a name="set"></a>
  943. <h3>set</h3>
  944. <ul>
  945. <code>set &lt;devspec&gt; &lt;type-specific&gt;</code>
  946. <br><br>
  947. Set parameters of a device / send signals to a device. You can
  948. get a list of possible parameters by
  949. <ul>
  950. <code>set &lt;name&gt; ?</code>
  951. </ul>
  952. See the <a href="#devspec">Device specification</a> section for details on
  953. &lt;devspec&gt;. The set command returns only a value on error.<br>
  954. <br>
  955. Each device has different set parameters, see the corresponding device
  956. section for details.<br>
  957. <br><br>
  958. From featurelevel 5.7 on the set and setreading command replaces:
  959. <ul>
  960. <li>[device:reading] with the corresponding reading of device, if both device
  961. and reading exists.</li>
  962. <li>[device:reading:d] same as above, but only the number is retrieved, see
  963. ReadingsNum </li>
  964. <li>{(perlExpression)} with the result of perlExpression.
  965. The $DEV variable is additionally available, designating the set device
  966. name.
  967. </li>
  968. </ul>
  969. <br><br>
  970. <a name="setExtensions"></a>
  971. Some modules support a common list of <b>set extensions</b>, and point in
  972. their documentation to this section. If the module itself implements one of
  973. the following commands, then the module-implementation takes precedence.
  974. <ul>
  975. <li>on-for-timer &lt;seconds&gt<br>
  976. Issue the on command for the device, and after &lt;seconds&gt; the off
  977. command. For issuing the off command an internal timer will be
  978. scheduled, which is deleted upon a restart. To delete this internal
  979. timer without restart specify 0 as argument.</li>
  980. <li>off-for-timer &lt;seconds&gt<br>
  981. see on-for-timer above.</li>
  982. <li>on-till &lt;timedet&gt<br>
  983. Issue the on command for the device, and create an at definition with
  984. &lt;timedet&gt; (in the form HH:MM[:SS]) to set it off. This definition
  985. is visible, and its name is deviceName+"_till". To cancel the scheduled
  986. off, delete the at definition. Note: on-till is not active, if the
  987. specified time is after the current time, in order to make things like
  988. <ul><code>
  989. define morningLight at *06:00 set Lamp on-till {sunrise()}
  990. </code></ul>
  991. easy.</li>
  992. <li>on-till-overnight &lt;timedet&gt<br>
  993. Like on-till, but wont compare the current time with the timespec, so
  994. following will work:
  995. <ul><code>
  996. define nightLight at *{sunset()} set Lamp on-till-overnight 01:00
  997. </code></ul>
  998. </li>
  999. <li>off-till &lt;timedet&gt<br>
  1000. see on-till above.</li>
  1001. <li>off-till-overnight &lt;timedet&gt<br>
  1002. see on-till-overnight above.</li>
  1003. <li>blink &lt;number&gt; &lt;blink-period&gt;<br>
  1004. set the device on for &lt;blink-period&gt; then off for
  1005. &lt;blink-period&gt; and repeat this &lt;number&gt; times.
  1006. To stop blinking specify "0 0" as argument.</li>
  1007. <li>intervals &lt;from1&gt;-&lt;till1&gt; &lt;from2&gt;-&lt;till2&gt;...
  1008. </br>
  1009. set the device on for the specified intervals, which are all timespecs
  1010. in the form HH:MM[:SS]. The intervals are space separated.</li>
  1011. </ul>
  1012. Examples:
  1013. <ul>
  1014. <code>
  1015. set switch on-for-timer 12.5<br>
  1016. set switch on-till {sunset()}<br>
  1017. set switch blink 3 1<br>
  1018. set switch intervals 08:00-12:00 13:00-18:00<br>
  1019. </code>
  1020. </ul>
  1021. </ul>
  1022. <a name="setdefaultattr"></a>
  1023. <h3>setdefaultattr</h3>
  1024. <ul>
  1025. <code>setdefaultattr [&lt;attrname&gt; [&lt;value&gt;]] </code><br>
  1026. <br>Add a default attribute. Each device defined from now on will receive
  1027. this attribute.<br> If no attrname is specified, then the default attribute
  1028. list will be deleted.
  1029. <br><br>
  1030. Example to set the attribute "room kitchen" and "loglevel 4" to
  1031. each of the lamps:
  1032. <ul>
  1033. <code>setdefaultattr room kitchen</code><br>
  1034. <code>setdefaultattr loglevel 4</code><br>
  1035. <code>define lamp1 FS20 1234 11</code><br>
  1036. <code>define lamp2 FS20 1234 12</code><br>
  1037. <code>define lamp3 FS20 1234 13</code><br>
  1038. <code>setdefaultattr</code><br>
  1039. </ul>
  1040. <br>
  1041. Notes:<br>
  1042. <ul>
  1043. <li>There is no way to delete a single default-attribute from the list</li>
  1044. </ul>
  1045. </ul>
  1046. <a name="setreading"></a>
  1047. <h3>setreading</h3>
  1048. <ul>
  1049. <code>setreading &lt;devspec&gt; &lt;reading&gt; &lt;value&gt;</code>
  1050. <br><br>
  1051. Set the reading &lt;reading&gt; for the device <code>&lt;name&gt;</code> to
  1052. &lt;value&gt; without sending out commands to the device, but triggering
  1053. events and eventMap/stateFormat transformations as usual. See the set
  1054. command documentation for replacement description.
  1055. <br><br>
  1056. Examples:
  1057. <ul>
  1058. setreading lamp state on
  1059. </ul>
  1060. Note: setreading won't generate an event for device X, if it is called from a
  1061. notify for device X. Use "sleep 0.1; setreading X Y Z" in this case.
  1062. </ul>
  1063. <a name="setstate"></a>
  1064. <h3>setstate</h3>
  1065. <ul>
  1066. <code>setstate &lt;devspec&gt; &lt;value&gt;</code>
  1067. <br><br>
  1068. Set the STATE entry for the device specified by <code>&lt;devspec&gt;</code>,
  1069. which is used for displaying the device state in different frontends.
  1070. No signals will be sent to the device, no events will be generated, and no
  1071. eventMap or stateFormat translation will be done either.
  1072. This command is also used in the <a href="#statefile">statefile</a>.
  1073. See the <a href="#devspec">Device specification</a> section for details on
  1074. &lt;devspec&gt;.
  1075. <br><br>
  1076. Examples:
  1077. <ul>
  1078. setstate lamp on
  1079. </ul>
  1080. </ul>
  1081. <a name="shutdown"></a>
  1082. <h3>shutdown</h3>
  1083. <ul>
  1084. <code>shutdown [restart|exitValue]</code>
  1085. <br><br>
  1086. Shut down the server (after saving the <a href="#statefile">state information
  1087. </a>). It triggers the global:SHUTDOWN event. If the optional restart
  1088. parameter is specified, FHEM tries to restart itself. exitValue may be
  1089. important for start scripts.
  1090. <br><br>
  1091. Example:
  1092. <ul>
  1093. <code>shutdown</code><br>
  1094. <code>shutdown restart</code><br>
  1095. <code>shutdown 1</code><br>
  1096. </ul>
  1097. </ul>
  1098. <a name="sleep"></a>
  1099. <h3>sleep</h3>
  1100. <ul>
  1101. <code>sleep &lt;sec&gt; [&lt;id&gt;] [quiet]</code>
  1102. <br><br>
  1103. sleep followed by another command is comparable to a nameless <a
  1104. href="#at">at</a>, it executes the following commands after waiting the
  1105. specified time. The unit is seconds, with millisecond accuracy, as you can
  1106. specify decimal places.<br><br>
  1107. A sleep with an &lt;id&lt; will replace a sleep with the same &lt;id&lt;
  1108. and can be canceled by <a href="#cancel">cancel</a>.
  1109. When called in a notify/at/etc, then nonempty return values of the following
  1110. commands are logged to the global logfile with loglevel 2.<br> If quiet is
  1111. specified, then skip this logging.
  1112. <br><br>
  1113. Example:
  1114. <ul>
  1115. define n3 notify btn3.* set lamp on;;sleep 1.5;;set lamp off<br>
  1116. define a3 at +*00:05 set Windsensor 1w_measure;; sleep 2 quiet;; get
  1117. Windsensor 1w_temp
  1118. </ul>
  1119. <br>
  1120. Note: a sleep not followed by any command will block FHEM, is deprecated, and
  1121. it issues a WARNING in the FHEM log.
  1122. <br>
  1123. </ul>
  1124. <a name="trigger"></a>
  1125. <h3>trigger</h3>
  1126. <ul>
  1127. <code>trigger &lt;devspec&gt; &lt;state&gt;</code>
  1128. <br><br>
  1129. Trigger a <a href="#notify">notify</a> definition.
  1130. See the <a href="#devspec">Device specification</a> section for details on
  1131. &lt;devspec&gt;.
  1132. <br><br>
  1133. Example:
  1134. <ul>
  1135. <code>trigger btn3 on</code>
  1136. </ul>
  1137. </ul>
  1138. <!-- commands end - diese Zeile nicht entfernen! -->
  1139. <a name="global"></a>
  1140. <h3>global</h3>
  1141. <ul>
  1142. The global device is used to set different global attributes. It will be
  1143. automatically defined, it cannot be deleted or renamed and has no set or get
  1144. parameters<br>
  1145. <br>
  1146. <b>Define</b><ul>N/A</ul><br>
  1147. <b>Set </b><ul>N/A</ul><br>
  1148. <b>Get</b><ul>N/A</ul><br>
  1149. <b>Attributes</b>
  1150. <ul>
  1151. <li><a href="#archivedir">archivedir</a></li>
  1152. <li><a href="#archivecmd">archivecmd</a></li>
  1153. <li><a href="#nrarchive">nrarchive</a></li><br>
  1154. <a name="autoload_undefined_devices"></a>
  1155. <li>autoload_undefined_devices<br>
  1156. If set, automatically load the corresponding module when a message
  1157. of this type is received. This is used by the <a href="#autocreate">
  1158. autocreate</a> device, to automatically create a FHEM device upon
  1159. receiving a corresponding message.
  1160. </li><br>
  1161. <a name="autosave"></a>
  1162. <li>autosave<br>
  1163. enable some modules to automatically trigger save after a configuration
  1164. change, e.g. after a new device was created. Default is 1 (true), you
  1165. can deactivate this feature by setting the value to 0.
  1166. </li>
  1167. <a name="backupcmd"></a>
  1168. <li>backupcmd<br>
  1169. You could pass the backup to your own command / script by using this attribute.
  1170. If this attribute is specified, then it will be started as a shell command and
  1171. passes a space separated list of files / directories as <strong>one</strong>
  1172. argument to the command, like e.g.:
  1173. <br>
  1174. <ul>
  1175. <code>"/etc/fhem.cfg /var/log/fhem/fhem.save /usr/share/fhem/contrib
  1176. /usr/share/fhem/FHEM /usr/share/fhem/foo /usr/share/fhem/foobar
  1177. /usr/share/fhem/www"</code>
  1178. </ul>
  1179. Note: Your command / script has to return the string "backup done" or
  1180. everything else to report errors, to work properly with update!<br>
  1181. This Attribute is used by the <a href="#backup">backup</a> command.<br>
  1182. Example:<br>
  1183. <ul>
  1184. attr global backupcmd /usr/local/bin/myBackupScript.sh
  1185. </ul>
  1186. </li><br>
  1187. <a name="backupdir"></a>
  1188. <li>backupdir<br>
  1189. A folder to store the compressed backup file.
  1190. This Attribute is used by the <a href="#backup">backup</a> command.<br>
  1191. Example:<br>
  1192. <ul>
  1193. attr global backupdir /Volumes/BigHD
  1194. </ul>
  1195. </li><br>
  1196. <a name="backupsymlink"></a>
  1197. <li>backupsymlink<br>
  1198. If this attribute is set to everything else as "no", the archive
  1199. command tar will support symlinks in your backup. Otherwise, if this
  1200. attribute is set to "no" symlinks are ignored by tar.
  1201. This Attribute is used by the <a href="#backup">backup</a> command.<br>
  1202. Example:<br>
  1203. <ul>
  1204. attr global backupsymlink yes
  1205. </ul>
  1206. </li><br>
  1207. <a name="blockingCallMax"></a>
  1208. <li>blockingCallMax<br>
  1209. Limit the number of parallel running processes started by the
  1210. BlockingCall FHEM helper routine. Useful on limited hardware.
  1211. </li><br>
  1212. <a name="configfile"></a>
  1213. <li>configfile<br>
  1214. Contains the name of the FHEM configuration file. If <a
  1215. href="#save">save</a> is called without argument, then the output will
  1216. be written to this file.
  1217. </li><br>
  1218. <a name="commandref"></a>
  1219. <li>commandref<br>
  1220. If set to "full" (default), then a full commandref will be generated
  1221. after each update. If set to modular, there is only a short description
  1222. at the beginning, and the module documentation is loaded from FHEM
  1223. dynamically.
  1224. </li><br>
  1225. <a name="dnsServer"></a>
  1226. <li>dnsServer<br>
  1227. Contains the IP address of the DNS Server. If some of the modules or
  1228. user code calls the HttpUtils_NonblockingGet function, and this
  1229. attribute is set, then FHEM specific nonblocking code will be used to
  1230. resolve the given address. If this attribute is not set, the blocking
  1231. OS implementation (inet_aton and gethostbyname) will be used.
  1232. </li><br>
  1233. <a name="holiday2we"></a>
  1234. <li>holiday2we<br>
  1235. If this attribute is set, then the <a href="#perl">$we</a> variable
  1236. will be true, if the value of the <a href="#holiday">holiday</a>
  1237. variable referenced by this attribute is not none.<br>
  1238. Example:<br>
  1239. <ul>
  1240. attr global holiday2we hessen
  1241. </ul>
  1242. </li><br>
  1243. <a name="featurelevel"></a>
  1244. <li>featurelevel<br>
  1245. Enable/disable old or new features, based on FHEM version.
  1246. E.g. the $value hash for notify is only set for featurelevel up to 5.6,
  1247. as it is deprecated, use the Value() function instead.
  1248. </li><br>
  1249. <a name="logdir"></a>
  1250. <li>logdir<br>
  1251. If set, the %L attribute in the logfile attribute (or in the FileLog
  1252. modules file definition) is replaced wth the value of the attribute.
  1253. Note: changing the value won't result in moving the files and may cause
  1254. other problems.
  1255. </li><br>
  1256. <a name="logfile"></a>
  1257. <li>logfile<br>
  1258. Specify the logfile to write. You can use "-" for
  1259. stdout, in this case the server won't background itself.<br>
  1260. The logfile name can also take wildcards for easier logfile rotation,
  1261. see the <a href="#FileLog">FileLog</a> section. Just apply the
  1262. <code>archivecmd / archivedir / nrarchive</code> attributes to the
  1263. <code>global</code> device as you would do for a FileLog device.<br>
  1264. You can access the current name of the logfile with
  1265. <code>{ $currlogfile }</code>.
  1266. </li><br>
  1267. <a name="modpath"></a>
  1268. <li>modpath<br>
  1269. Specify the path to the modules directory <code>FHEM</code>. The path
  1270. does <b>not</b> contain the directory FHEM. Upon setting the
  1271. attribute, the directory will be scanned for filenames of the form
  1272. NN_&lt;NAME&gt;.pm, and make them available for device definition under
  1273. &lt;NAME&gt;. If the first device of type &lt;NAME&gt; is defined, the
  1274. module will be loaded, and its function with the name
  1275. &lt;NAME&gt;_Initialize will be called. Exception to this rule are
  1276. modules with NN=99, these are considered to be utility modules
  1277. containing only perl helper functions, they are loaded at startup (i.e.
  1278. modpath attribute definition time).
  1279. </li><br>
  1280. <a name="motd"></a>
  1281. <li>motd<br>
  1282. Message Of The Day. Displayed on the homescreen of the FHEMWEB package,
  1283. or directly after the telnet logon, before displaying the fhem> prompt.
  1284. SecurityCheck is setting motd if it is not defined upon startup, to
  1285. avoid this set the motd value to none. motd is also used to show
  1286. collected error messages upon FHEM start.
  1287. </li><br>
  1288. <a name="mseclog"></a>
  1289. <li>mseclog<br>
  1290. If set, the timestamp in the logfile will contain a millisecond part.
  1291. </li><br>
  1292. <a name="nofork"></a>
  1293. <li>nofork<br>
  1294. If set and the logfile is not "-", do not try to background. Needed on
  1295. some Fritzbox installations, and it will be set automatically for
  1296. Windows.
  1297. </li><br>
  1298. <a name="pidfilename="></a>
  1299. <li>pidfilename<br>
  1300. Write the process id of the perl process to the specified file. The
  1301. server runs as a daemon, and some distributions would like to check by
  1302. the pid if we are still running. The file will be deleted upon
  1303. shutdown.
  1304. </li><br>
  1305. <li><a href="#fheminfo">sendStatistics</a><br>
  1306. <a name="statefile"></a>
  1307. <li>statefile<br>
  1308. Set the filename where the state and certain <a href="#at">at</a>
  1309. information will be saved before shutdown. If it is not specified, then
  1310. no information will be saved.
  1311. </li><br>
  1312. <li><a href="#title">title</a><br>
  1313. <li><a href="#fheminfo">uniqueID</a><br>
  1314. <a name="userattr"></a>
  1315. <li>userattr<br>
  1316. A space separated list which contains the names of additional
  1317. attributes for all devices. Without specifying them you will not be
  1318. able to set them (in order to prevent typos).<br>
  1319. userattr can also specified for other devices, in this case
  1320. these additinal attribute names are only valid for this device.
  1321. </li><br>
  1322. <a name="dupTimeout"></a>
  1323. <li>dupTimeout<br>
  1324. Define the timeout for which 2 identical events from two different
  1325. receiver are considered a duplicate. Default is 0.5 seconds.
  1326. </li><br>
  1327. <a name="showInternalValues"></a>
  1328. <li>showInternalValues<br>
  1329. Show data used for internal computations. If the name of an internal
  1330. value, reading or attribute starts with dot (.), then it is normally
  1331. hidden, and will only be visible, if this attribute is set to 1.
  1332. The attribute is checked by the list command, by the FHEMWEB room
  1333. overview and by xmllist.
  1334. </li><br>
  1335. <a name="sslVersion"></a>
  1336. <li>sslVersion<br>
  1337. Specifies the accepted cryptography algorithms by all modules using the
  1338. TcpServices helper module. The current default TLSv12:!SSLv3 is thought
  1339. to be more secure than the previously used SSLv23:!SSLv3:!SSLv2, but it
  1340. causes problems with some not updated web services.
  1341. </li><br>
  1342. <a name="stacktrace"></a>
  1343. <li>stacktrace<br>
  1344. if set (to 1), dump a stacktrace to the log for each "PERL WARNING".
  1345. </li><br>
  1346. <a name="restartDelay"></a>
  1347. <li>restartDelay<br>
  1348. set the delay for shutdown restart, default is 2 (seconds).
  1349. </li><br>
  1350. </ul>
  1351. <br>
  1352. <b>Events:</b>
  1353. <ul>
  1354. <li>INITIALIZED<br>after initialization is finished.</li>
  1355. <li>REREADCFG<br>after the configuration is reread.</li>
  1356. <li>SAVE<br>before the configuration is saved.</li>
  1357. <li>SHUTDOWN<br>before FHEM is shut down.</li>
  1358. <li>DEFINED &lt;devname&gt;<br>after a device is defined.</li>
  1359. <li>DELETED &lt;devname&gt;<br>after a device was deleted.</li>
  1360. <li>RENAMED &lt;old&gt; &lt;new&gt;<br>after a device was renamed.</li>
  1361. <li>UNDEFINED &lt;defspec&gt;<br>upon reception of a message for an
  1362. undefined device.</li>
  1363. <li>MODIFIED &lt;defspec&gt;</br> after a device modification.</li>
  1364. <li>UPDATE</br> after an update is completed.</li>
  1365. </ul>
  1366. </ul>
  1367. <!-- global end - do not remove this line! -->
  1368. <a name="perl"></a>
  1369. <h3>Perl specials</h3>
  1370. If you want to automate some tasks via FHEM, then you'll probably use <a
  1371. href="#at">at</a> or <a href="#notify">notify</a>. For more complex tasks
  1372. you'll use either a shell-script or a perl "oneliner" as the at/notify
  1373. argument. This chapter gives some tips in using the perl oneliners.<br><br>
  1374. <li>To test the following perl oneliners, type them on the telnet prompt (or
  1375. FHEMWEB text input) by enclosing it in {}, one line at once. The last line
  1376. will only write something in the logfile, the output of the other lines is
  1377. directly visible.
  1378. <ul>
  1379. { "Hello" }<br>
  1380. { 1+3*4 }<br>
  1381. { `ls /etc` }<br>
  1382. { Log 1, "Hello" }<br>
  1383. </ul>
  1384. <br>
  1385. <li>
  1386. Perl expressions are separated by ;, in FHEM oneliners they have to
  1387. escaped with ;;<br>
  1388. <ul>
  1389. { my $a = 1+1;; Log 1, "Hello $a" }
  1390. </ul>
  1391. <br>
  1392. <li>To use FHEM commands from the perl expression, use the function fhem(),
  1393. which takes a string argument, this string will be evaluated as a FHEM
  1394. command:<br>
  1395. <ul>
  1396. { fhem "set light on" }<br>
  1397. define n1 notify piri:on { fhem "set light on" }
  1398. </ul>
  1399. Note: if this function returns a value, it will also be logged into the
  1400. global FHEM log. Use 1 as a second argument to disable this logging, this
  1401. makes sense when obtainig some values via FHEM "get...".
  1402. <br>
  1403. <br>
  1404. <li>Notify can be used to store macros for manual execution. Use the <a
  1405. href="#trigger">trigger</a> command to execute the macro:<br>
  1406. <ul>
  1407. define MyMacro notify MyMacro { Log 1, "Hello"}<br>
  1408. trigger MyMacro<br>
  1409. define MacroWithArg notify MyMacro { Log 1, "Hello %"}<br>
  1410. trigger MyMacro MyArg<br>
  1411. </ul>
  1412. <br>
  1413. <li>To make date and time handling easier, the variables $sec, $min, $hour,
  1414. $mday, $month, $year, $wday, $yday, $isdst are available in the perl
  1415. oneliners (see also perldoc -f localtime). Exceptions: $month is in the
  1416. range of 1 to 12, and $year is corrected by 1900 (as I would expect).
  1417. Additionally the variable $hms contains the time in the HH:MM:SS format.
  1418. <br>
  1419. Additionally the variabe $we is 1 if it is weekend (i.e $wday == 0 or
  1420. $wday == 6), and 0 otherwise. If the <a href="#holiday2we">holida2we</a>
  1421. global attribute is set, $we is 1 for holidays too.<br>
  1422. <ul>
  1423. define n2 notify piri:on { if($hour &gt; 18 || $hour &lt; 5) {
  1424. fhem "set light on" } }<br>
  1425. define roll_en *07:45:00 { fhem "trigger SwitchAllRoll on" if(!$we) }<br>
  1426. define roll_en *08:30:00 { fhem "trigger SwitchAllRoll on" if($we) }<br>
  1427. </ul>
  1428. <br>
  1429. <li>
  1430. The following helper functions are defined in 99_Util.pm (which will
  1431. be loaded automatically, as every module with prefix 99):
  1432. <ul>
  1433. <li>min(a,b), max(a,b)</li>
  1434. <li>time_str2num("YYYY-MM-DD HH:MM:SS") returns a numerical value,
  1435. which makes computation of time differences easier</li>
  1436. <li>abstime2rel("HH:MM:SS") converts an absolute time to a relative one
  1437. </li>
  1438. </ul>
  1439. </li>
  1440. <li>
  1441. To access the device states/attributes, use the following functions:
  1442. <br>
  1443. <ul>
  1444. <li>Value(&lt;devicename&gt;)<br>
  1445. returns the state of the device (the string you see in paranthesis in
  1446. the output of the list command).
  1447. </li><br>
  1448. <li>OldValue(&lt;devicename&gt;)
  1449. <li>OldTimestamp(&lt;devicename&gt;)<br>
  1450. returns the old value/timestamp of the device.
  1451. </li><br>
  1452. <li>
  1453. ReadingsVal(&lt;devicename&gt;,&lt;reading&gt;,&lt;defaultvalue&gt;)<br>
  1454. Return the reading (the value in the Readings section of "list device")
  1455. </li><br>
  1456. <li>
  1457. ReadingsNum(&lt;devicename&gt;,&lt;reading&gt;,&lt;defaultvalue&gt;)<br>
  1458. Return the reading as a number, i.e. delete non-numerical values.
  1459. </li><br>
  1460. <li>
  1461. AttrVal(&lt;devicename&gt;,&lt;attribute&gt;,&lt;defaultvalue&gt;)<br>
  1462. Return the attribute of the device
  1463. <br><br>
  1464. { Value("wz") }<br>
  1465. { OldValue("wz") }<br>
  1466. { time_str2num(OldTimestamp("wz")) }<br>
  1467. { ReadingsVal("wz", "measured-temp", "20")+0 }<br>
  1468. { ReadingsTimestamp("wz", "measured-temp", 0)}<br>
  1469. { AttrVal("wz", "room", "none") }<br>
  1470. </li><br>
  1471. <li>
  1472. InternalVal(&lt;devicename&gt;,&lt;property&gt;,&lt;defaultvalue&gt;)
  1473. <br>
  1474. Return the internal value (the value in the Internals section of "list
  1475. device").
  1476. </li><br>
  1477. </ul>
  1478. <li>
  1479. By using the 99_SUNRISE_EL.pm module, you have access to the following
  1480. functions: <br>
  1481. <ul>
  1482. sunset($offset, $min, $max)<br>
  1483. sunrise($offset, $min, $max)<br>
  1484. isday()<br>
  1485. </ul>
  1486. offset is in seconds, and the format of min/max is "HH:MM" or "HH:MM:SS".
  1487. isday returns 1 if the sun is visible, and 0 else.
  1488. </li>
  1489. <br>
  1490. <br>
  1491. <!-- perl end - diese Zeile nicht entfernen! -->
  1492. <a name="gnuplot-syntax"></a>
  1493. <h3>gnuplot file syntax</h3>
  1494. The .gplot files are also used by the <a href="#FHEMWEB">FHEMWEB</a>/SVG module
  1495. when the <a href="#plotmode">plotmode</a> attribute is set to SVG. In this case
  1496. only a subset of the .gnuplot attributes are used, and some lines have special
  1497. meanings: the difference will be explained in this chapter. See also <a
  1498. href="http://wiki.fhem.de/wiki/Creating_Plots">this</a> FHEM Wiki entry on
  1499. creating logs.<br>
  1500. Following is a minimal .gplot definition (valid only for plotmode SVG):<br>
  1501. <pre>
  1502. set terminal size &lt;SIZE&gt;
  1503. #FileLog 4:::
  1504. plot title 'Temperature' with lines
  1505. </pre>
  1506. The .gnuplot file consists of 3 parts:
  1507. <ul>
  1508. <li>set commands<br>
  1509. Following sets are recognized:
  1510. <ul>
  1511. <li>terminal, only the size parameter.<br>
  1512. This is usually set to &lt;SIZE&gt;, which is replaced by the <a
  1513. href="#plotsize">plotsize</a> attribute of the FHEMWEB or weblink
  1514. instance.</li>
  1515. <li>title<br>
  1516. Usually set to &lt;TL&gt; which is replace by the weblink <a
  1517. href="#title">title</a> attribute, or to &lt;Lx&gt;, which is replaced
  1518. by the weblink <a href="#label">label</a> attribute.</li>
  1519. <li>ylabel,y2label<br>
  1520. Left and right labels, printed vertically. Are also subject to label
  1521. replacement.</li>
  1522. <li>yrange,y2range<br>
  1523. Specify the range of the left and right axis. Examples:<br>
  1524. <ul>
  1525. set yrange [-0.1:1.1]<br>
  1526. set y2range [0:]<br>
  1527. </ul>
  1528. </li>
  1529. <li>ytics,y2tics<br>
  1530. the label for the left/right axis tics. Examples:<br>
  1531. <ul>
  1532. set ytics ("on" 0, "off" 1)<br>
  1533. set y2tics<br>
  1534. </ul>
  1535. </li>
  1536. </ul>
  1537. </li>
  1538. <br>
  1539. <li>#FileLog entries<br>
  1540. Each line from the plot section must have one corresponding #FileLog
  1541. line. For the syntax see the column_spec paragraph of the <a
  1542. href="#FileLogget">Filelog get</a> description.
  1543. Note that for SVG plots the first column of the input file always has to
  1544. be in the standard fhem timestamp format (YYYY-MM-DD_HH:MM:SS)
  1545. </li>
  1546. <br>
  1547. <li>plot entries<br>
  1548. There is always one plot command with comma separated argument-blocks.
  1549. Each argument-block represents one line, and has its own parameters.
  1550. Following parameters are recognized:
  1551. <ul>
  1552. <li>axes x1y1 / x1y2<br>
  1553. tells the program to assign the current line to one of the two axes
  1554. (left or right).
  1555. </li>
  1556. <li>title<br>
  1557. Caption of the line. Whan clicking on this title, a small javascript
  1558. program will change the title to the min/max and last values of the plot,
  1559. will enable copying this line or pasting an already copied one (the
  1560. existing scale of the plot wont'be changed, only the pasted line will
  1561. be scaled), and other lines of the plot will temporarily be hidden.
  1562. </li>
  1563. <li>with &lt;linetype&gt;<br>
  1564. Specify the line type. Following types are recognized: points,
  1565. steps, fsteps, histeps and lines. Everything unknown will be mapped to
  1566. the type lines.
  1567. SVG special: cubic and quadratic, are mapped to the SVG path types C,
  1568. and Q respectively.
  1569. </li>
  1570. <li>ls &lt;linestyle&gt;<br>
  1571. The linestyle defaults to l0 for the first line, l1 for the second, and
  1572. so on. It is defined in the svg_style.css file. There are two sets
  1573. defined here: l0-l8 and l0fill-l6fill. The second set must be specified
  1574. explicitly. If the name of the linestyle contains the word fill, then
  1575. plots of the lineytype "lines" will have an additional starting and
  1576. ending segment, so that filling is done correctly.<br>
  1577. See the SVG spec for details of this CSS file.
  1578. Note: if you plan to use this attribute, you have to specify it for all
  1579. the lines (attribute-blocks) in the plot command.
  1580. </li>
  1581. <li>lw &lt;linewidth&gt;<br>
  1582. Sets the stroke-width style of the line. This attribute is deprecated,
  1583. the corresponding feature of the CSS file / (attribute ls) should be
  1584. used instead.
  1585. </li>
  1586. </ul>
  1587. </ul>
  1588. </li>
  1589. </div> <!-- right -->
  1590. </body>
  1591. </html>