mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
c5f04f5c28
git-svn-id: https://svn.fhem.de/fhem/trunk@90 2b470e98-0d58-463d-a4d8-8e2adae1ed80
1589 lines
51 KiB
HTML
1589 lines
51 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="#defattr">defattr</a><br>
|
|
<a href="#define">define</a><br>
|
|
<a href="#delattr">delattr</a><br>
|
|
<a href="#delete">delete</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="#setstate">setstate</a><br>
|
|
<a href="#shutdown">shutdown</a><br>
|
|
<a href="#trigger">trigger</a><br>
|
|
<a href="#sleep">sleep</a><br>
|
|
<a href="#xmllist">xmllist</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>
|
|
<NL> </code>(This newline switches into "prompt" mode)<code><br>
|
|
<command>...<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>
|
|
|
|
If commands are read from a file, then a line ending with \ will be
|
|
concatenated with the next one, so long lines (e.g. perl oneliners) can be
|
|
split in multiple lines<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 <name> <attrname> [<value>] </code><br>
|
|
or <br>
|
|
<code>attr at <at-spec-regexp> <attribute> </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 <name> ?" to get a list of possible attributes.
|
|
<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 <lastinclude-value><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. Every file there with the
|
|
name pattern <number>_<name>.pm will be loaded in the order
|
|
of the number.
|
|
</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><number></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="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 - it will only tell you when the server was started, or
|
|
stopped</li>
|
|
<li>1 - it logs all error messages or unknown packets</li>
|
|
<li>2 - it logs all signals received or sent in a "digested"
|
|
format,</li>
|
|
<li>3 - it logs the signals for undefined devices,</li>
|
|
<li>4 - it logs the TCP/IP connections and the called programs with
|
|
parameters,</li>
|
|
<li>5 - is for 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/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 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).
|
|
</li>
|
|
</ul>
|
|
The corresponding gnuplot files (up to the "text" one) must be
|
|
installed, see the fhemweb.pl configuration for the destination
|
|
directory.<br>
|
|
|
|
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:
|
|
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
|
|
|
|
</li>
|
|
|
|
<li>HMS: hms100-t hms100-tf hms100-wd hms100-mg hms100-tfk rm100-2</li>
|
|
<li>KS300: ks300</li>
|
|
<li>WS300: ws300pc</li>
|
|
<li>EM1010: em1010pc</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>
|
|
|
|
</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>
|
|
</ul>
|
|
<br>
|
|
|
|
Notes:<br>
|
|
<ul>
|
|
<li>See <a href="#delattr">delattr</a> to delete attributes.</li>
|
|
</ul>
|
|
</ul>
|
|
|
|
<a name="defattr"></a>
|
|
<h3>defattr</h3>
|
|
<ul>
|
|
<code>defattr [<attrname> [<value>]] </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>defattr room kitchen</code><br>
|
|
<code>defattr 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>defattr</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 <name> <type> <type-specific></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 <name> ?" to get a list of possible types.
|
|
<br>
|
|
|
|
<a name="FHZ"></a>
|
|
<h4>Type FHZ</h4>
|
|
<ul>
|
|
<code>define <name> FHZ <serial-device></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>.
|
|
</ul>
|
|
<br>
|
|
|
|
<a name="FS20"></a>
|
|
<h4>Type FS20</h4>
|
|
<ul>
|
|
<code>define <name> FS20 <housecode> <button>
|
|
[fg <fgaddr>] [lm <lmaddr>] [gm FF] </code>
|
|
<br><br>
|
|
|
|
<code><housecode></code> is a four digit hex number,
|
|
corresponding to the housecode address, <code><button></code> is
|
|
a two digit hex nunmber, corresponding to a button of the transmitter.<br>
|
|
<li>The optional fg specifies the function group, the first digit of the 2
|
|
digit adress must be F.</li>
|
|
<li>The optional lm specifies the local master, the last digit of the 2
|
|
digit adress must be F.</li>
|
|
<li>The optional gm specifies the global master, the adress must be FF.</li>
|
|
<br>
|
|
|
|
Examples:
|
|
<ul>
|
|
<code>define lamp FS20 7777 00 fg F1</code><br>
|
|
<code>define roll1 FS20 7777 01</code>
|
|
</ul>
|
|
</ul>
|
|
<br>
|
|
|
|
<a name="FHT"></a>
|
|
<h4>Type FHT</h4>
|
|
<ul>
|
|
<code>define <name> FHT <housecode></code>
|
|
<br><br>
|
|
|
|
<code><housecode></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 section <a href="#set">set</a> for more.
|
|
</ul>
|
|
<br>
|
|
|
|
<a name="HMS"></a>
|
|
<h4>Type HMS</h4>
|
|
<ul>
|
|
<code>define <name> HMS <housecode></code>
|
|
<br><br>
|
|
|
|
<code><housecode></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 HMS100T, HMS100TF, HMS100WD and
|
|
the 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 HMS100TF</li>
|
|
<li>1001 for the HMS100T</li>
|
|
<li>1002 for the HMS100WD</li>
|
|
<li>1003 for the RM100-2</li>
|
|
<li>1006 for the HMS100MG</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 <name> KS300 <housecode> [ml/raincounter [wind-factor]]</code>
|
|
<br><br>
|
|
|
|
<code><housecode></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 <serial device><br>
|
|
or<br>
|
|
<code>define <devname> WS300 [0-9]<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 <name> EM <em1010pc-device></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 <name> EMWZ <device-number></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 <name> EMEM <device-number></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="SCIVT"></a>
|
|
<h4>Type SCIVT</h4>
|
|
<ul>
|
|
<code>define <name> SCIVT <SCD-device></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="FileLog"></a>
|
|
<h4>Type FileLog</h4>
|
|
<ul>
|
|
<code>define <name> FileLog <filename> <regexp></code>
|
|
<br><br>
|
|
|
|
Log events to <code><filename></code>. The log format is
|
|
<pre>
|
|
YYYY:MM:DD_HH:MM:SS <device> <event></pre>
|
|
The regexp will be checked against the (complete!) device name
|
|
or against the (complete!) devicename:event combination.
|
|
<br>
|
|
<code><filename></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="at"></a>
|
|
<h4>Type at</h4>
|
|
<ul>
|
|
<code>define <name> at <timespec> <command></code><br>
|
|
<br>
|
|
Start an arbitrary fhem.pl command at a later time.<br>
|
|
<code><timespec></code> format: [+][*{N}]<timedet><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>
|
|
<timedet> 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.pm in the FHEM directory to have sunset_rel()
|
|
{ sunrise_coord("8.686", "50.112", "Europe/Berlin") }
|
|
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, copy the
|
|
99_SUNRISE.pm file from the contrib into the modules (FHEM)
|
|
directory, and put { sunrise_coord(long, lat, tz) } into your config
|
|
file, as in the above example. If you are not using sunrise_coord, then
|
|
the coordinates for Frankfurt am Main, Germany will be used.
|
|
You also have to install the Datetime::Event::Sunrise perl module.
|
|
</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="notify"></a>
|
|
<h4>Type notify</h4>
|
|
<ul>
|
|
<code>define <name> notify <pattern> <command></code>
|
|
<br><br>
|
|
Execute a command when received an event for the <a
|
|
|
|
href="#define">definition</a> <code><pattern></code>. If
|
|
<command> 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.<br>
|
|
To use % or @ in the text itself, use the double mode (%% or @@)</li>
|
|
|
|
<li>The character <code>@</code> will be replaced with the device
|
|
name.</li>
|
|
|
|
<li><code><pattern></code> may also be a compound of
|
|
<code>definition:event</code> to filter for events.</li>
|
|
|
|
<li><code><pattern></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.p 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>
|
|
|
|
</ul>
|
|
|
|
|
|
<a name="delattr"></a>
|
|
<h3>delattr</h3>
|
|
<ul>
|
|
<code>delattr <name> [<attrname>]</code> <br>
|
|
<br>
|
|
Delete either a single attribute (see the <a href="#attr">attr</a> command)
|
|
or all attributes for a device (if no <attrname> is defined).<br>
|
|
|
|
Examples:
|
|
<ul>
|
|
<code>delattr lamp follow-on-for-timer</code><br>
|
|
<code>delattr lamp</code><br>
|
|
</ul>
|
|
<br>
|
|
</ul>
|
|
|
|
<a name="delete"></a>
|
|
<h3>delete</h3>
|
|
<ul>
|
|
<code>delete <name></code> <br>
|
|
<br>
|
|
Delete something created with the <a href="#define">define</a> command.
|
|
<br>
|
|
Examples:
|
|
<ul>
|
|
<code>delete lamp</code><br>
|
|
</ul>
|
|
<br>
|
|
</ul>
|
|
|
|
<a name="get"></a>
|
|
<h3>get</h3>
|
|
<ul>
|
|
<code>get <name> <type-specific></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 <device> ?</code>
|
|
<br>
|
|
Right now only the FHZ module supports this function.
|
|
|
|
<h4>Type FHZ:</h4>
|
|
<ul>
|
|
<code>get FHZ <value></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 FHZ1000PC has a message buffer for the FHT, as it
|
|
only can send messages to it every 2 (or so) minutes. If the buffer
|
|
is full, then newly issued ones will be dropped. <code>fhtbuf</code>
|
|
returns the free memory in this buffer (in hex), my maximum is 2c (42
|
|
bytes).</code></li>
|
|
</ul>
|
|
</ul>
|
|
|
|
<h4>Type EM:</h4>
|
|
<ul>
|
|
<code>get EM <value></code>
|
|
<br><br>
|
|
where <code>value</code> is either version or time.
|
|
</ul>
|
|
|
|
<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>
|
|
</ul>
|
|
|
|
|
|
<a name="include"></a>
|
|
<h3>include</h3>
|
|
<ul>
|
|
<code>include <filename></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 [name]</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.
|
|
<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:11:30 init 255
|
|
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 10:40:07 state Bat: ok, Window: closed
|
|
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 04:13:36 unknown_85 4
|
|
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)
|
|
|
|
</code></pre>
|
|
</ul>
|
|
|
|
|
|
<a name="modify"></a>
|
|
<h3>modify</h3>
|
|
<ul>
|
|
<code>modify <name> <type-dependent-options></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 <module></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 [<configfile>]</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 <name> <type-specific></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 <name> ?</code>
|
|
<br>
|
|
Instead of <name> you can also use an enumeration (separated by comma)
|
|
or ranges (separated by -), see the FS20 examples.
|
|
|
|
<a name="FHZset"></a>
|
|
<h4>Type FHZ:</h4>
|
|
<ul>
|
|
<code>set FHZ <variable> [<value>]</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 <name> <value> [<time>]</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 <name> <valuetype> <value></code>
|
|
<br><br>
|
|
where <code>value</code> is one of:<br>
|
|
<pre>
|
|
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
|
|
mode
|
|
holiday1
|
|
holiday2
|
|
mode
|
|
desired-temp
|
|
day-temp
|
|
night-temp
|
|
year
|
|
month
|
|
day
|
|
hour
|
|
minute
|
|
refreshvalues</pre>
|
|
Notes:
|
|
<ul>
|
|
<li>All <code>*-temp</code> values need a temperature
|
|
as argument, which will be rounded to 0.5 Celsius</li>
|
|
<li><code>mode</code> is one of <code>auto, manual, holiday or
|
|
holiday_short.<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>
|
|
</li>
|
|
<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.</li>
|
|
<li><code>refreshvalues</code> does not need an argument, but sends a
|
|
plea to the FHT device, so it may send its parameters. If you want
|
|
to get these values regularly, then schedule:<br>
|
|
<code>at +*01:00:00 set <name> refreshvalues</code><br>
|
|
</li>
|
|
<li>The FHT is very economical (or lazy), it receives messages from the
|
|
FHZ1000 every 2 minutes (or so). Don't be surprized if your command
|
|
is accepted 10 minutes later by the device. See the related
|
|
<code>fhtbuf</code> entry in the <code><a href="#get">get</a></code>
|
|
section.
|
|
</ul>
|
|
</ul>
|
|
|
|
<a name="WS300set"></a>
|
|
<h4>Type WS300:</h4>
|
|
<ul>
|
|
<code>set WS300Device <interval(min.)> <height(m)> <rainvalume(ml)>
|
|
<br><br>
|
|
Set some WS300 configuration parameters.
|
|
</ul>
|
|
|
|
<a name="EMWZset"></a>
|
|
<h4>Type EMWZ:</h4>
|
|
<ul>
|
|
<code>set EMWZdevice <param> <value><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>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
<a name="setstate"></a>
|
|
<h3>setstate</h3>
|
|
<ul>
|
|
<code>setstate <name> <value></code>
|
|
<br><br>
|
|
Set the "STATE" for <code><name></code> as shown in paranthesis in the
|
|
<a href="#list">list</a> command
|
|
to <code><value></code> without sending any signals to the device
|
|
itself. This command is also used in the <a href="#statefile">statefile</a>.
|
|
<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 <dev> <state></code>
|
|
<br><br>
|
|
Trigger a <a href="#notify">notify</a> definition.
|
|
<br><br>
|
|
Example:
|
|
<ul>
|
|
<code>trigger btn3 on</code>
|
|
</ul>
|
|
</ul>
|
|
|
|
<a name="sleep"></a>
|
|
<h3>sleep</h3>
|
|
<ul>
|
|
<code>sleep <sec></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
|
|
<FHZINFO>
|
|
<internal_LIST>
|
|
<internal name="global" state="internal" sets="" attrs="room configfile logfile modpath pidfilename port statefile userattr verbose version">
|
|
<INT key="DEF" value="<no definition>"/>
|
|
<INT key="NR" value="0"/>
|
|
<INT key="STATE" value="internal"/>
|
|
[...]
|
|
|
|
</pre>
|
|
</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 > 18 || $hour < 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{<devicename>}<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>
|
|
If you add the 99_SUNRISE.pm from the contrib directory to your module
|
|
directory (NOTE: you have to install the Perl module
|
|
DateTime::Event::Sunrise first), then you have access to the follwing
|
|
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>
|