2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00
fhem-mirror/fhem/docs/commandref.html
rudolfkoenig c2a4ab45b9 Watchdog added + small changes
git-svn-id: https://svn.fhem.de/fhem/trunk@221 2b470e98-0d58-463d-a4d8-8e2adae1ed80
2008-08-04 13:47:53 +00:00

2293 lines
79 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>fhem.pl command reference</title>
</head>
<body style="background-color: white;">
<h2>fhem.pl command reference</h2>
<a href="#intro">Introduction</a><br>
<a href="#help">?,help</a><br>
<a href="#attr">attr</a><br>
<a href="#define">define</a><br>
<a href="#delete">delete</a><br>
<a href="#deleteattr">deleteattr</a><br>
<a href="#get">get</a><br>
<a href="#include">include</a><br>
<a href="#inform">inform</a><br>
<a href="#list">list</a><br>
<a href="#modify">modify</a><br>
<a href="#quit">quit</a><br>
<a href="#reload">reload</a><br>
<a href="#rereadcfg">rereadcfg</a><br>
<a href="#save">save</a><br>
<a href="#set">set</a><br>
<a href="#setdefaultattr">setdefaultattr</a><br>
<a href="#setstate">setstate</a><br>
<a href="#shutdown">shutdown</a><br>
<a href="#sleep">sleep</a><br>
<a href="#trigger">trigger</a><br>
<a href="#xmllist">xmllist</a><br>
<a href="#devspec">Device specification</a><br>
<a href="#perl">Perl specials</a><br>
<a name="intro"></a>
<h3>Introduction</h3>
You can use all of the following commands in in two ways:
<ul>
<li>In the configuration file, which must be specified if you startup the
server. Example:<br>
<ul>
<code>fhem.pl ~/.fhem</code>
</ul>
<br>
A minimal configuration file would look like:
<pre>
attr global <a href="#logfile">logfile</a> /tmp/fhem.log
attr global <a href="#statefile">statefile</a> /tmp/fhem.save
attr global <a href="#verbose">verbose</a> 3
attr global <a href="#port">port</a> 7072
attr global <a href="#modpath">modpath</a> /usr/local/lib
<a href="#define">define</a> FHZ FHZ /dev/tts/USB0
<a href="#define">define</a> lamp FS20 8765 01</pre>
For other configuration files see the examples subdirectory.<br>
<br>
</li>
<li>Through the TCP/IP connection, which you can either use in a "session"
(via telnet) or single client command (via fhem.pl). Example:
<ul>
<code>telnet localhost 7072<br>
&lt;NL&gt; </code>(This newline switches into "prompt" mode)<code><br>
&lt;command&gt;...<br>
quit</code><br>
</ul>
or
<ul>
<code>fhem.pl 7072 "set lamp off"</code>
</ul>
</li>
</ul>
There are three types of commands: "fhem" commands (described in this document),
shell commands (they must be enclosed in double quotes ") and perl expressions
(enclosed in curly brackets {}). shell commands or perl expressions are needed for
complex <a href="#at">at</a> or <a href="#notify">notify</a> arguments.<br><br>
Shell commands will be executed in the
background, the perl program and the fhem commands will be executed in the main
"thread".
In order to make perl expressions easier to write, some special functions and
variables are available. See the section <a href="#perl">Perl special</a> for a
description.
To trigger "fhem" commands from a shell script, use the client form of
fhem.pl (described above).<br><br>
Multiple fhem commands are separated by semicolon (;). In order to use semicolon
in perl code or shell programs, they have to be escaped by the double semicolon
(;;).<br><br>
Commands can be either typed in plain, or read from a file (e.g. the
configuration file at startup). The commands are either executed directly, or
later if they are arguments to the <a href="#at">at</a> and <a
href="#notify">notify</a> fhem commands.<br><br>
A line ending with \ will be concatenated with the next one, so long lines
(e.g. multiple perl commands) can be split in multiple lines. Some web fronteds
make editing of multiline commands transparent.<br><br>
<a name="help"></a>
<h3>?, help</h3>
<ul>
<code>?</code><br>
<code>help</code><br>
<br>
Get a list of all commands and short description for each one
</ul>
<a name="attr"></a>
<h3>attr</h3>
<ul>
<code>attr &lt;devspec&gt; &lt;attrname&gt; [&lt;value&gt;] </code><br>
or <br>
<code>attr at &lt;at-spec-regexp&gt; &lt;attribute&gt; </code><br>
<br>Set an attribute to something defined by <a href="#define">define</a>.
There are some special attributes used by the fhem.pl itself or the
web-frontends, but you can define your own to use them in other applications.
You have to define them first with <a href="#userattr">userattr</a>, see
below.<br>
Use "attr &lt;name&gt; ?" to get a list of possible attributes.
See the <a href="#devspec">Device specification</a> section for details on
&lt;devspec&gt;.
<br><br>
Following are attributes of the global device:<br>
<ul>
<a name="configfile"></a>
<li>configfile<br>
Contains the name of the configuration file. If <a
href="#save">save</a> is called without argument, then the output will
be written to this file.
</li><br>
<a name="lastinclude"></a>
<li>lastinclude<br>
If this attribute is set, then the last command of the generated
configfile (see the <a href="#save">save</a> command) will be<br>
include &lt;lastinclude-value&gt;<br>
This file is needed, as the save command will write only defines and
attributes to the config file, any other commands / includes will be
lost. E.g. it makes sense to set the <a href="FHZset">FHTcode</a> in
this file or the coordinates of your house via
<a href="#at">sunrise_coord</at>
</li><br>
<a name="logfile"></a>
<li>logfile<br>
Specify the logfile to write. You can use "-" for
stdout, in this case the server won't background itself.<br>
The logfile name can also take wildcards for easier logfile rotation,
see the <a href="#FileLog">FileLog</a> section.
</li><br>
<a name="modpath"></a>
<li>modpath<br>
Specify the path to the modules directory <code>FHEM</code>. The path
should <b>not</b> contain the directory FHEM. Upon setting the
attribute, the directory will be scanned for filenames of the form
NN_&lt;NAME&gt;.pm, and make them available for device definition under
&lt;NAME&gt;. If the first device of type &lt;NAME&gt; is defined, the
module will be loaded, and its function with the name
&lt;NAME&gt;_initialize will be called. Exception to this rule are
modules with NN=99, these are considered to be utility modules
containing only perl helper functions, they are loaded at startup (i.e.
modpath attribute definition time).
</li><br>
<a name="pidfilename"></a>
<li>pidfilename<br>
Write the process id of the perl process to the specified file. The
server runs as a daemon, and some distributions would like to check by
the pid if we are still running. The file will be deleted upon
shutdown.
</li><br>
<a name="pidfilename"></a>
<li>pidfilename<br>
Works for the global "device"<br>
</li><br>
<a name="port"></a>
<li>port<br>
Listen on the TCP/IP port <code>&lt;number&gt;</code> for incoming
connections. To offer at least a little bit of security, the server
will only listen for connections from the localhost per default. If
there is a second value "global" then the server will listen for
non-localhost connections too.
</li><br>
<a name="allowfrom"></a>
<li>allowfrom<br>
Comma (,) separated list of ip-addresses or hostnames. If set,
only connections from these addresses are allowed.
</li><br>
<a name="statefile"></a>
<a name="statefile"></a>
<li>statefile<br>
Set the filename where the state and certain <a href="#at">at</a>
information will be saved before shutdown. If it is not specified, then
no information will be saved.
</li><br>
<a name="title"></a>
<li>title<br>
Used by the web frontend fhemweb.pl (webpgm2) as a Page title.
</li><br>
<a name="userattr"></a>
<li>userattr<br>
A space separated list which contains the names of additional
attributes. Without specifying them you will not be able to set them
(in order to prevent typos).
</li><br>
<a name="verbose"></a>
<li>verbose<br>
Set the verbosity level. Possible values:
<ul>
<li>0 - server start/stop
<li>1 - error messages or unknown packets
<li>2 - major events/alarms.
<li>3 - commands sent out will be logged.
<li>4 - you'll see whats received by the different devices.
<li>5 - debugging.</li>
</ul>
Recommended level is 3 for normal use.
</li>
</ul>
<br>
Attributes used by all devices:
<ul>
<a name="comment"></a>
<li>comment<br>
Add an arbitrary comment.
<a name="room"></a>
<li>room<br>
Filter/group devices. Recognized by web-pgm2 and web-pgm3.
Devices in the room hidden will not appear in the web output.</li><br>
<a name="showtime"></a>
<li>showtime<br>
Used in the webfrontend pgm2 to show the time of last activity
instead of the state in the summary view. Useful e.g. for FS20 PIRI
devices.
</li>
</ul>
<br>
Attributes used by some device types:
<ul>
<a name="archivedir"></a> <a name="archivecmd"></a> <a name="nrarchive"></a>
<li>archivecmd / archivedir / nrarchive<br>
Can be applied to FileLog devices.<br>
When a new FileLog file is opened, the FileLog archiver wil be called.
This happens only, if the name of the logfile has changed (due to
time-specific wildcards, see the <a href="#FileLog">FileLog</a>
section), and there is a new entry to be written into the file.
<br>
If the attribute archivecmd is specified, then it will be started as a
shell command (no enclosing " is needed), and each % in the command
will be replaced with the name of the old logfile.<br>
If this attribute is not set, but nrarchive and/or archivecmd is set,
then all superfluous logfiles will be moved to archivedir (or deleted if
archivedir is not set).</li><br>
<a name="disable"></a>
<li>disable<br>
Can be applied to at/watchdog/notify/FileLog devices.<br>
Disables the corresponding at/notify or FileLog device. Note:
If applied to an <a href="#at">at</a>, the command will not be executed,
but the next time will be computed.</li><br>
<a name="do_not_notify"></a>
<li>do_not_notify<br>
Can be applied to FHZ/FS20/FHT/HMS/KS300/WS300 devices.<br>
Disable FileLog/notify/inform notification for a device. This affects
the received signal, the set and trigger commands.</li><br>
<a name="dummy"></a>
<li>dummy<br>
Can be applied to FS20/FHT devices.<br>
Set the device attribute dummy to define devices which should not
output any radio signals. Associated notifys will be executed if
the signal is received. Used e.g. to react to a code from a sender, but
it will not emit radio signal if triggered in the web frontend.
Implemented for FS20 and FHT devices.</li><br>
<a name="filtertimeout"></a>
<li>filtertimeout<br>
Can be applied to FHZ devices.<br>
Ignore duplicate messages for this amount of time. The time is in
seconds, fractions are allowed. It affects installations with more then
one FHZ device or repeater, see the <a href="#repeater">repeater</a>
entry.
</li><br>
<a name="follow-on-for-timer"></a>
<li>follow-on-for-timer<br>
Can be applied to FS20 devices.<br>
the program automatically schedules a "setstate off" for the time
specified as argument to the on-for-timer command (for the specified
device only).
</li><br>
<a name="loglevel"></a>
<li>loglevel<br>
Can be applied to FHZ/FS20/FHT/HMS/KS300/WS300 devices.<br>
Set the device loglevel to e.g. 6 if you do not wish messages from a
given device to appear in the global logfile (FHZ/FS20/FHT). E.g. to
set the FHT time, you should schedule "set FHZ time" every minute, but
this in turn makes your logfile unreadable. These messages will not be
generated if the FHZ attribute loglevel is set to 6.</li><br>
<a name="logtype"></a>
<li>logtype<br>
Can be applied to FileLog devices.<br>
Used by the pgm2 webfrontend to offer gnuplot/SVG images made from the
logs. The string is made up of tokens separated by comma (,), each
token specifies a different gnuplot program. The token may contain a
colon (:), the part before the colon defines the name of the program,
the part after is the string displayed in the web frontend. Currently
following types of gnuplot programs are implemented:<br>
<ul>
<li>fs20<br>
Plots on as 1 and off as 0. The corresponding filelog definition
for the device fs20dev is:<br>
define FileLog fslog fs20dev /var/log/fs20dev-%Y-%U.log
</li>
<li>fht<br>
Plots the measured-temp/desired-temp/actuator lines. The
corresponding filelog definitions (for the FHT device named
fht1) looks like:<br>
define FileLog fhtlog1 fht1:.*(temp|actuator).*
/var/log/fht1-%Y-%U.log
</li>
<li>ks300_1<br>
Plots the temperature and rain (per hour and per day) of a
ks300. The corresponding filelog definitions (for the KS300
device named ks300) looks like:<br>
define FileLog ks300log ks300:.*H:.*
/var/log/ks300-%Y-%U.log
</li>
<li>ks300_2<br>
Plots the humidity and wind values of a
ks300. The corresponding filelog definition is the same as
above, both programs evaluate the same log.
</li>
<li>text<br>
Shows the logfile as it is (plain text). Not gnuplot definition
is needed.
</li>
</ul>
Example:<br>
attr fhtlog1 logtype ks300_1:Temp/Rain,ks300_2:Hum/Wind,text:Raw-data
</li><br>
<a name="model"></a>
<li>model<br>
Can be applied to FHZ/FS20/FHT/HMS/KS300/WS300 devices.<br>
The model attribute denotes the model type of the device.
The attributes will (currently) not be used by the fhem.pl directly.
It can be used by e.g. external programs or web interfaces to
distinguish classes of devices and send the appropriate commands
(e.g. "on" or "off" to a fs20st, "dim..%" to fs20du etc.).
The spelling of the model names are as quoted on the printed
documentation which comes which each device. This name is used
without blanks in all lower-case letters. Valid characters should be
<code>a-z 0-9</code> and <code>-</code> (dash),
other characters should be ommited. Here is a list of "official"
devices:<br>
<ul>
<li>FHT: fht80b</li>
<li>FS20:
<pre>fs20hgs
fs20pira
fs20piri
fs20s20
fs20s8
fs20s4
fs20s4a
fs20s4m
fs20s4u
fs20s4ub
fs20sd
fs20sn
fs20sr
fs20ss
fs20str
fs20tfk
fs20tfk
fs20tk
fs20uts
fs20ze
fs20as1
fs20as4
fs20di
fs20du
fs20ms2
fs20rst
fs20sa
fs20sig
fs20st
fs20sv
fs20sv
fs20usr</pre></li>
<li>HMS: hms100-t hms100-tf hms100-wd hms100-mg hms100-co hms100-tfk hms100-fit rm100-2</li>
<li>KS300: ks300</li>
<li>WS300: ws300pc</li>
<li>EM1010: em1010pc</li>
<li>WS2000: ws2000</li>
<li>IPWE: ipwe</li>
</ul>
</li><br>
<a name="repeater"></a>
<li>repeater<br>
Can be applied to FHZ devices.<br>
Set the attribute "repeater" for an FHZ device to 1 to ignore events
received from a FS20 repeater. In fact we are not sure that they are
repeater messages, we just ignore messages which were sent out by our
device for the next 3 seconds (see the next attribute)
</li><br>
<a name="skip_next"></a>
<li>skip_next<br>
Can be applied to at devices.<br>
Used for at commands: skip the execution of the command the next
time.</li><br>
<a name="fhtsoftbuffer"></a>
<li>fhtsoftbuffer<br/>
Can be applied to FHZ devices.<br/>
As the FHZ command buffer for FHT devices is limited (see fhtbuf),
and commands are only sent to the FHT device every 120 seconds,
the hardware buffer may overflow and FHT commands get lost.
Setting this attribute implements an "unlimited" software buffer<br>
Default is disabled (i.e. not set or set to 0).</li><br>
<a name="retrycount"></a>
<li>retrycount<br/>
Can be applied to FHT devices.<br/>
If the <a href="#fhtsoftbuffer">fhtsoftbuffer</a> attribute is set, then
resend commands <code>retrycount</code> times if after 240 seconds
no confirmation message is received from the corresponding FHT
device.<br>
Default is 3.</li><br>
<a name="minfhtbuffer"></a>
<li>minfhtbuffer<br/>
Can be applied to FHT devices.<br/>
FHEM wont send commands to the FHZ if its fhtbuffer is below
this value, default is 0. If this value is low, then the ordering of
fht commands (see the note in the FHT section of <a href="#set">set</a>)
has little effect, as only commands in the softbuffer can be
prioritized. The maximum value should be 7 below the hardware maximum
(see fhtbuf).
</li><br>
<a name="webname"></a>
<li>webname<br/>
Can be applied to FHEMWEB devices. (webfrontend/pgm2)<br/>
Path after the http://hostname:port/ specification. Defaults to fhem,
i.e the default http address is http://localhost:8083/fhem
</li><br>
<a name="refresh"></a>
<li>refresh<br/>
Can be applied to FHEMWEB devices. (webfrontend/pgm2)<br/>
If set, a http-equiv="refresh" entry will be genererated with the given
argument (i.e. the browser will reload the page after the given
seconds).
</li><br>
<a name="plotmode"></a>
<li>plotmode<br/>
Can be applied to FHEMWEB devices. (webfrontend/pgm2)<br/>
Specifies how to generate the plots:
<ul>
<li>gnuplot<br>
Call the gnuplot script with each logfile. The filename
specification of the <a href="#FileLog">FileLog</a> device will
determine what is in the plot. The data is converted into an
image on the backend with gnuplot.</li>
<li>gnuplot-scroll<br>
Fhemweb will offer zoom and scroll buttons in order to navigate
in the current logfile, i.e. you can select just a part of the
data to be displayed. The more data is contained in a single
logfile, the easier you can navigate. The recommendation is to
store the data for a whole year in one logfile. The data is
converted into an image on the backend with gnuplot.</li>
<li>SVG<br>
The same scrolling as with gnuplot scroll, but the data is sent
as an SVG script to the frontend, which will compute
the image: no need for gnuplot on the backend.</li>
</ul>
</li><br>
<a name="plotsize"></a>
<li>plotsize<br/>
Can be applied to FHEMWEB devices. (webfrontend/pgm2)<br/> Specifies
the defult size of the plot, in pixels, separated by comma:
width,height. You can set individual sizes by setting the plotsize of
the weblink.
</li><br>
</li>
</ul>
Examples:
<ul>
<code>attr global verbose 3</code><br>
<code>attr lamp room kitchen</code><br>
<code>attr lamp dummy</code><br>
<code>attr lamp loglevel 6</code><br/>
<br>
<code>attr FHZ fhtsoftbuffer 0 # disable the fhtsoftbuffer</code><br/>
<code>attr FHZ retrycount 4 # resend commands to FHT devices at most 4 times.</code>
</ul>
<br>
Notes:<br>
<ul>
<li>See <a href="#deleteattr">deleteattr</a> to delete attributes.</li>
</ul>
</ul>
<a name="setdefaultattr"></a>
<h3>setdefaultattr</h3>
<ul>
<code>setdefaultattr [&lt;attrname&gt; [&lt;value&gt;]] </code><br>
<br>Set the default attribute. Each device defined from now on will receive
this attribute (see the <a href="#attr">attr</a> entry for details on
attribute names and values).<br>
If no attrname is specified, then the default attribute list will be deleted.
<br><br>
Example to set the attribute "room kitchen" and "loglevel 4" to
each of the lamps:
<ul>
<code>setdefaultattr room kitchen</code><br>
<code>setdefaultattr loglevel 4</code><br>
<code>define lamp1 FS20 1234 11</code><br>
<code>define lamp2 FS20 1234 12</code><br>
<code>define lamp3 FS20 1234 13</code><br>
<code>setdefaultattr</code><br>
</ul>
<br>
Notes:<br>
<ul>
<li>There is no way to delete a single default-attribute from the list</li>
</ul>
</ul>
<a name="define"></a>
<h3>define</h3>
<ul>
<code>define &lt;name&gt; &lt;type&gt; &lt;type-specific&gt;</code><br>
<br>
Define a device. You need devices if you want to manipulate them (e.g.
set on/off), and the logfile is also more readable if it contains e.g.
"lamp off" instead of "Device 5673, Button 00, Code 00 (off)". <br>
Use "define &lt;name&gt; ?" to get a list of possible types.
<br>
<a name="FHZ"></a>
<h4>Type FHZ</h4>
<ul>
<code>define &lt;name&gt; FHZ &lt;serial-device&gt;</code> <br>
<br>
Specifies the serial port to communicate with the FHZ 1000 PC. The name(s)
of the serial-device(s) depends on your distribution. The program can
service multiple devices, FS20 and FHT device commands will be sent out
through the last FHZ device defined before the definition of the FS20/FHT
device. To change the association, use the <a href="#set">set</a> command
activefor. <b>Important:</b> this definition must occur after the
modpath command but before any other (FHZ related) device definition,
else you'll see "no I/O device found" messages.<br>
If the serial-device is called none, then no device will be opened, so you
can experiment without hardware attached.<br>
Set the attribute "repeater" for this device to 1 to ignore events received
from a FS20 repeater. In fact we are not sure that they are repeater
messages, we just ignore messages which were sent out by our device for the
next 3 seconds (or configured otherwise by filtertimeout).
<br>
For GNU/Linux you may want to read our <a href="linux.html">hints for
GNU/Linux</a> about <a href="linux.html#multipledevices">multiple USB
devices</a>.<br>
<b>Note:</b>The firmware of the FHZ1x00 will drop commands if the airtime
for the last hour would exceed 1% (which corresponds roughly to 163
commands). For this purpose there is a command counter for the last hour
(see list FHZDEVICE), which triggers with "TRANSMIT LIMIT EXCEEDED" if
there were more than 163 commands in the last hour.<br>
</ul>
<br>
<a name="FS20"></a>
<h4>Type FS20</h4>
<ul>
<code>define &lt;name&gt; FS20 &lt;housecode&gt; &lt;button&gt;
[fg &lt;fgaddr&gt;] [lm &lt;lmaddr&gt;] [gm FF] </code>
<br><br>
The values of housecode, button, fg, lm, and gm can be either defined as
hexadecimal value or as ELV-like "quad-decimal" value with digits 1-4. We
will reference this ELV-like notation as ELV4 later in this document. You
may even mix both hexadecimal and ELV4 notations, because FHEM can detect
the used notation automatically by counting the digits.<br>
<ul>
<li><code>&lt;housecode&gt;</code> is a 4 digit hex or 8 digit ELV4 number,
corresponding to the housecode address.</li>
<li><code>&lt;button&gt;</code> is a 2 digit hex or 4 digit ELV4 number,
corresponding to a button of the transmitter.</li>
<li>The optional <code>&lt;fgaddr&gt;</code> specifies the function group.
It is a 2 digit hex or 4 digit ELV address. The first digit of the hex
adress must be F or the first 2 digits of the ELV4 address must be
44.</li>
<li>The optional <code>&lt;lmaddr&gt;</code> specifies the local
master. It is a 2 digit hex or 4 digit ELV address. The last digit of the
hex address must be F or the last 2 digits of the ELV4 address must be
44.</li>
<li>The optional gm specifies the global master, the adress must be FF if
defined as hex value or 4444 if defined as ELV4 value.</li>
</ul>
<br>
Examples:
<ul>
<code>define lamp FS20 7777 00 fg F1 gm F</code><br>
<code>define roll1 FS20 7777 01</code><br>
<code>define otherlamp FS20 24242424 1111 fg 4412 gm 4444</code><br>
<code>define otherroll1 FS20 24242424 1114</code>
</ul>
</ul>
<br>
<a name="FHT"></a>
<h4>Type FHT</h4>
<ul>
<code>define &lt;name&gt; FHT &lt;housecode&gt;</code>
<br><br>
<code>&lt;housecode&gt;</code> is a four digit hex number,
corresponding to the adress of the FHT80b device.
<br>
Examples:
<ul>
<code>define wz FHT 3232</code><br>
</ul>
<br>
See the FHT section in <a href="#set">set</a> for more.
</ul>
<br>
<a name="HMS"></a>
<h4>Type HMS</h4>
<ul>
<code>define &lt;name&gt; HMS &lt;housecode&gt;</code>
<br><br>
<code>&lt;housecode&gt;</code> is a four digit hex number,
corresponding to the adress of the HMS device.
<br>
Examples:
<ul>
<code>define temp HMS 1234</code><br>
</ul>
Notes:<br>
<ul>
<li>There is _NO_ guarantee that the code will work as expected in all
circumstances, the authors are not liable for any damage occuring as a
result of incomplete or buggy code</li>
<li>Currently supported devices are the HMS100-T HMS100-TF HMS100-WD
HMS100-MG HMS100-TFK HMS100-CO HMS100-FIT RM100-2 </li>
<li>The housecode of the HMS devices may change if the battery is renewed.
In order to make life easier, you can define a "wildcard" device for each
type of HMS device. First the real device-id will be checked, then the
wildcard device id. The wildcards are:
<ul>
<li>1000 for the HMS100-TF</li>
<li>1001 for the HMS100-T</li>
<li>1002 for the HMS100-WD</li>
<li>1003 for the RM100-2</li>
<li>1004 for the HMS100-TFK/li>
<li>1006 for the HMS100-MG</li>
<li>1008 for the HMS100-CO</li>
<li>100e for the HMS100-FIT</li>
</ul>
</li>
<li>Some battery low notifications are not yet implemented (RM100,
HMS100WD).</li>
<li>Please test your installation before relying on the
functionality.</li>
</ul>
<br>
</ul>
<br>
<a name="KS300"></a>
<h4>Type KS300</h4>
<ul>
<code>define &lt;name&gt; KS300 &lt;housecode&gt; [ml/raincounter [wind-factor]]</code>
<br><br>
<code>&lt;housecode&gt;</code> is a four digit hex number,
corresponding to the adress of the KS300 device, right now it is ignored.
The ml/raincounter defaults to 255 ml, but it must be specified if you wish
to set the wind factor, which defaults to 1.0.
<br>
Examples:
<ul>
<code>define ks1 KS300 1234</code><br>
</ul>
<br>
</ul>
<br>
<a name="WS300"></a>
<h4>Type WS300</h4>
<ul>
<code>define WS300Device WS300 &lt;serial device&gt;</code><br>
or<br>
<code>define &lt;devname&gt WS300 [0-9]</code><br>
<br>
The first line is mandatory if you have a WS300 device: it defines the
input device with its USB port. The name of this device is fixed and must
be WS300Device. It must be the first defined WS300 device.<br>
For each additional device (with number 0 to 9) you have to define another
WS300 device, with an arbitrary name. The WS300 device which reports the
readings will be defined with the port number 9, an optional KS300 with the
port number 8.<br><br>
Examples:
<pre>
define WS300Device WS300 /dev/ttyUSB1
define ash2200.1 WS300 0
define ks300 WS300 8
define ws300 WS300 9
</pre>
</ul>
<br>
<a name="EM"></a>
<h4>Type EM</h4>
<ul>
<code>define &lt;name&gt; EM &lt;em1010pc-device&gt;</code>
<br><br>
Define a EM1010PC USB device. From the software point of view there should
be no problems if you attach/define more than one EM1010PC, but it is
unknown if the low-level radio protocol supports this.<br> Currently there
is no way to read the internal log of the EM1010PC, use the program
em1010.pl in the contrib directory for this purpose.<br><br>
Examples:
<ul>
<code>define em EM /dev/elv_em1010pc</code><br>
</ul>
<br>
</ul>
<a name="EMWZ"></a>
<h4>Type EMWZ</h4>
<ul>
<code>define &lt;name&gt; EMWZ &lt;device-number&gt;</code>
<br><br>
Define up to 4 EM1000WZ attached to the EM1010PC. The device number must
be between 1 and 4 (else you have a differnt device connected to the
EM1010PC). Defining an EMWZ will schedule an internal task, which reads the
status of the device every 5 minutes, and triggers notify/filelog commands.
<br><br>
Example:
<ul>
<code>define emwz EMWZ 1</code><br>
</ul>
<br>
</ul>
<a name="EMEM"></a>
<h4>Type EMEM</h4>
<ul>
<code>define &lt;name&gt; EMEM &lt;device-number&gt;</code>
<br><br>
Define up to 4 EM1000EM attached to the EM1010PC. The device number must
be between 5 and 8.
Defining an EMEM will schedule an internal task, which reads the
status of the device every 5 minutes, and triggers notify/filelog commands.
<br>Note: Currently this device does not support a "set" function.
<br><br>
Example:
<ul>
<code>define emem EMEM 5</code><br>
</ul>
<br>
</ul>
<a name="EMGZ"></a>
<h4>Type EMGZ</h4>
<ul>
<code>define &lt;name&gt; EMGZ &lt;device-number&gt;</code>
<br><br>
Define up to 4 EM1000GZ attached to the EM1010PC. The device number must
be 9.
Defining an EMGZ will schedule an internal task, which reads the
status of the device every 5 minutes, and triggers notify/filelog commands.
<br><br>
Example:
<ul>
<code>define emgz EMGZ 9</code><br>
</ul>
<br>
</ul>
<a name="M232"></a>
<h4>Type M232</h4>
<ul>
<code>define &lt;name&gt; M232 &lt;m232-device&gt;</code>
<br><br>
Define a M232 device. You can attach as many M232 devices as you like. A
M232 device provides 6 analog inputs (voltage 0..5V with 10 bit resolution)
and 8 bidirectional digital ports. The eighth digital port can be used as a
16 bit counter (maximum frequency 3kHz). The M232 device needs to be
connected to a 25pin sub-d RS232 serial port. A USB-to-serial converter
works fine if no serial port is available.<br><br>
Examples:
<ul>
<code>define m232 M232 /dev/ttyUSB2</code><br>
</ul>
<br>
</ul>
<a name="M232Counter"></a>
<h4>Type M232Counter</h4>
<ul>
<code>define &lt;name&gt; M232Counter [unit [factor]]</code>
<br><br>
Define at most one M232Counter for a M232 device. Defining a M232Counter
will schedule an internal task, which reads the status of the counter every
minute, and triggers notify/filelog commands. <code>unit</code> is the unit
name, <code>factor</code> is used to calculate the reading of the counter
from number of ticks. <br><br> <br>Note: the unit defaults to the string
"ticks", but it must be specified if you wish to set the factor, which
defaults to 1.0. In the second example below one tick equals 1/1250th kWh.
Do not forget to start the counter (with <code>set .. start</code> for
M232) or to start the counter and set the reading to a specified value
(with <code>set ... value</code> for M232Counter). <br><br>
Example:
<ul>
<code>define counter M232Counter turns</code><br>
<code>define counter M232Counter kWh 0.0008</code><br>
</ul>
<br>
</ul>
<a name="M232Voltage"></a>
<h4>Type M232Voltage</h4>
<ul>
<code>define &lt;name&gt; M232Voltage [an0..an5] [unit [factor]]</code>
<br><br>
Define as many M232Voltages as you like for a M232 device. Defining a
M232Voltage will schedule an internal task, which reads the status of the
analog input every minute, and triggers notify/filelog commands.
<code>unit</code> is the unit name, <code>factor</code> is used to
calibrate the reading of the analog input.<br><br>
Note: the unit defaults to the string "volts", but it must be specified
if you wish to set the factor, which defaults to 1.0. <br><br>
Example:
<ul>
<code>define volt M232Voltage an0</code><br>
<code>define brightness M232Voltage an5 lx 200.0</code><br>
</ul>
<br>
</ul>
<a name="SCIVT"></a>
<h4>Type SCIVT</h4>
<ul>
<code>define &lt;name&gt; SCIVT &lt;SCD-device&gt;</code>
<br><br>
Define a SCD series solar controler device. Details see <a
href="http://english.ivt-hirschau.de/content.php?parent_id=CAT_64&doc_id=DOC_118">here</a>.
You probably need a Serial to USB controller like the PL2303.
<br>
Defining an SCIVT device will schedule an internal task, which reads the
status of the device every 5 minutes, and triggers notify/filelog commands.
<br>Note: Currently this device does not support a "set" function, only
a single get function which reads the device status immediately.
<br><br>
Example:
<ul>
<code>define scd SCIVT /dev/ttyUSB2</code><br>
</ul>
<br>
</ul>
<a name="WS2000"></a>
<h4>Type WS2000</h4>
<ul>
<code>define &lt;name&gt; WS2000&lt;device_to_connect&gt;</code>
<br><br>
Define a WS2000 series raw receiver device sold by ELV. Details see <a
href="http://www.elv.de/output/controller.aspx?cid=74&detail=10&detail2=6724">here</a>.
Unlike 86_FS10.pm it will handle the complete device communication itself and
doesnt require an external program.
For this reason you can now use this also on windows.
<br>
This Device will be usually connect to a serial port, but you can also
define a raw network redirector like lantronix XPORT(TM).
<br>Note: Currently this device does not support a "set" function
<br><br>
Attributes:
<ul>
<li><code>rain</code>: factor for calculating amount of rain in ml/count</li>
<li><code>altitude</code>: height in meters to calculate pressure for NN(not used yet)</li>
</ul>
<br>
Example:
<ul>
<code>define WS2000 WS2000 /dev/ttyS0</code><br>
</ul>
<ul>
<code>define WS2000 WS2000 xport:10001</code><br>
</ul>
<ul>
<code>attr WS2000 rain 366</code> : use factor 366 ml/count for rain sensor S2000R<br>
</ul>
<br>
</ul>
<a name="IPWE"></a>
<h4>Type IPWE</h4>
<ul>
<code>define &lt;name&gt; IPWE &lt;hostname&gt; [&lt;delay&gt;]</code>
<br><br>
Define a IPWE network attached weather data receiver device sold by ELV. Details see <a
href="http://www.elv.de/output/controller.aspx?cid=74&detail=10&detail2=21508">here</a>.
It's intended to receive the same sensors as WS300 (8 T/H-Sensors and one kombi sensor),
but can be accessed via http and telnet.
<br>
For unknown reason, my try to use the telnet interface was not working neither with raw sockets
nor with Net::Telnet module. Therefore i choosed here the "easy" way
to simple readout the http page and extract all data from the offered table. For this reason this module doesnt
contain any option to configure this device.
<br><br><b>Note:</b> You should give your sensors a name within the web interface, once they a received the first time.
<br>To extract a single sensor simply match for this name or sensor id<br>
<br>
Attributes:
<ul>
<li><code>delay</code>: seconds between read accesses(default 300s)</li>
</ul>
<br>
Example:
<ul>
<code>define ipwe IPWE ipwe1 120</code><br>
</ul>
<ul>
<code>attr ipwe delay 600</code> : 10min between readouts<br>
</ul>
<br>
</ul>
<a name="FileLog"></a>
<h4>Type FileLog</h4>
<ul>
<code>define &lt;name&gt; FileLog &lt;filename&gt; &lt;regexp&gt;</code>
<br><br>
Log events to <code>&lt;filename&gt;</code>. The log format is
<pre>
YYYY:MM:DD_HH:MM:SS &lt;device&gt; &lt;event&gt;</pre>
The regexp will be checked against the (complete!) device name
or against the (complete!) devicename:event combination.
<br>
<code>&lt;filename&gt;</code> may contain one or more of the following
wildcards (a subset of the Unix date command arguments):
<ul>
<li><code>%d</code> day of month (01..31)</li>
<li><code>%m</code> month (01..12)</li>
<li><code>%Y</code> year (1970...)
<li><code>%w</code> day of week (0..6); 0 represents Sunday
<li><code>%j</code> day of year (001..366)
<li><code>%U</code> week number of year with Sunday as first day of week (00..53)
<li><code>%V</code> week number of year with Monday as first day of week (01..53)
</ul>
Examples:
<ul>
<code>define lamplog FileLog /var/tmp/lamp.log lamp</code><br>
<code>define wzlog FileLog /var/tmp/wz-%Y-%U.log
wz:(measured-temp|actuator).*</code><br>
</ul>
<br>
</ul>
<a name="DbLog"></a>
<h4>Type DbLog</h4>
<ul>
<code>define &lt;name&gt; DbLog &lt;configfilename&gt; &lt;regexp&gt;</code>
<br><br>
Log events to a database. The database connection is defined in
<code>&lt;configfilename&gt;</code> (see sample configuration file
<code>db.conf</code>). The configuration is stored in a separate file
to avoid storing the password in the main configuration file and to have it
visible in the output of the <a href="#list">list</a> command.
<br><br>
You must have <code>93_DbLog.pm</code> in the <code>FHEM</code> subdirectory
to make this work. Additionally, the modules <code>DBI</code> and
<code>DBD::&lt;dbtype&gt;</code> need to be installed (use
<code>cpan -i &lt;module&gt;</code> if your distribution does not have it).
<br><br>
<code>&lt;regexp&gt;</code> is the same as in <a href="#FileLog">FileLog</a>.
<br><br>
Sample code to create a MySQL database is in <code>fhemdb_create.sql</code>.
The database contains two tables: <code>current</code> and
<code>history</code>. The latter contains all events whereas the former only
contains the last event for any given reading and device.
The columns have the following meaning:
<ol>
<li>TIMESTAMP: timestamp of event, e.g. <code>2007-12-30 21:45:22</code></li>
<li>DEVICE: device name, e.g. <code>Wetterstation</code></li>
<li>TYPE: device type, e.g. <code>KS300</code></li>
<li>EVENT: event specification as full string,
e.g. <code>humidity: 71 (%)</code></li>
<li>READING: name of reading extracted from event,
e.g. <code>humidity</code></li>
<li>VALUE: actual reading extracted from event,
e.g. <code>71</code></li>
<li>UNIT: unit extracted from event, e.g. <code>%</code></li>
</ol>
The content of VALUE is optimized for automated post-processing, e.g.
<code>yes</code> is translated to <code>1</code>.
<br><br>
The current values can be retrieved by means of the perl script
<code>fhemdb_get.pl</code>. Its output is adapted to what a
<a href="www.cacti.net">Cacti</a> data input method expects.
Call <code>fhemdb_get.pl</code> without parameters to see the usage
information.
<br><br>
Examples:
<ul>
<code># log everything to database</code><br>
<code>define logdb DbLog /etc/fhem/db.conf .*:.*</code>
</ul>
</ul>
<a name="at"></a>
<h4>Type at</h4>
<ul>
<code>define &lt;name&gt; at &lt;timespec&gt; &lt;command&gt;</code><br>
<br>
Start an arbitrary fhem.pl command at a later time.<br>
<code>&lt;timespec&gt;</code> format: [+][*{N}]&lt;timedet&gt;<br>
<ul>
The optional <code>+</code> indicates that the specification is
<i>relative</i>(i.e. it will be added to the current time).<br>
The optional <code>*</code> indicates that the command should be
executed <i>repeatedly</i>.<br>
The optional <code>{N}</code> after the * indicates,that the command
should be repeated <i>N-times</i> only.<br>
&lt;timedet&gt; is either HH:MM, HH:MM:SS or {perlfunc()}, where perlfunc
must return a HH:MM or HH:MM:SS date.
</ul>
<br>
Examples:
<PRE>
# absolute ones:
define a1 at 17:00:00 set lamp on # fhem command
define a2 at 17:00:00 { Log 1, "Teetime" } # Perl command
define a3 at 17:00:00 "/bin/echo "Teetime" > /dev/console" # shell command
define a4 at *17:00:00 set lamp on # every day
# relative ones
define a5 at +00:00:10 set lamp on # switch the lamp on in 10 seconds
define a6 at +00:00:02 set lamp on-for-timer 1 # Blink once in 2 seconds
define a7 at +*{3}00:00:02 set lamp on-for-timer 1 # Blink 3 times
# Blink 3 times if the piri sends a command
define n1 notify piri:on.* define a8 at +*{3}00:00:02 set lamp on-for-timer 1
# Switch the lamp on from sunset to 11 PM
# Copy 99_SUNRISE_EL.pm in the FHEM directory to have sunset_rel()
{ sunrise_coord("8.686", "50.112", "") }
define a9 at +*{sunset_rel()} set lamp on
define a10 at *23:00:00 set lamp off
# More elegant version, works for sunset > 23:00 too
define a11 at +*{sunset_rel()} set lamp on-till 23:00
# Only do this on weekend
define a12 at +*{sunset_rel()} { fhem("set lamp on-till 23:00") if($we) }
# Switch lamp1 and lamp2 on from 7:00 till 10 minutes after sunrise
define a13 at *07:00 set lamp1,lamp2 on-till {sunrise_abs(+600)}
# Switch the lamp off 2 minutes after sunrise each day
define a14 at +*{sunrise_rel(+120)} set lamp on
</PRE>
Notes:<br>
<ul>
<li>if no <code>*</code> is specified, then a command will be executed
only once, and then the <code>at</code> entry will be deleted. In
this case the command will be saved to the statefile (as it
considered volatile, i.e. entered by cronjob) and not to the
configfile (see the <a href="#save">save</a> command.)
</li>
<li>if the current time is greater then the time specified, then the
command will be executed tomorrow. This is why the relative forms
of the sunset/sunrise functions should be used with the relative
(+) flag</li>
<li>In order to use the sunrise_rel()/sunset_rel() functions,
put { sunrise_coord(long, lat, "") } into your
<a href="#lastinclude">lastinclude</a> file, as in the above example.
If you are not using sunrise_coord, then the coordinates for
Frankfurt am Main, Germany will be used.
</li>
<li>For even more complex date handling you either have to call fhem from
cron or filter the date in a perl expression, see the last example and
the section <a href="#perl">Perl special</a>.
</li>
</ul>
<br>
</ul>
<a name="watchdog"></a>
<h4>Type watchdog</h4>
<ul>
<code>define &lt;name&gt; watchdog &lt;regexp1&gt; &lt;timespec&gt; &lt;regexp2&gt; &lt;command&gt;</code><br>
<br>
Start an arbitrary fhem.pl command if after &lt;timespec&gt; receiving an
event matching &lt;regexp1&gt; no event matching &lt;regexp2&gt; is
received.<br>
The syntax for &lt;regexp1&gt; and &lt;regexp2&gt; is the same as the
regexp for <a href="#notify">notify</a>.<br>
&lt;timespec&gt; is HH:MM[:SS]<br>
&lt;command&gt; is a usual fhem command like used int the <a
href="#at">at</a> or <a href="#notify">notify</a>
<br><br>
Examples:
<pre>
# "Reset" the FHT80 if we do not receive any message for 15 Minutes
define w watchdog FHT80 00:15:00 SAME set FHT80 refreshvalues
# Shout if the HMS100-FIT is not alive
define w watchdog HMS100-FIT 01:00:00 SAME "alarm-fit.sh"
</pre>
Notes:<br>
<ul>
<li>if &lt;regexp1&gt; is . (dot), then activate the watchdog at
definition time. Else it will be activated when the first matching event
is received.</li>
<li>if &lt;regexp2&gt; is SAME, then it will be the same as the first
regexp, and it will be reactivated, when it is received. This is probably
the normal operation.</li>
</ul>
<br>
</ul>
<a name="notify"></a>
<h4>Type notify</h4>
<ul>
<code>define &lt;name&gt; notify &lt;pattern&gt; &lt;command&gt;</code>
<br><br>
Execute a command when received an event for the <a
href="#define">definition</a> <code>&lt;pattern&gt;</code>. If
&lt;command&gt; is enclosed in {}, then it is a perl expression, if it is
enclosed in "", then it is a shell command, else it is a "plain" fhem.pl
command (chain). See the <a href="#trigger">trigger</a> command for
testing it.
Examples:
<ul>
<code>define b3lampV1 notify btn3 set lamp %</code><br>
<code>define b3lampV2 notify btn3 { fhem "set lamp %" }</code><br>
<code>define b3lampV3 notify btn3 "/usr/local/bin/setlamp "%""</code><br>
<code>define b3lampV3 notify btn3 set lamp1 %;;set lamp2 %</code><br>
<code>define wzMessLg notify wz:measured.* "/usr/local/bin/logfht @ "%""</code><br>
<!-- <code>define LogHToDB notify .*H:.* {DbLog("@","%")}</code><br> -->
<code>define LogUndef notify UNDEFINED "send-me-mail.sh "%""</code><br>
</ul>
<br>
Notes:
<ul>
<li>The character <code>%</code> will be replaced with the received event,
e.g. with <code>on</code> or <code>off</code> or <code>measured-temp: 21.7
(Celsius)</code><br> It is advisable to put the <code>%</code> into double
quotes, else the shell may get a syntax error.</li>
<li>The character <code>@</code> will be replaced with the device
name.</li>
<li>To use % or @ in the text itself, use the double mode (%% or @@).</li>
<li>Instead of <code>%</code> and <code>@</code>, the parameters
<code>%EVENT</code> (same as <code>%</code>), <code>%NAME</code>
(same as <code>@</code>) and <code>%TYPE</code> (contains the device
type, e.g. <code>FHT</code>) can be used. A single <code>%</code>
looses its special meaning if any of these parameters appears in the
definition.</li>
<li><code>&lt;pattern&gt;</code> may also be a compound of
<code>definition:event</code> to filter for events.</li>
<li><code>&lt;pattern&gt;</code> must completely (!)
match either the device name, or the compound of the device name and the
event. The event is either the string you see in the <a
href="#list">list</a> output in paranthesis after the device name, or the
string you see when you do a detailed list of the device.</li>
<li>To use database logging, copy the file contrib/91_DbLog.pm into your
modules directory, and change the $dbconn parameter in the file.</li>
<li>Each undefined device (FS20, HMS, FHT) will be reported with the
device name "UNDEFINED". The % parameter will contain the type (FS20,
HMS100T, etc) and device number, separated by a space.</li>
</ul>
</ul>
<a name="weblink"></a>
<h4>Type weblink</h4>
<ul>
<code>define &lt;name&gt; weblink [link|fileplot] &lt;argument&gt;</code>
<br><br>
This is a placeholder used with webpgm2 to be able to integrate links
into it, and to be able to put more than one gnuplot/SVG picture on one
page. It has no set or get methods.
Examples:
<ul>
<code>define wl_1 weblink link http://www.fhem.de</code><br>
<code>define wl_2 weblink fileplot &lt;logdevice&gt;:&lt;gnuplot-file&gt;:&lt;logfile&gt;</code><br>
</ul>
<br>
Notes:
<ul>
<li>Normally you won't have to define fileplot weblinks manually, as
FHEMWEB makes it easy for you, just plot a logfile (see
<a href="#logtype">logtype</a>) and convert it to weblink. Now you
can group these weblinks by putting them into rooms. If you convert
the current logfile to a weblink, it will always refer to the current
file (and not the one you originally specified).</li>
</ul>
</ul>
<a name="dummy"></a>
<h4>Type dummy</h4>
<ul>
<code>define &lt;name&gt; dummy</code>
<br><br>
Define a dummy. A dummy can take via <a href="#set">set</a> any values.
Used for programming.
Example:
<ul>
<code>define myvar dummy</code><br>
<code>set myvar 7</code><br>
</ul>
</ul>
</ul>
<a name="deleteattr"></a>
<h3>deleteattr</h3>
<ul>
<code>deleteattr &lt;devspec&gt; [&lt;attrname&gt;]</code> <br>
<br>
Delete either a single attribute (see the <a href="#attr">attr</a> command)
or all attributes for a device (if no &lt;attrname&gt; is defined).
See the <a href="#devspec">Device specification</a> section for details on
&lt;devspec&gt;.<br>
Examples:
<ul>
<code>deleteattr lamp follow-on-for-timer</code><br>
<code>deleteattr lamp</code><br>
</ul>
<br>
</ul>
<a name="delete"></a>
<h3>delete</h3>
<ul>
<code>delete &lt;devspec&gt;</code> <br>
<br>
Delete something created with the <a href="#define">define</a> command.
See the <a href="#devspec">Device specification</a> section for details on
&lt;devspec&gt;.<br>
Examples:
<ul>
<code>delete lamp</code><br>
</ul>
<br>
</ul>
<a name="get"></a>
<h3>get</h3>
<ul>
<code>get &lt;devspec&gt; &lt;type-specific&gt;</code>
<br><br>
Ask a value directly from the device, and wait for an answer. In general, you
can get a list of possible commands by<br><code>get &lt;device&gt; ?</code>
<br>
See the <a href="#devspec">Device specification</a> section for details on
&lt;devspec&gt;.<br>
<a name="FHZget"></a>
<h4>Type FHZ:</h4>
<ul>
<code>get FHZ &lt;value&gt;</code>
<br><br>
where <code>value</code> is one of:<br>
<pre>
init1
init2
init3
serial
fhtbuf</pre>
Notes:
<ul>
<li>The mentioned codes are needed for initializing the FHZ1X00</li>
<li>The answer for a command is also displayed by <code>list FHZ</code>
</li>
<li>
The FHZ1x00PC has a message buffer for the FHT (see the FHT entry in
the <a href="#set">set</a> section). If the buffer is full, then newly
issued commands will be dropped, if the attribute <a
href="#fhtsoftbuffer">fhtsoftbuffer</a> is not set.
<code>fhtbuf</code> returns the free memory in this buffer (in hex),
an empty buffer in the FHZ1000 is 2c (42 bytes), in the FHZ1300 is 4a
(74 bytes). A message occupies 3 + 2x(number of FHT commands) bytes,
this is the second reason why sending multiple FHT commands with one
<a href="#set"> set</a> is a good idea. The first reason is, that
these FHT commands are sent at once to the FHT.
</li>
</ul>
</ul>
<a name="EMget"></a>
<h4>Type EM:</h4>
<ul>
<code>get EM &lt;value&gt;</code>
<br><br>
where <code>value</code> is either version or time.
</ul>
<a name="EMWZget"></a>
<h4>Type EMWZ:</h4>
<ul>
<code>get EMWZ status</code>
<br><br>
This is the same command which is scheduled every 5 minutes internally.
</ul>
<a name="M232get"></a>
<h4>Type M232:</h4>
<ul>
<code>get &lt;name&gt; [an0..an5]</code>
<br><br>
Gets the reading of analog input 0..5 in volts.
<br><br>
<code>get &lt;name&gt; [io0..io7]</code>
<br><br>
Gets the state of digital ports 0..7, result is 0 or 1.
<br><br>
<code>get &lt;name&gt; octet</code>
<br><br>
Gets the state of all digital ports at once, result is 0..255.
<br><br>
<code>get &lt;name&gt; counter</code>
<br><br>
Gets the number of ticks of the counter since the last reset. The counter
wraps around from 65535 to 0.
<br><br>
</ul>
<a name="M232Counterget"></a>
<h4>Type M232Counter:</h4>
<ul>
<code>get &lt;name&gt; status</code>
<br><br>
Gets the reading of the counter multiplied by the factor from the
<code>define</code> statement. Wraparounds of the counter are accounted for
by an offset (see reading <code>basis</code> in the output of the
<code>list</code> statement for the device).
<br><br>
</ul>
<a name="WS2000get"></a>
<h4>Type WS2000:</h4>
<ul>
<code>get &lt;name&gt; list</code>
<br>
Gets the last reading of all received sensord
<br><br>
<code>get &lt;name&gt; [TH0..TH7, T0..T7, I0..I7, R0..R7, W0..W7, L0..L7, P0..P7,LAST,RAW]</code><br>
get the last reading for the name sensor, <br>
<code>LAST</code>: Last received Sensor
<br><br>
<code>RAW</code>: original Data from interface
<br><br>
</ul>
<a name="IPWEget"></a>
<h4>Type IPWE</h4>
<ul>
<code>get &lt;name&gt; status</code>
<br><br>
Gets actual data from device for sensors with data
<br><br>
<code>get &lt;name&gt; &lt; sensorname&gt; </code>
<br><br>
will grep output from device for this sensorname
<br><br>
</ul>
<a name="FileLogget"></a>
<h4>Type FileLog</h4>
<ul>
<code>get &lt;name&gt; &lt;infile&gt; &lt;outfile&gt; &lt;from&gt;
&lt;to&gt; &lt;column_spec&gt; </code>
<br><br>
Read data from the logfile.
<ul>
<li>&lt;infile&gt;<br>
Name of the logfile to grep. "-" is the current logfile, or you can
specify an older file (or a file from the archive).</li>
<li>&lt;outfile&gt;<br>
If it is "-", you get the data back on the current connection, else it
is the prefix for the output file. If more than one file is specified,
the data is separated by a comment line for "-", else it is written in
separate files, numerated from 0.
</li>
<li>&lt;from&gt; &lt;to&gt;<br>
Used to grep the data. The elements should correspond to the
timeformat or be an initial substring of it.</li>
<li>&lt;column_spec&gt;<br>
For each column_spec return a set of data in a separate file or
separated by a comment line on the current connection.<br>
Syntax: &lt;col&gt;:&lt;regexp&gt;:&lt;default&gt;:&lt;fn&gt;<br>
<ul>
<li>&lt;col&gt;
The column number to return, starting at 1 with the date.
If the column is enclosed in double quotes, then it is a fix text,
not a column nuber.</li>
<li>&lt;regexp&gt;
If present, return only lines containing the regexp. Case sensitive.
</li>
<li>&lt;default&gt;<br>
If no values were found and the default value is set, then return
one line containing the from value and this default. We need this
feature as gnuplot aborts if a dataset has no value at all.
</li>
<li>&lt;fn&gt;
One of the following:
<ul>
<li>int<br>
Extract the integer at the beginning og the string. Used e.g.
for constructs like 10%</li>
<li>delta-h or delta-d<br>
Return the delta of the values for a given hour or a given day.
Used if the column contains a counter, as is the case for the
KS300 rain column.</li>
<li>everything else<br>
The string is evaluated as a perl expression. @fld is the
current line splitted by spaces. Note: The string/perl
expression cannot contain spaces, as the part after the space
will be considered as the next column_spec.</li>
</ul></li>
</ul></li>
</ul>
<br><br>
Example:
<pre>get outlog out-2008.log - 2008-01-01 2008-01-08 4:IR:int: 9:IR::</pre>
<br><br>
</ul>
</ul>
<a name="include"></a>
<h3>include</h3>
<ul>
<code>include &lt;filename&gt;</code> <br>
<br>
Read in the file, and process every line as a fhem command. Makes
configuration files more modular and enables to reread them.
<br>
</ul>
<a name="inform"></a>
<h3>inform</h3>
<ul>
<code>inform [on|off]</code> <br>
<br>
If set to on, and a device state changes, send a notification to the current
client. This command can be used by other programs/modules to receive a
notification.
<br>
</ul>
<a name="list"></a>
<h3>list</h3>
<ul>
<code>list [devspec]</code>
<br><br>
Output a list of all definitions, all notify settings and all at
entries. This is one of the few commands which return a string in a
normal case.
See the <a href="#devspec">Device specification</a> section for details on
&lt;devspec&gt;.
<br><br>
Example:
<pre><code> FHZ> list
Type list <name> for detailed info.
Internal:
global (Internal)
FHZ:
FHZ (fhtbuf: 23)
FS20:
Btn4 (on-old-for-timer)
Roll1 (on)
Stehlampe (off)
FHT:
fl (measured-temp: 21.1 (Celsius))
KS300:
out1 (T: 2.9 H: 74 W: 2.2 R: 8.2 IR: no)
at:
at_rollup (Next: 07:00:00)
notify:
ntfy_btn4 (active)
FileLog:
avglog (active)
</code></pre>
If specifying <code>name</code>, then a detailed status for <code>name</code>
will be displayed, e.g.:
<pre><code> FHZ> list fl
Internals:
CODE 5102
DEF 5102
NAME fl
NR 15
STATE measured-temp: 21.1 (Celsius)
TYPE FHT
IODev FHZ
Attributes:
room Heizung
Readings:
2006-11-02 09:45:56 actuator 19%
2006-10-28 15:10:58 code_0000aa 17
2006-10-07 10:52:09 code_0000ba 0
2006-11-02 10:40:08 code_4b004b 0
2006-11-02 08:24:46 code_7e0067 0
2006-11-02 04:13:35 day-temp 21.0 (Celsius)
2006-11-02 06:03:37 desired-temp 21.0 (Celsius)
2006-11-02 04:13:31 fri-from1 06:00
2006-11-02 04:13:31 fri-to1 23:50
2006-11-02 04:13:36 lowtemp-offset 2.0 (Celsius)
2006-11-02 10:40:06 measured-high 0
2006-11-02 10:40:06 measured-low 211
2006-11-02 10:40:06 measured-temp 21.1 (Celsius)
2006-11-02 04:13:39 mode auto
2006-11-02 04:13:25 mon-from1 06:00
2006-11-02 04:13:25 mon-to1 23:00
2006-11-02 04:13:35 night-temp 18.0 (Celsius)
2006-11-02 04:13:32 sat-from1 08:00
2006-11-02 04:13:33 sat-to1 23:50
2006-11-02 04:13:34 sun-from1 08:00
2006-11-02 04:13:34 sun-to1 23:00
2006-11-02 04:13:29 thu-from1 06:00
2006-11-02 04:13:29 thu-to1 23:00
2006-11-02 04:13:26 tue-from1 06:00
2006-11-02 04:13:26 tue-to1 23:00
2006-11-02 10:40:07 warnings Battery low
2006-11-02 04:13:27 wed-from1 06:00
2006-11-02 04:13:28 wed-to1 23:00
2006-11-02 04:13:36 windowopen-temp 12.0 (Celsius)
Send buffer:<br/> 2007-10-19 00:31:24 desired-temp 22.5
2007-10-19 00:33:20 mode auto<br/>
</code></pre>
</ul>
<a name="modify"></a>
<h3>modify</h3>
<ul>
<code>modify &lt;name&gt; &lt;type-dependent-options&gt;</code>
<br><br>
Used to modify some definitions. Useful for changing some <a
href="#at">at</a> or <a href="#notify">notify</a> definitions. If specifying
one argument to an at type deinition, only the time part will be changed. In
case of a notify type definition, only the regex part will be changed. All
other values (state, attributes, etc) will remain intact.
<br><br>
Example:
<ul>
<code>define lampon at 19:00 set lamp on</code><br>
<code>modify lampon *19:00</code><br>
<code>modify lampon 19:00 set lamp on-for-timer 16</code><br>
</ul>
</ul>
<a name="quit"></a>
<h3>quit</h3>
<ul>
<code>quit</code>
<br><br>
If used in a TCP/IP session, terminate the client session.<br>
If used in a script, terminate the parsing of the current script.
<br><br>
Example:
<ul>
<code>quit</code>
</ul>
</ul>
<a name="reload"></a>
<h3>reload</h3>
<ul>
<code>reload &lt;module&gt;</code>
<br><br>
Reload the given module from the module directory. Mainly intended to reload
the 99_PRIV file (or equivalent) in order to test perl-scripts.
<br><br>
Example:
<ul>
<code>reload 99_PRIV</code>
</ul>
</ul>
<a name="rereadcfg"></a>
<h3>rereadcfg</h3>
<ul>
<code>rereadcfg</code>
<br><br>
Re-read the configuration file.
Note: The statefile will be saved first, then the config file will be read
(all devices will be initialized again), and at last the statefile will be reloaded again.
<br><br>
Example:
<ul>
<code>rereadcfg</code>
</ul>
</ul>
<a name="save"></a>
<h3>save</h3>
<ul>
<code>save [&lt;configfile&gt;]</code>
<br><br>
Save first the <a href="#statefile">statefile</a>, then the
<a href="#configfile">configfile</a> information. If a parameter is specified,
it will be used instead the global configfile attribute.<br><br>
Notes:
<ul>
<li>save only writes out definitions and attributes, but no commands
which were previously part of the config file. Put such commands in the
<a href="#lastinclude">lastinclude</a> file.
</ul>
</ul>
<a name="set"></a>
<h3>set</h3>
<ul>
<code>set &lt;devspec&gt; &lt;type-specific&gt;</code>
<br><br>
Set parameters of a device / send signals to a device. You can
get a list of possible commands by<br><code>set &lt;name&gt; ?</code>
<br>
See the <a href="#devspec">Device specification</a> section for details on
&lt;devspec&gt;.<br>
<a name="FHZset"></a>
<h4>Type FHZ:</h4>
<ul>
<code>set FHZ &lt;variable&gt; [&lt;value&gt]</code>
<br><br>
where <code>value</code> is one of:<br>
<pre>
initFS20
initHMS
time
FHTcode
activefor
raw</pre>
Notes:
<ul>
<li>use activefor if you have multiple FHZ devices, and you want to
change the association of an FS20 or FHT device (i.e. which device will
send out the messages).</li>
<li>raw is used to send out "raw" FS20/FHT messages. See the doc
directory for some examples</li>
<li>In order to set the time of your FHT's, schedule this command every
minute:<br>
<code>define fhz_timer at +*00:01:00 set FHZ time</code><br>
See the <a href="#loglevel">loglevel</a> to prevent logging of
this command.
</li>
<li>FHTcode is a two digit hex number (from 00 to 63?) and sets the
central FHT code, which is used by the FHT devices. After changing
it, you <b>must</b> reprogram each FHT80b with: PROG (until Sond
appears), then select CEnt, Prog, Select nA.</li>
</ul>
</ul>
<a name="FH20set"></a>
<h4>Type FS20:</h4>
<ul>
<code>set &lt;name&gt; &lt;value&gt; [&lt;time&gt]</code>
<br><br>
where <code>value</code> is one of:<br>
<pre>
dim06% dim12% dim18% dim25% dim31% dim37% dim43% dim50%
dim56% dim62% dim68% dim75% dim81% dim87% dim93% dim100%
dimdown
dimup
dimupdown
off
off-for-timer
on # dimmer: set to value before switching it off
on-for-timer # see the note
on-old-for-timer # set to previous (before switching it on)
ramp-on-time # time to reach the desired dim value on dimmers
ramp-off-time # time to reach the off state on dimmers
reset
sendstate
timer
toggle # between off and previous dim val
on-till # Special, see the note
</pre>
Examples:
<ul>
<code>set lamp on</code><br>
<code>set lamp1,lamp2,lamp3 on</code><br>
<code>set lamp1-lamp3 on</code><br>
<code>set lamp on-for-timer 12</code><br>
</ul>
<br>
Notes:
<ul>
<li>Use reset with care: the device forgets even the housecode.
</li>
<li>As the FS20 protocol needs about 0.22 seconds to transmit a
sequence, a pause of 0.22 seconds is inserted after each command.
</li>
<li>The FS20ST switches on for dim*%, dimup. It does not respond to
sendstate.</li>
<li>If the timer is set (i.e. it is not 0) then on, dim*,
and *-for-timer will take it into account (at least by the FS20ST).
</li>
<li>The <code>time</code> argument ranges from 0.25sec to 4 hours and
16 minutes.
As the time is encoded in one byte there are only 112 distinct
values, the resolution gets coarse with larger values. The program
will report the used timeout if the specified one cannot be set
exactly. The resolution is 0.25 sec from 0 to 4 sec, 0.5 sec from 4
to 8 sec, 1 sec from 8 to 16 sec and so on. If you need better
precision for large values, use <a href="#at">at</a> which has a 1
sec resolution.</li>
<li>If the attribute follow-on-for-timer is set for the device and the
on-for-timer command is sent to the device with a time parameter,
the program automatically schedules a "setstate off" for the
specified time.</li>
<li>on-till requires an absolute time in the "at" format (HH:MM:SS, HH:MM
or {<perl-code>}, where the perl-code returns a time specification).
If the current time is greater then the specified time, then the
command is ignored, else an "on" command is generated, and for the
given "till-time" an off command is scheduleld via the at command.
</li>
</ul>
</ul>
<a name="FHTset"></a>
<h4>Type FHT:</h4>
<ul>
<code>set &lt;name&gt; &lt;valuetype&gt; &lt;value&gt;</code>
<br><br>
where <code>value</code> is one of:<br>
<pre>
desired-temp
day-temp night-temp
report1 report2
mode
holiday1 holiday2 # Not verified
manu-temp # No clue what it does.
year month day hour minute
lowtemp-offset # Alarm-Temp.-Differenz
windowopen-temp
mon-from1 mon-to1 mon-from2 mon-to2
tue-from1 tue-to1 tue-from2 tue-to2
wed-from1 wed-to1 wed-from2 wed-to2
thu-from1 thu-to1 thu-from2 thu-to2
fri-from1 fri-to1 fri-from2 fri-to2
sat-from1 sat-to1 sat-from2 sat-to2
sun-from1 sun-to1 sun-from2 sun-to2
</pre>
Examples:
<ul>
<code>set wz desired-temp 22.5</code><br>
<code>set fl desired-temp 20.5 day-temp 19.0 night-temp 16.0</code><br>
</ul>
<br>
Notes:
<ul>
<li>Following events are reported (more or less regularly) by each FHT
device: <code>measured-temp actuator actuator1...actuator8 warnings</code><br>
You can use these strings for <a href="#notify">notify</a> or
<a href="#FileLog">FileLog</a> definitions.
<ul>
<li>warnings can contain following strings:
none, Battery low,Temperature too low, Window open,
Fault on window sensor
</li>
<li>actuator (without a suffix) stands for all actuators.
<li>actuator or actuator1..8 can take following values:
<ul>
<li>&lt;value&gt;%<br>
This is the normal case, the actuator is instructed to open to this value.
<li>offset &lt;value&gt;%<br>
The actuator is running with this offset.
<li>lime-protection<br>
The actuator was instructed to execute the lime-protection procedure.
<li>synctime<br>
If you select Sond/Sync on the FHT80B, you'll see a count down.
<li>test<br>
The actuator was instructed by the FHT80b to emit a beep.
<li>pair<br>
The the FHT80b sent a "you-belong-to-me" to this actuator.
</ul>
Note:
</ul>
<br>
<li>The FHT is very economical (or lazy), it accepts one message from the
FHZ1x00 every 2 minutes (or so). Don't be surprized if your command
is only accepted 10 minutes later by the device. FHT commands are
buffered in the FHZ1x00 till they are sent to the FHT, see the related
<code>fhtbuf</code> entry in the <code><a href="#get">get</a></code>
section.<br>
You can send up to 8 commands in one message at once to the FHT if
you specify them all as arguments to the same set command, see the
example above.<br><br>
<li>All <code>*-temp</code> values need a temperature
as argument, which will be rounded to 0.5 Celsius.<br/>
Temperature values must between 5.5 and 30.5 Celsius. Value 5.5 set
the actuator to OFF, value 30.5 set the actuator to ON<br><br>
<li><code>mode</code> is one of <code>auto, manual, holiday or
holiday_short.</code><br>
If the mode is holiday, then
<ul>
<li>holiday1 sets the end-day of the holiday</li>
<li>holiday2 sets the end-month of the holiday</li>
</ul>
For holiday_short
<ul>
<li>holiday1 sets the time, in 10-minute steps</li>
<li>holiday2 sets number of days from now on.</li>
</ul>
<br>
<li>The <code>*-from1/*-from2/*-to1/*-to2</code> valuetypes need a time
spec as argument in the HH:MM format. They define the periods, where
the day-temp is valid. The minute (MM) will be rounded to 10, and
24:00 means off.
<br><br>
<li>As the FHT stops sending the values every 5-10
days, it is adviseable to schedule following command regularly:<br>
<code>define fht_report at +*06:00:00
set &lt;name&gt; report1 255 report2 255</code>
<br><br>
<li><code>report1</code> with parameter 255 requests all settings for
monday till sunday to be sent. The argument is a bitfield, to request
unique values add up the following:
<ul>
<li> 1: monday
<li> 2: tuesday
<li> 4: thursday
<li> 8: wednesday
<li>16: friday
<li>32: saturday
<li>64: sunday
</ul>
measured-temp and actuator is sent along if it is considered appropriate
by the FHT.
<br><br>
<li><code>report2</code> with parameter 255 requests the following
settings to be reported: day-temp night-temp windowopen-temp
lowtemp-offset desired-temp measured-temp mode warnings.
The argument is (more or less) a bitfield, to request unique values
add up the following:
<ul>
<li> 1: warnings
<li> 2: mode
<li> 4: day-temp, night-temp, windowopen-temp
<li>64: lowtemp-offset
</ul>
measured-temp and actuator is sent along if it is considered appropriate
by the FHT.
<br><br>
<li><code>lowtemp-offset</code> needs a temperature as argument, valid
values must be between 1.0 and 5.0 Celsius.<br/> It will trigger a
warning if <code>desired-temp - measured-temp &gt;
lowtemp-offset</code> in a room for at least 1.5 hours after the last
desired-temp change. <br><br>
<li>FHEM optionally has an internal software buffer for FHT devices.
This buffer should prevent transmission errors. If there is no
confirmation for a given period, FHEM resends the command. You can
see the queued commands with <a href="#list">list</a>
&lt;fht-device&gt;.
See the <a href="#fhtsoftbuffer">fhtsoftbuffer</a>,
<a href="#retrycount">retrycount</a> and
<a href="#minfhtbuffer">minfhtbuffer</a> attributes for details.
<br><br>
<li>If a buffer is still in the softbuffer, it will be sent in the
following order:<br/> <code>desired-temp,mode,report1,report2,
holiday1,holiday2,day-temp,night-temp, [all other commands]</code>
<br><br>
</ul>
</ul>
<a name="WS300set"></a>
<h4>Type WS300:</h4>
<ul>
<code>set WS300Device &lt;interval(min.)&gt; &lt;height(m)&gt; &lt;rainvalume(ml)&gt;</code>
<br><br>
Set some WS300 configuration parameters.
</ul>
<a name="EMWZset"></a>
<h4>Type EMWZ:</h4>
<ul>
<code>set EMWZdevice &lt;param&gt; &lt;value&gt;</code><br><br>
where param is one of:
<ul>
<li>rperkw<br>
Number of rotations for a KiloWatt of the EM1000WZ device (actually
of the device where the EM1000WZ is attached to). Without setting
this correctly, all other readings will be incorrect.
<li>alarm<br>
Alarm in WATT. if you forget to set it, the default value is
rediculously low (random), and if a value above this threshold is
received, the EM1010PC will start beeping once every minute. It can
be very annoying.
<li>price<br>
The price of one KW in EURO (use e.g. 0.20 for 20 Cents). It is used
only on the EM1010PC display, it is of no interest for FHEM.
</ul>
</ul>
<h4>Type M232:</h4>
<ul>
<code>set &lt;name&gt; stop</code>
<br><br>
Stops the counter.
<br><br>
<code>set &lt;name&gt; start</code>
<br><br>
Resets the counter to zero and starts it.
<br><br>
<code>set &lt;name&gt; octet <value></code>
<br><br>
Sets the state of all digital ports at once, value is 0..255.
<br><br>
<code>set &lt;name&gt; [io0..io7] 0|1</code>
<br><br>
Turns digital port 0..7 off or on.
<br><br>
</ul>
<h4>Type M232Counter:</h4>
<ul>
<code>set &lt;name&gt; value &lt;value&gt;</code>
<br><br>
Sets the reading of the counter to the given value. The counter is reset
and started and the offset is adjusted to value/unit.
<br><br>
</ul>
<a name="FileLogset"></a>
<h4>Type FileLog:</h4>
<ul>
<code>set &lt;name&gt; reopen</code><br>
Used to reopen a FileLog after making some manual changes to the logfile.
<br>
</ul>
</ul>
<a name="setstate"></a>
<h3>setstate</h3>
<ul>
<code>setstate &lt;devspec&gt; &lt;value&gt;</code>
<br><br>
Set the "STATE" for <code>&lt;name&gt;</code> as shown in paranthesis in the
<a href="#list">list</a> command
to <code>&lt;value&gt;</code> without sending any signals to the device
itself. This command is also used in the <a href="#statefile">statefile</a>.
See the <a href="#devspec">Device specification</a> section for details on
&lt;devspec&gt;.
<br><br>
Examples:
<ul>
<pre>
setstate lamp on
</ul>
<br>
Note:
<ul>
<li>The statefile uses another version of this command, don't be surprised.
</li>
</ul>
</ul>
<a name="shutdown"></a>
<h3>shutdown</h3>
<ul>
<code>shutdown</code>
<br><br>
Shut down the server (after saving the <a href="#statefile">state information
</a>)
<br><br>
Example:
<ul>
<code>shutdown</code>
</ul>
</ul>
<a name="trigger"></a>
<h3>trigger</h3>
<ul>
<code>trigger &lt;devspec&gt; &lt;state&gt;</code>
<br><br>
Trigger a <a href="#notify">notify</a> definition.
See the <a href="#devspec">Device specification</a> section for details on
&lt;devspec&gt;.
<br><br>
Example:
<ul>
<code>trigger btn3 on</code>
</ul>
</ul>
<a name="sleep"></a>
<h3>sleep</h3>
<ul>
<code>sleep &lt;sec&gt;</code>
<br><br>
Sleep for a given amount, millisecond accuracy.
<br><br>
Example:
<ul>
<code>sleep 0.5</code><br>
<code>notify btn3 set lamp toggle;;sleep 0.5;;set lamp toggle</code>
</ul>
<br>
Note: As the server is <b>not</b> multithreaded, everything is blocked for
the given amount.<br>
</ul>
<a name="xmllist"></a>
<h3>xmllist</h3>
<ul>
<code>xmllist</code>
<br><br>
Returns an XML tree of all definitions, all notify settings and all at
entries. It is not intended for human consumption.
<br><br>
Example:
<pre> FHZ> xmllist
&lt;FHZINFO&gt;
&lt;internal_LIST&gt;
&lt;internal name="global" state="internal" sets="" attrs="room configfile logfile modpath pidfilename port statefile userattr verbose version"&gt;
&lt;INT key="DEF" value="&lt;no definition&gt;"/&gt;
&lt;INT key="NR" value="0"/&gt;
&lt;INT key="STATE" value="internal"/&gt;
[...]
</pre>
</ul>
<a name="devspec"></a>
<h3>Device specification</h3>
<ul>
The commands
<a href="#attr">attr</a>,
<a href="#deleteattr">deleteattr</a>,
<a href="#delete">delete</a>,
<a href="#get">get</a>,
<a href="#list">list</a>,
<a href="#set">set</a>,
<a href="#setstate">setstate</a>,
<a href="#trigger">trigger</a>
can take a more complex device specification as argument,
which will be expanded to a list of devices. A devspec can be:
<ul>
<li>a list of devices, separated by comma (,)</li>
<li>a range of devices, separated by dash (-)</li>
<li>a regular expression, if the the spec contains on e of the following
characters: ^*[]$</li>
</ul>
Example:
<ul>
<code>set lamp1,lamp2,lamp3 on</code><br>
<code>set lamp[1-3] on</code><br>
<code>set lamp.* on</code><br>
<code>set lamp1-lamp3 on</code><br>
<code>set lamp1-lamp3,lamp3 on</code><br>
</ul>
Notes:
<ul>
<li>first the spec is separated by komma, then the range or the regular
expression operations are executed.</li>
<li>if there is a device which xactly corresponds to the spec, then
no special processing is done.</li>
<li>the returned list can contain the same device more than once, so
int tha last example the list will contain lamp3 twice.</li>
</ul>
</ul>
<a name="perl"></a>
<h3>Perl specials</h3>
<ul>
<li>To use fhem commands from the perl expression, use the function "fhem",
which takes a string argument, this string will be evaluated as an fhem
command chain.<br>
Example:
<ul>
define n1 notify piri:on { fhem "set light on" }
</ul>
</li>
<li>
To make date and time handling easier, before evaluating a perl expression
the variables $sec, $min, $hour, $mday, $month, $year, $wday, $yday, $isdst
are set (see perldoc -f localtime), with the exception that $month is in the
range of 1 to 12, and $year is also corrected by 1900 (as one would normally
expect). Additionally $we is 1 if it is weekend (i.e $wday == 0 ||
$wday == 6), and 0 otherwise.
Example:
<ul>
define n2 notify piri:on { if($hour &gt; 18 || $hour &lt; 5) { fhem "set light on" } }
</ul>
</li>
<li>
<b>Note</b>: do not forget to escape the semicolon (;) with two semicolons
(;;), else your perl code will be interpreted as an fhem command and you
most certainly get syntax errors.
</li>
<li>
The current value (the string you see in paranthesis in the output of the
list command) is available in the <code>value</code> hash; to access it
use $value{&lt;devicename&gt;}<br>
If you need the old value (and time) of the currently triggered device,
then you can access it with <code>$oldvalue{$dev}{TIME}</code> and
<code>$oldvalue{$dev}{VAL}</code>.<br>
</li>
<li>
To access the numerical value of an FS20 command (e.g. toggle), use the
hash <code>fs20_c2b</code>. E.g. { Log 2, $fs20_c2b{"toggle"} }
</li>
<li>
By using the 99_SUNRISE_EL.pm module, you have access to the following
functions: <br>
<ul>
sunset_rel()<br>
sunset_abs()<br>
sunrise_rel()<br>
sunrise_abs()<br>
isday()<br>
</ul>
The _rel functions should be used as "at" spec, and the _abs functions as
argument to the on-till argument of the set command.<br>
isday returns 1 if the sun is visible, and 0 else.
</li>
</ul>
</body>
</html>