commandref_frame.html 74 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953
  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 &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|off|timer|raw} [regexp]</code> <br>
  808. <br>
  809. If set to on, and a device state changes, send a notification to the current
  810. client. This command can be used by other programs/modules to receive a
  811. notification.<br>
  812. The option timer prepends a timerstamp to the line. Note: this command is
  813. a nice way to check which events are generated, to help you when creating
  814. <a href="#notify">notify</a> or <a href="#FileLog">FileLog</a> entries.
  815. <br>
  816. </ul>
  817. <!-- inform end -->
  818. <a name="list"></a>
  819. <h3>list</h3>
  820. <ul>
  821. <code>list [devspec] [value]</code><br>
  822. or<br>
  823. <code>list {-r|-R} devspec</code><br>
  824. <br><br>
  825. Output a list of all definitions, all notify settings and all at
  826. entries. This is one of the few commands which return a string in a
  827. normal case.
  828. See the <a href="#devspec">Device specification</a> section for details on
  829. &lt;devspec&gt;.
  830. <br>
  831. If value is specified, then output this property (like DEF, TYPE, etc) or
  832. reading (actuator, measured-temp) for all devices from the devspec.
  833. <br><br>
  834. Example:
  835. <pre><code> fhem> list
  836. Type list <name> for detailed info.
  837. Internal:
  838. global (Internal)
  839. FHZ:
  840. FHZ (fhtbuf: 23)
  841. FS20:
  842. Btn4 (on-old-for-timer)
  843. Roll1 (on)
  844. Stehlampe (off)
  845. FHT:
  846. fl (measured-temp: 21.1 (Celsius))
  847. KS300:
  848. out1 (T: 2.9 H: 74 W: 2.2 R: 8.2 IR: no)
  849. at:
  850. at_rollup (Next: 07:00:00)
  851. notify:
  852. ntfy_btn4 (active)
  853. FileLog:
  854. avglog (active)
  855. </code></pre>
  856. If specifying <code>name</code>, then a detailed status for <code>name</code>
  857. will be displayed, e.g.:
  858. <pre><code> fhem> list fl
  859. Internals:
  860. CODE 5102
  861. DEF 5102
  862. NAME fl
  863. NR 15
  864. STATE measured-temp: 21.1 (Celsius)
  865. TYPE FHT
  866. IODev FHZ
  867. Attributes:
  868. room Heizung
  869. Readings:
  870. 2006-11-02 09:45:56 actuator 19%
  871. [...]
  872. </code></pre>
  873. With the -r (raw) option output the device definition in a format suitable
  874. for inclusion in fhem.cfg and fhem.state. -R returns the definition of the
  875. device itself, together with the definition of probably associated devices.
  876. Note: the algorithm to select associated devices is known to be imperfect.
  877. </ul>
  878. <!-- list end -->
  879. <a name="modify"></a>
  880. <h3>modify</h3>
  881. <ul>
  882. <code>modify &lt;name&gt; &lt;type-dependent-options&gt;</code>
  883. <br><br>
  884. Used to modify some definitions. Useful for changing some <a
  885. href="#at">at</a> or <a href="#notify">notify</a> definitions. If specifying
  886. one argument to an at type definition, only the time part will be changed. In
  887. case of a notify type definition, only the regex part will be changed. All
  888. other values (state, attributes, etc) will remain intact.
  889. After modify, the global event "MODIFIED" will be generated.
  890. <br><br>
  891. Example:
  892. <ul>
  893. <code>define lampon at 19:00 set lamp on</code><br>
  894. <code>modify lampon *19:00</code><br>
  895. <code>modify lampon 19:00 set lamp on-for-timer 16</code><br>
  896. </ul>
  897. </ul>
  898. <!-- modify end -->
  899. <a name="quit"></a>
  900. <h3>quit</h3>
  901. <ul>
  902. <code>quit</code>
  903. <br><br>
  904. If used in a TCP/IP session, terminate the client session.<br>
  905. If used in a script, terminate the parsing of the current script.
  906. <br><br>
  907. Example:
  908. <ul>
  909. <code>quit</code>
  910. </ul>
  911. </ul>
  912. <!-- quit end -->
  913. <a name="reload"></a>
  914. <h3>reload</h3>
  915. <ul>
  916. <code>reload &lt;module&gt;</code>
  917. <br><br>
  918. Reload the given module from the module directory. It is a convenient way to
  919. test modules whithout restarting the program.
  920. <br><br>
  921. Example:
  922. <ul>
  923. <code>reload 99_PRIV</code>
  924. </ul>
  925. </ul>
  926. <!-- reload end -->
  927. <a name="rename"></a>
  928. <h3>rename</h3>
  929. <ul>
  930. <code>rename &lt;oldname&gt; &lt;newname&gt;</code>
  931. <br><br>
  932. Rename a device from the &lt;oldname&gt; to &lt;newname&gt;, together with
  933. its attributes. The global event RENAMED will be generated, see the notify
  934. section for details.
  935. <br><br>
  936. Example:
  937. <ul>
  938. <code>rename FHT_1234 fht.kitchen</code>
  939. </ul>
  940. </ul>
  941. <!-- rename end -->
  942. <a name="rereadcfg"></a>
  943. <h3>rereadcfg</h3>
  944. <ul>
  945. <code>rereadcfg [fhem-config-file]</code>
  946. <br><br>
  947. Re-read the active configuration file, or the optionally specified file.<br>
  948. The sequence: the <a href="#statefile">statefile</a> will be saved first,
  949. then all devices will be deleted, then the currently active config file (or
  950. the specified file) will be read and at last the statefile will be
  951. reloaded.<br>
  952. Upon completion it triggers the global:REREADCFG event. All existing
  953. connections up to the one issuing the rereadcfg will be closed.
  954. <br><br>
  955. Example:
  956. <ul>
  957. <code>rereadcfg</code>
  958. </ul>
  959. </ul>
  960. <!-- rereadcfg end -->
  961. <a name="save"></a>
  962. <h3>save</h3>
  963. <ul>
  964. <code>save [&lt;configfile&gt;]</code>
  965. <br><br>
  966. Save first the <a href="#statefile">statefile</a>, then the
  967. <a href="#configfile">configfile</a> information. If a parameter is specified,
  968. it will be used instead the global configfile attribute.<br><br>
  969. Notes:
  970. <ul>
  971. <li>save only writes out definitions and attributes, but no (set/get)
  972. commands which were previously part of the config file. If you need such
  973. commands after the initialization (e.g. <a href="#FHZset">FHTcode</a>), you
  974. should trigger them via <a href="#notify">notify</a>, when receiving the
  975. INITIALIZED event.</li>
  976. <li>save tries to preserve comments (lines starting with #) and include
  977. structures, but it won't work correctly if some of these files are not
  978. writeable.</li>
  979. <li>before overwriting the files, the old version will be saved, see the <a
  980. href="#restoreDirs">restoreDirs</a> global attribute for details.
  981. </ul>
  982. </ul>
  983. <!-- save end -->
  984. <a name="set"></a>
  985. <h3>set</h3>
  986. <ul>
  987. <code>set &lt;devspec&gt; &lt;type-specific&gt;</code>
  988. <br><br>
  989. Set parameters of a device / send signals to a device. You can
  990. get a list of possible parameters by
  991. <ul>
  992. <code>set &lt;name&gt; ?</code>
  993. </ul>
  994. See the <a href="#devspec">Device specification</a> section for details on
  995. &lt;devspec&gt;. The set command returns only a value on error.<br>
  996. <br>
  997. Each device has different set parameters, see the corresponding device
  998. section for details.<br>
  999. <br><br>
  1000. From featurelevel 5.7 on the set and setreading command replaces:
  1001. <ul>
  1002. <li>[device:name] with the reading, internal or attribute of the device, if
  1003. both device and the reading, internal or attribute exists.
  1004. <ul>
  1005. <li>You can use the r:, i: or a: prefix to restrict the search to one
  1006. type, analogue to the devspec filtering.</li>
  1007. <li>The suffix :d retrieves the first number</li>
  1008. <li>The suffix :i retrieves the integer part of the first number.</li>
  1009. <li>The suffix :r&lt;n&gt; retrieves the first number and rounds it to
  1010. &lt;n&gt; decimal places. If &lt;n&gt; is missing, then rounds it to
  1011. one decimal place.</li>
  1012. <li>The suffix :t returns the timestamp (works only for readings)</li>
  1013. <li>The suffix :sec returns the number of seconds since the reading was
  1014. set.</li>
  1015. </ul>
  1016. Example:
  1017. <ul>
  1018. set Lamp blink [blinkDummy:number] [r:blinkDummy:duration:d]
  1019. </ul>
  1020. </li>
  1021. <li>[device:name:d] same as above, but only the number is retrieved</li>
  1022. <li>[device:name:sec] same as above, but only the number is retrieved</li>
  1023. <li>{(perlExpression)} with the result of perlExpression.
  1024. The $DEV variable is additionally available, designating the set device
  1025. name.
  1026. </li>
  1027. </ul>
  1028. These replacements are also known as "set magic".
  1029. <br><br>
  1030. <a name="setExtensions"></a>
  1031. Some modules support a common list of <b>set extensions</b>, and point in
  1032. their documentation to this section. If the module itself implements one of
  1033. the following commands, then the module-implementation takes precedence.
  1034. <ul>
  1035. <li>on-for-timer &lt;seconds&gt<br>
  1036. Issue the on command for the device, and after &lt;seconds&gt; the off
  1037. command. For issuing the off command an internal timer will be
  1038. scheduled, which is deleted upon a restart. To delete this internal
  1039. timer without restart specify 0 as argument.</li>
  1040. <li>off-for-timer &lt;seconds&gt<br>
  1041. see on-for-timer above.</li>
  1042. <li>on-till &lt;timedet&gt<br>
  1043. Issue the on command for the device, and create an at definition with
  1044. &lt;timedet&gt; (in the form HH:MM[:SS]) to set it off. This definition
  1045. is visible, and its name is deviceName+"_till". To cancel the scheduled
  1046. off, delete the at definition. Note: on-till is not active, if the
  1047. specified time is after the current time, in order to make things like
  1048. <ul><code>
  1049. define morningLight at *06:00 set Lamp on-till {sunrise()}
  1050. </code></ul>
  1051. easy.</li>
  1052. <li>on-till-overnight &lt;timedet&gt<br>
  1053. Like on-till, but wont compare the current time with the timespec, so
  1054. following will work:
  1055. <ul><code>
  1056. define nightLight at *{sunset()} set Lamp on-till-overnight 01:00
  1057. </code></ul>
  1058. </li>
  1059. <li>off-till &lt;timedet&gt<br>
  1060. see on-till above.</li>
  1061. <li>off-till-overnight &lt;timedet&gt<br>
  1062. see on-till-overnight above.</li>
  1063. <li>blink &lt;number&gt; &lt;blink-period&gt;<br>
  1064. set the device on for &lt;blink-period&gt; then off for
  1065. &lt;blink-period&gt; and repeat this &lt;number&gt; times.
  1066. To stop blinking specify "0 0" as argument.</li>
  1067. <li>intervals &lt;from1&gt;-&lt;till1&gt; &lt;from2&gt;-&lt;till2&gt;...
  1068. </br>
  1069. set the device on for the specified intervals, which are all timespecs
  1070. in the form HH:MM[:SS]. The intervals are space separated.</li>
  1071. <li>toggle<br>
  1072. Issue the off command, if the current STATE is on, else the on command.
  1073. dim XX is also interpreted as on, if XX is not 0.</li>
  1074. </ul>
  1075. Examples:
  1076. <ul>
  1077. <code>
  1078. set switch on-for-timer 12.5<br>
  1079. set switch on-till {sunset()}<br>
  1080. set switch blink 3 1<br>
  1081. set switch intervals 08:00-12:00 13:00-18:00<br>
  1082. </code>
  1083. </ul>
  1084. </ul>
  1085. <!-- set end -->
  1086. <a name="setdefaultattr"></a>
  1087. <h3>setdefaultattr</h3>
  1088. <ul>
  1089. <code>setdefaultattr [&lt;attrname&gt; [&lt;value&gt;]] </code><br>
  1090. <br>Add a default attribute. Each device defined from now on will receive
  1091. this attribute.<br> If no attrname is specified, then the default attribute
  1092. list will be deleted.
  1093. <br><br>
  1094. Example to set the attribute "room kitchen" and "loglevel 4" to
  1095. each of the lamps:
  1096. <ul>
  1097. <code>setdefaultattr room kitchen</code><br>
  1098. <code>setdefaultattr loglevel 4</code><br>
  1099. <code>define lamp1 FS20 1234 11</code><br>
  1100. <code>define lamp2 FS20 1234 12</code><br>
  1101. <code>define lamp3 FS20 1234 13</code><br>
  1102. <code>setdefaultattr</code><br>
  1103. </ul>
  1104. <br>
  1105. Notes:<br>
  1106. <ul>
  1107. <li>There is no way to delete a single default-attribute from the list</li>
  1108. </ul>
  1109. </ul>
  1110. <!-- setdefaultattr end -->
  1111. <a name="setreading"></a>
  1112. <h3>setreading</h3>
  1113. <ul>
  1114. <code>setreading &lt;devspec&gt; &lt;reading&gt; &lt;value&gt;</code>
  1115. <br><br>
  1116. Set the reading &lt;reading&gt; for the device <code>&lt;name&gt;</code> to
  1117. &lt;value&gt; without sending out commands to the device, but triggering
  1118. events and eventMap/stateFormat transformations as usual. See the set
  1119. command documentation for replacement description.
  1120. <br><br>
  1121. Examples:
  1122. <ul>
  1123. setreading lamp state on
  1124. </ul>
  1125. Note: setreading won't generate an event for device X, if it is called from a
  1126. notify for device X. Use "sleep 0.1; setreading X Y Z" in this case.
  1127. </ul>
  1128. <!-- setreading end -->
  1129. <a name="setstate"></a>
  1130. <h3>setstate</h3>
  1131. <ul>
  1132. <code>setstate &lt;devspec&gt; &lt;value&gt;</code>
  1133. <br><br>
  1134. Set the STATE entry for the device specified by <code>&lt;devspec&gt;</code>,
  1135. which is used for displaying the device state in different frontends.
  1136. No signals will be sent to the device, no events will be generated, and no
  1137. eventMap or stateFormat translation will be done either.
  1138. This command is also used in the <a href="#statefile">statefile</a>.
  1139. See the <a href="#devspec">Device specification</a> section for details on
  1140. &lt;devspec&gt;.
  1141. <br><br>
  1142. Examples:
  1143. <ul>
  1144. setstate lamp on
  1145. </ul>
  1146. </ul>
  1147. <!-- setstate end -->
  1148. <a name="shutdown"></a>
  1149. <h3>shutdown</h3>
  1150. <ul>
  1151. <code>shutdown [restart|exitValue]</code>
  1152. <br><br>
  1153. Shut down the server (after saving the <a href="#statefile">state information
  1154. </a>). It triggers the global:SHUTDOWN event. If the optional restart
  1155. parameter is specified, FHEM tries to restart itself. exitValue may be
  1156. important for start scripts.
  1157. <br><br>
  1158. Example:
  1159. <ul>
  1160. <code>shutdown</code><br>
  1161. <code>shutdown restart</code><br>
  1162. <code>shutdown 1</code><br>
  1163. </ul>
  1164. </ul>
  1165. <!-- shutdown end -->
  1166. <a name="sleep"></a>
  1167. <h3>sleep</h3>
  1168. <ul>
  1169. <code>sleep &lt;sec&gt; [&lt;id&gt;] [quiet]</code>
  1170. <br><br>
  1171. sleep followed by another command is comparable to a nameless <a
  1172. href="#at">at</a>, it executes the following commands after waiting the
  1173. specified time. The unit is seconds, with millisecond accuracy, as you can
  1174. specify decimal places.<br><br>
  1175. A sleep with an &lt;id&gt; will replace a sleep with the same &lt;id&gt;
  1176. and can be canceled by <a href="#cancel">cancel</a>.
  1177. When called in a notify/at/etc, then nonempty return values of the following
  1178. commands are logged to the global logfile with loglevel 2.<br> If quiet is
  1179. specified, then skip this logging.
  1180. <br><br>
  1181. Example:
  1182. <ul>
  1183. define n3 notify btn3.* set lamp on;;sleep 1.5;;set lamp off<br>
  1184. define a3 at +*00:05 set Windsensor 1w_measure;; sleep 2 quiet;; get
  1185. Windsensor 1w_temp
  1186. </ul>
  1187. <br>
  1188. Note: a sleep not followed by any command will block FHEM, is deprecated, and
  1189. it issues a WARNING in the FHEM log.
  1190. <br>
  1191. </ul>
  1192. <!-- sleep end -->
  1193. <a name="trigger"></a>
  1194. <h3>trigger</h3>
  1195. <ul>
  1196. <code>trigger &lt;devspec&gt; &lt;state&gt;</code>
  1197. <br><br>
  1198. Trigger a <a href="#notify">notify</a> definition.
  1199. See the <a href="#devspec">Device specification</a> section for details on
  1200. &lt;devspec&gt;.
  1201. <br><br>
  1202. Example:
  1203. <ul>
  1204. <code>trigger btn3 on</code>
  1205. </ul>
  1206. </ul>
  1207. <!-- trigger end -->
  1208. <!-- commands end - diese Zeile nicht entfernen! -->
  1209. <a name="global"></a>
  1210. <h3>global</h3>
  1211. <ul>
  1212. The global device is used to set different global attributes. It will be
  1213. automatically defined, it cannot be deleted or renamed and has no set or get
  1214. parameters<br>
  1215. <br>
  1216. <b>Define</b><ul>N/A</ul><br>
  1217. <b>Set </b><ul>N/A</ul><br>
  1218. <b>Get</b><ul>N/A</ul><br>
  1219. <b>Attributes</b>
  1220. <ul>
  1221. <li><a href="#archivedir">archivedir</a></li>
  1222. <li><a href="#archivecmd">archivecmd</a></li>
  1223. <li><a href="#nrarchive">nrarchive</a></li>
  1224. <a name="archivesort"></a>
  1225. <li>archivesort<br>
  1226. archivesort may be set to the (default) alphanum or timestamp, and
  1227. specifies how the last files are computed for the nrarchive attribute.
  1228. </li><br>
  1229. <a name="autoload_undefined_devices"></a>
  1230. <li>autoload_undefined_devices<br>
  1231. If set, automatically load the corresponding module when a message
  1232. of this type is received. This is used by the <a href="#autocreate">
  1233. autocreate</a> device, to automatically create a FHEM device upon
  1234. receiving a corresponding message.
  1235. </li><br>
  1236. <a name="autosave"></a>
  1237. <li>autosave<br>
  1238. enable some modules to automatically trigger save after a configuration
  1239. change, e.g. after a new device was created. Default is 1 (true), you
  1240. can deactivate this feature by setting the value to 0.
  1241. </li>
  1242. <a name="backupcmd"></a>
  1243. <li>backupcmd<br>
  1244. You could pass the backup to your own command / script by using this attribute.
  1245. If this attribute is specified, then it will be started as a shell command and
  1246. passes a space separated list of files / directories as <strong>one</strong>
  1247. argument to the command, like e.g.:
  1248. <br>
  1249. <ul>
  1250. <code>"/etc/fhem.cfg /var/log/fhem/fhem.save /usr/share/fhem/contrib
  1251. /usr/share/fhem/FHEM /usr/share/fhem/foo /usr/share/fhem/foobar
  1252. /usr/share/fhem/www"</code>
  1253. </ul>
  1254. Note: Your command / script has to return the string "backup done" or
  1255. everything else to report errors, to work properly with update!<br>
  1256. This Attribute is used by the <a href="#backup">backup</a> command.<br>
  1257. Example:<br>
  1258. <ul>
  1259. attr global backupcmd /usr/local/bin/myBackupScript.sh
  1260. </ul>
  1261. </li><br>
  1262. <a name="backupdir"></a>
  1263. <li>backupdir<br>
  1264. A folder to store the compressed backup file.
  1265. This Attribute is used by the <a href="#backup">backup</a> command.<br>
  1266. Example:<br>
  1267. <ul>
  1268. attr global backupdir /Volumes/BigHD
  1269. </ul>
  1270. </li><br>
  1271. <a name="backupsymlink"></a>
  1272. <li>backupsymlink<br>
  1273. If this attribute is set to everything else as "no", the archive
  1274. command tar will support symlinks in your backup. Otherwise, if this
  1275. attribute is set to "no" symlinks are ignored by tar.
  1276. This Attribute is used by the <a href="#backup">backup</a> command.<br>
  1277. Example:<br>
  1278. <ul>
  1279. attr global backupsymlink yes
  1280. </ul>
  1281. </li><br>
  1282. <a name="blockingCallMax"></a>
  1283. <li>blockingCallMax<br>
  1284. Limit the number of parallel running processes started by the
  1285. BlockingCall FHEM helper routine. Useful on limited hardware.
  1286. </li><br>
  1287. <a name="configfile"></a>
  1288. <li>configfile<br>
  1289. Contains the name of the FHEM configuration file. If <a
  1290. href="#save">save</a> is called without argument, then the output will
  1291. be written to this file.
  1292. </li><br>
  1293. <a name="commandref"></a>
  1294. <li>commandref<br>
  1295. If set to "full" (default), then a full commandref will be generated
  1296. after each update. If set to modular, there is only a short description
  1297. at the beginning, and the module documentation is loaded from FHEM
  1298. dynamically.
  1299. </li><br>
  1300. <a name="dnsHostsFile"></a>
  1301. <li>dnsHostsFile<br>
  1302. If dnsServer is set, check the contents of the file specified as
  1303. argument. To use the system hosts file, set it to /etc/hosts on
  1304. Linux/Unix/OSX and C:\windows\system32\drivers\etc\hosts on Windows.
  1305. Note: only IPv4 is supported.
  1306. </li><br>
  1307. <a name="dnsServer"></a>
  1308. <li>dnsServer<br>
  1309. Contains the IP address of the DNS Server. If some of the modules or
  1310. user code calls the HttpUtils_NonblockingGet function, and this
  1311. attribute is set, then FHEM specific nonblocking code will be used to
  1312. resolve the given address. If this attribute is not set, the blocking
  1313. OS implementation (inet_aton and gethostbyname) will be used.
  1314. </li><br>
  1315. <a name="featurelevel"></a>
  1316. <li>featurelevel<br>
  1317. Enable/disable old or new features, based on FHEM version.
  1318. E.g. the $value hash for notify is only set for featurelevel up to 5.6,
  1319. as it is deprecated, use the Value() function instead.
  1320. </li><br>
  1321. <a name="holiday2we"></a>
  1322. <li>holiday2we<br>
  1323. If this attribute is set, then the <a href="#perl">$we</a> variable
  1324. will be true, if the value of the <a href="#holiday">holiday</a>
  1325. variable referenced by this attribute is not none.<br>
  1326. If it is a comma separated list, then it is true, if one of the
  1327. referenced entities is not none.<br>
  1328. Example:<br>
  1329. <ul>
  1330. attr global holiday2we he
  1331. </ul>
  1332. </li><br>
  1333. <a name="httpcompress"></a>
  1334. <li>httpcompress<br>
  1335. the HttpUtils module is used by a lot of FHEM modules, and enables
  1336. compression by default. Set httpcompress to 0 to disable this feature.
  1337. </li><br>
  1338. <a name="logdir"></a>
  1339. <li>logdir<br>
  1340. If set, the %L attribute in the logfile attribute (or in the FileLog
  1341. modules file definition) is replaced wth the value of the attribute.
  1342. Note: changing the value won't result in moving the files and may cause
  1343. other problems.
  1344. </li><br>
  1345. <a name="logfile"></a>
  1346. <li>logfile<br>
  1347. Specify the logfile to write. You can use "-" for
  1348. stdout, in this case the server won't background itself.<br>
  1349. The logfile name can also take wildcards for easier logfile rotation,
  1350. see the <a href="#FileLog">FileLog</a> section. Just apply the
  1351. <code>archivecmd / archivedir / nrarchive</code> attributes to the
  1352. <code>global</code> device as you would do for a FileLog device.<br>
  1353. You can access the current name of the logfile with
  1354. <code>{ $currlogfile }</code>.
  1355. </li><br>
  1356. <a name="modpath"></a>
  1357. <li>modpath<br>
  1358. Specify the path to the modules directory <code>FHEM</code>. The path
  1359. does <b>not</b> contain the directory FHEM. Upon setting the
  1360. attribute, the directory will be scanned for filenames of the form
  1361. NN_&lt;NAME&gt;.pm, and make them available for device definition under
  1362. &lt;NAME&gt;. If the first device of type &lt;NAME&gt; is defined, the
  1363. module will be loaded, and its function with the name
  1364. &lt;NAME&gt;_Initialize will be called. Exception to this rule are
  1365. modules with NN=99, these are considered to be utility modules
  1366. containing only perl helper functions, they are loaded at startup (i.e.
  1367. modpath attribute definition time).
  1368. </li><br>
  1369. <a name="motd"></a>
  1370. <li>motd<br>
  1371. Message Of The Day. Displayed on the homescreen of the FHEMWEB package,
  1372. or directly after the telnet logon, before displaying the fhem> prompt.
  1373. SecurityCheck is setting motd if it is not defined upon startup, to
  1374. avoid this set the motd value to none. motd is also used to show
  1375. collected error messages upon FHEM start.
  1376. </li><br>
  1377. <a name="mseclog"></a>
  1378. <li>mseclog<br>
  1379. If set, the timestamp in the logfile will contain a millisecond part.
  1380. </li><br>
  1381. <a name="nofork"></a>
  1382. <li>nofork<br>
  1383. If set and the logfile is not "-", do not try to background. Needed on
  1384. some Fritzbox installations, and it will be set automatically for
  1385. Windows.
  1386. </li><br>
  1387. <a name="pidfilename"></a>
  1388. <li>pidfilename<br>
  1389. Write the process id of the perl process to the specified file. The
  1390. server runs as a daemon, and some distributions would like to check by
  1391. the pid if we are still running. The file will be deleted upon
  1392. shutdown.
  1393. </li><br>
  1394. <a name="proxy"></a>
  1395. <li>proxy<br>
  1396. IP:PORT of the proxy server to be used by HttpUtils.
  1397. </li><br>
  1398. <a name="proxyAuth"></a>
  1399. <li>proxyAuth<br>
  1400. Base64 encoded username:password
  1401. </li><br>
  1402. <a name="proxyExclude"></a>
  1403. <li>proxyExclude<br>
  1404. regexp for hosts to exclude when using a proxy
  1405. </li><br>
  1406. <a name="restoreDirs"></a>
  1407. <li>restoreDirs<br>
  1408. update saves each file before overwriting it with the new version from
  1409. the Web. For this purpose update creates a directory restoreDir in the
  1410. global modpath directory, then a subdirectory with the current date,
  1411. where the old version of the currently replaced file is stored.
  1412. The default value of this attribute is 3, meaning that 3 old versions
  1413. (i.e. date-directories) are kept, and the older ones are deleted.<br>
  1414. fhem.cfg and fhem.state will be also copied with this method before
  1415. executing save. To restore the files, you can use the restore FHEM
  1416. command.<br>
  1417. <br>If the attribute is set to 0, the feature is deactivated.
  1418. </li><br>
  1419. <li><a href="#fheminfo">sendStatistics</a><br>
  1420. <a name="statefile"></a>
  1421. <li>statefile<br>
  1422. Set the filename where the state and certain <a href="#at">at</a>
  1423. information will be saved before shutdown. If it is not specified, then
  1424. no information will be saved.
  1425. </li><br>
  1426. <li><a href="#title">title</a><br>
  1427. <li><a href="#fheminfo">uniqueID</a><br>
  1428. <a name="useInet6"></a>
  1429. <li>useInet6<br>
  1430. try to use IPv6 in HttpUtils for communication. If the server does not
  1431. have an IPv6 address, fall back to IPv4. Note: IO::Socket::INET6 is
  1432. required.
  1433. </li><br>
  1434. <a name="userattr"></a>
  1435. <li>userattr<br>
  1436. A space separated list which contains the names of additional
  1437. attributes for all devices. Without specifying them you will not be
  1438. able to set them (in order to prevent typos).<br>
  1439. userattr can also specified for other devices, in this case
  1440. these additinal attribute names are only valid for this device.
  1441. </li><br>
  1442. <a name="dupTimeout"></a>
  1443. <li>dupTimeout<br>
  1444. Define the timeout for which 2 identical events from two different
  1445. receiver are considered a duplicate. Default is 0.5 seconds.
  1446. </li><br>
  1447. <a name="showInternalValues"></a>
  1448. <li>showInternalValues<br>
  1449. Show data used for internal computations. If the name of an internal
  1450. value, reading or attribute starts with dot (.), then it is normally
  1451. hidden, and will only be visible, if this attribute is set to 1.
  1452. The attribute is checked by the list command, by the FHEMWEB room
  1453. overview and by xmllist.
  1454. </li><br>
  1455. <a name="sslVersion"></a>
  1456. <li>sslVersion<br>
  1457. Specifies the accepted cryptography algorithms by all modules using the
  1458. TcpServices helper module. The current default TLSv12:!SSLv3 is thought
  1459. to be more secure than the previously used SSLv23:!SSLv3:!SSLv2, but it
  1460. causes problems with some not updated web services.
  1461. </li><br>
  1462. <a name="stacktrace"></a>
  1463. <li>stacktrace<br>
  1464. if set (to 1), dump a stacktrace to the log for each "PERL WARNING".
  1465. </li><br>
  1466. <a name="restartDelay"></a>
  1467. <li>restartDelay<br>
  1468. set the delay for shutdown restart, default is 2 (seconds).
  1469. </li><br>
  1470. </ul>
  1471. <br>
  1472. <b>Events:</b>
  1473. <ul>
  1474. <li>INITIALIZED<br>after initialization is finished.</li>
  1475. <li>REREADCFG<br>after the configuration is reread.</li>
  1476. <li>SAVE<br>before the configuration is saved.</li>
  1477. <li>SHUTDOWN<br>before FHEM is shut down.</li>
  1478. <li>DEFINED &lt;devname&gt;<br>after a device is defined.</li>
  1479. <li>DELETED &lt;devname&gt;<br>after a device was deleted.</li>
  1480. <li>RENAMED &lt;old&gt; &lt;new&gt;<br>after a device was renamed.</li>
  1481. <li>UNDEFINED &lt;defspec&gt;<br>upon reception of a message for an
  1482. undefined device.</li>
  1483. <li>MODIFIED &lt;defspec&gt;</br> after a device modification.</li>
  1484. <li>UPDATE</br> after an update is completed.</li>
  1485. </ul>
  1486. </ul>
  1487. <!-- global end - do not remove this line! -->
  1488. <a name="perl"></a>
  1489. <h3>Perl specials</h3>
  1490. If you want to automate some tasks via FHEM, then you'll probably use <a
  1491. href="#at">at</a> or <a href="#notify">notify</a>. For more complex tasks
  1492. you'll use either a shell-script or a perl "oneliner" as the at/notify
  1493. argument. This chapter gives some tips in using the perl oneliners.<br><br>
  1494. <li>To test the following perl oneliners, type them on the telnet prompt (or
  1495. FHEMWEB text input) by enclosing it in {}, one line at once. The last line
  1496. will only write something in the logfile, the output of the other lines is
  1497. directly visible.
  1498. <ul>
  1499. { "Hello" }<br>
  1500. { 1+3*4 }<br>
  1501. { `ls /etc` }<br>
  1502. { Log 1, "Hello" }<br>
  1503. </ul>
  1504. <br>
  1505. <li>
  1506. Perl expressions are separated by ;, in FHEM oneliners they have to
  1507. escaped with ;;<br>
  1508. <ul>
  1509. { my $a = 1+1;; Log 1, "Hello $a" }
  1510. </ul>
  1511. <br>
  1512. <li>To use FHEM commands from the perl expression, use the function fhem(),
  1513. which takes a string argument, this string will be evaluated as a FHEM
  1514. command:<br>
  1515. <ul>
  1516. { fhem "set light on" }<br>
  1517. define n1 notify piri:on { fhem "set light on" }
  1518. </ul>
  1519. Note: if this function returns a value, it will also be logged into the
  1520. global FHEM log. Use 1 as a second argument to disable this logging, this
  1521. makes sense when obtainig some values via FHEM "get...".
  1522. <br>
  1523. <br>
  1524. <li>Notify can be used to store macros for manual execution. Use the <a
  1525. href="#trigger">trigger</a> command to execute the macro:<br>
  1526. <ul>
  1527. define MyMacro notify MyMacro { Log 1, "Hello"}<br>
  1528. trigger MyMacro<br>
  1529. define MacroWithArg notify MyMacro { Log 1, "Hello %"}<br>
  1530. trigger MyMacro MyArg<br>
  1531. </ul>
  1532. <br>
  1533. <li>To make date and time handling easier, the variables $sec, $min, $hour,
  1534. $mday, $month, $year, $wday, $yday, $isdst are available in the perl
  1535. oneliners (see also perldoc -f localtime). Exceptions: $month is in the
  1536. range of 1 to 12, and $year is corrected by 1900 (as I would expect).
  1537. Additionally the variable $hms contains the time in the HH:MM:SS format and
  1538. $today the current date in YYYY-MM-DD format.
  1539. <br>
  1540. Additionally the variabe $we is 1 if it is weekend (i.e $wday == 0 or
  1541. $wday == 6), and 0 otherwise. If the <a href="#holiday2we">holida2we</a>
  1542. global attribute is set, $we is 1 for holidays too.<br>
  1543. <ul>
  1544. define n2 notify piri:on { if($hour &gt; 18 || $hour &lt; 5) {
  1545. fhem "set light on" } }<br>
  1546. define roll_en *07:45:00 { fhem "trigger SwitchAllRoll on" if(!$we) }<br>
  1547. define roll_en *08:30:00 { fhem "trigger SwitchAllRoll on" if($we) }<br>
  1548. </ul>
  1549. <br>
  1550. <li>
  1551. The following helper functions are defined in 99_Util.pm (which will
  1552. be loaded automatically, as every module with prefix 99):
  1553. <ul>
  1554. <li>min(a,b), max(a,b)</li>
  1555. <li>time_str2num("YYYY-MM-DD HH:MM:SS") returns a numerical value,
  1556. which makes computation of time differences easier</li>
  1557. <li>abstime2rel("HH:MM:SS") converts an absolute time to a relative one
  1558. </li>
  1559. </ul>
  1560. </li>
  1561. <li>
  1562. To access the device states/attributes, use the following functions:
  1563. <br>
  1564. <ul>
  1565. <li>Value(&lt;devicename&gt;)<br>
  1566. returns the state of the device (the string you see in paranthesis in
  1567. the output of the list command).
  1568. </li><br>
  1569. <li>OldValue(&lt;devicename&gt;)
  1570. <li>OldTimestamp(&lt;devicename&gt;)<br>
  1571. returns the old value/timestamp of the device.
  1572. </li><br>
  1573. <li>
  1574. ReadingsVal(&lt;devicename&gt;,&lt;reading&gt;,&lt;defaultvalue&gt;)<br>
  1575. Return the reading (the value in the Readings section of "list device")
  1576. </li><br>
  1577. <li>
  1578. ReadingsNum(&lt;devicename&gt;,&lt;reading&gt;,
  1579. &lt;defaultvalue&gt;,&lt;round&gt;)<br>
  1580. Return the first number from a reading value.
  1581. Round id to &lt;round&gt; devimal places (optional parameter).
  1582. </li><br>
  1583. <li>ReadingsTimestamp(&lt;devicename&gt;,&lt;reading&gt;,&lt;
  1584. defaultvalue&gt;)<br>
  1585. returns the timestamp of the reading.
  1586. </li><br>
  1587. <li>ReadingsAge(&lt;devicename&gt;,&lt;reading&gt;,&lt;defaultvalue&gt;)
  1588. <br>
  1589. returns the age of the reading in seconds.
  1590. </li><br>
  1591. <li>
  1592. OldReadingsVal(&lt;devicename&gt;,&lt;reading&gt;,
  1593. &lt;defaultvalue&gt;)<br>
  1594. OldReadingsNum(&lt;devicename&gt;,&lt;reading&gt;,
  1595. &lt;defaultvalue&gt;,&lt;round&gt;)<br>
  1596. OldReadingsTimestamp(&lt;devicename&gt;,&lt;
  1597. reading&gt;,&lt;defaultvalue&gt;)<br>
  1598. OldReadingsAge(&lt;devicename&gt;,&lt;reading&gt;,
  1599. &lt;defaultvalue&gt;)<br>
  1600. similar to the above functions, but used to access the previous values.
  1601. see: <a href="#oldreadings">oldreadings</a>
  1602. </li><br>
  1603. <li>
  1604. AttrVal(&lt;devicename&gt;,&lt;attribute&gt;,&lt;defaultvalue&gt;)<br>
  1605. Return the attribute of the device
  1606. <br><br>
  1607. { Value("wz") }<br>
  1608. { OldValue("wz") }<br>
  1609. { time_str2num(OldTimestamp("wz")) }<br>
  1610. { ReadingsVal("wz", "measured-temp", "20")+0 }<br>
  1611. { ReadingsTimestamp("wz", "measured-temp", 0)}<br>
  1612. { AttrVal("wz", "room", "none") }<br>
  1613. </li><br>
  1614. <li>
  1615. AttrNum(&lt;devicename&gt;,&lt;attribute&gt;,
  1616. &lt;defaultvalue&gt;,&lt;round&gt;)<br>
  1617. Return the first number from an attribute value.
  1618. Round id to &lt;round&gt; devimal places (optional parameter).
  1619. </li><br>
  1620. <li>
  1621. InternalVal(&lt;devicename&gt;,&lt;property&gt;,&lt;defaultvalue&gt;)
  1622. <br>
  1623. Return the internal value (the value in the Internals section of "list
  1624. device").
  1625. </li><br>
  1626. <li>
  1627. InternalNum(&lt;devicename&gt;,&lt;property&gt;,
  1628. &lt;defaultvalue&gt;,&lt;round&gt;)<br>
  1629. Return the first number from an internal value.
  1630. Round id to &lt;round&gt; devimal places (optional parameter).
  1631. </li><br>
  1632. </ul>
  1633. <li>
  1634. By using the 99_SUNRISE_EL.pm module, you have access to the following
  1635. functions: <br>
  1636. <ul>
  1637. sunset($offset, $min, $max)<br>
  1638. sunrise($offset, $min, $max)<br>
  1639. isday()<br>
  1640. </ul>
  1641. offset is in seconds, and the format of min/max is "HH:MM" or "HH:MM:SS".
  1642. isday returns 1 if the sun is visible, and 0 else.
  1643. </li>
  1644. <br>
  1645. <br>
  1646. <!-- perl end - diese Zeile nicht entfernen! -->
  1647. <a name="gnuplot-syntax"></a>
  1648. <h3>gnuplot file syntax</h3>
  1649. The .gplot files are also used by the <a href="#FHEMWEB">FHEMWEB</a>/SVG module
  1650. when the <a href="#plotmode">plotmode</a> attribute is set to SVG. In this case
  1651. only a subset of the .gnuplot attributes are used, and some lines have special
  1652. meanings: the difference will be explained in this chapter. See also <a
  1653. href="http://wiki.fhem.de/wiki/Creating_Plots">this</a> FHEM Wiki entry on
  1654. creating logs.<br>
  1655. Following is a minimal .gplot definition (valid only for plotmode SVG):<br>
  1656. <pre>
  1657. set terminal size &lt;SIZE&gt;
  1658. #FileLog 4:::
  1659. plot title 'Temperature' with lines
  1660. </pre>
  1661. The .gnuplot file consists of 3 parts:
  1662. <ul>
  1663. <li>set commands<br>
  1664. Following sets are recognized:
  1665. <ul>
  1666. <li>terminal, only the size parameter.<br>
  1667. This is usually set to &lt;SIZE&gt;, which is replaced by the <a
  1668. href="#plotsize">plotsize</a> attribute of the FHEMWEB or weblink
  1669. instance.</li>
  1670. <li>title<br>
  1671. Usually set to &lt;TL&gt; which is replace by the weblink <a
  1672. href="#title">title</a> attribute, or to &lt;Lx&gt;, which is replaced
  1673. by the weblink <a href="#label">label</a> attribute.</li>
  1674. <li>ylabel,y2label<br>
  1675. Left and right labels, printed vertically. Are also subject to label
  1676. replacement.</li>
  1677. <li>yrange,y2range<br>
  1678. Specify the range of the left and right axis. Examples:<br>
  1679. <ul>
  1680. set yrange [-0.1:1.1]<br>
  1681. set y2range [0:]<br>
  1682. </ul>
  1683. </li>
  1684. <li>ytics,y2tics<br>
  1685. the label for the left/right axis tics. Examples:<br>
  1686. <ul>
  1687. set ytics ("on" 0, "off" 1)<br>
  1688. set y2tics<br>
  1689. </ul>
  1690. </li>
  1691. </ul>
  1692. </li>
  1693. <br>
  1694. <li>#FileLog entries<br>
  1695. Each line from the plot section must have one corresponding #FileLog
  1696. line. For the syntax see the column_spec paragraph of the <a
  1697. href="#FileLogget">Filelog get</a> description.
  1698. Note that for SVG plots the first column of the input file always has to
  1699. be in the standard fhem timestamp format (YYYY-MM-DD_HH:MM:SS)
  1700. </li>
  1701. <br>
  1702. <li>plot entries<br>
  1703. There is always one plot command with comma separated argument-blocks.
  1704. Each argument-block represents one line, and has its own parameters.
  1705. Following parameters are recognized:
  1706. <ul>
  1707. <li>axes x1y1 / x1y2<br>
  1708. tells the program to assign the current line to one of the two axes
  1709. (left or right).
  1710. </li>
  1711. <li>title<br>
  1712. Caption of the line. Whan clicking on this title, a small javascript
  1713. program will change the title to the min/max and last values of the plot,
  1714. will enable copying this line or pasting an already copied one (the
  1715. existing scale of the plot wont'be changed, only the pasted line will
  1716. be scaled), and other lines of the plot will temporarily be hidden.
  1717. </li>
  1718. <li>with &lt;linetype&gt;<br>
  1719. Specify the line type. Following types are recognized: points,
  1720. steps, fsteps, histeps and lines. Everything unknown will be mapped to
  1721. the type lines.
  1722. SVG special: cubic and quadratic, are mapped to the SVG path types C,
  1723. and Q respectively.
  1724. </li>
  1725. <li>ls &lt;linestyle&gt;<br>
  1726. The linestyle defaults to l0 for the first line, l1 for the second, and
  1727. so on. It is defined in the svg_style.css file. There are two sets
  1728. defined here: l0-l8 and l0fill-l6fill. The second set must be specified
  1729. explicitly. If the name of the linestyle contains the word fill, then
  1730. plots of the lineytype "lines" will have an additional starting and
  1731. ending segment, so that filling is done correctly.<br>
  1732. See the SVG spec for details of this CSS file.
  1733. Note: if you plan to use this attribute, you have to specify it for all
  1734. the lines (attribute-blocks) in the plot command.
  1735. </li>
  1736. <li>lw &lt;linewidth&gt;<br>
  1737. Sets the stroke-width style of the line. This attribute is deprecated,
  1738. the corresponding feature of the CSS file / (attribute ls) should be
  1739. used instead.
  1740. </li>
  1741. </ul>
  1742. </ul>
  1743. </li>
  1744. </div> <!-- right -->
  1745. </body>
  1746. </html>