commandref_frame.html 74 KB

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