2008-07-28 12:34:30 +00:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>FHEMWEB Howto</title>
|
|
|
|
</head>
|
|
|
|
<body style="background-color: white;">
|
|
|
|
<h2>FHEMWEB Howto</h2>
|
|
|
|
|
|
|
|
<a href="#starting">Starting</a><br/>
|
2009-12-22 11:00:54 +00:00
|
|
|
<a href="#FHZ">Attaching an FHZ/CUL</a><br/>
|
2008-07-28 12:34:30 +00:00
|
|
|
<a href="#FS20rx">Configuring FS20 receivers</a><br/>
|
|
|
|
<a href="#FS20tx">Configuring FS20 transmitters</a><br/>
|
|
|
|
<a href="#FHT">Configuring FHT devices</a><br/>
|
|
|
|
<a href="#at">Timed commands / Notify</a><br/>
|
|
|
|
<a href="#rooms">FHEMWEB look and feel</a><br/>
|
|
|
|
<a href="#log">Logging data</a><br/>
|
|
|
|
<a href="#plot">Plotting logs</a><br/>
|
|
|
|
<a href="#tips">FHEMWEB tips</a><br/>
|
2009-05-23 07:32:08 +00:00
|
|
|
<a href="#structure">Complex structures</a><br/>
|
2008-07-28 12:34:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
<a name="starting"/>
|
|
|
|
<h3>Starting</h3>
|
|
|
|
<ul>
|
2009-12-05 09:00:12 +00:00
|
|
|
First install the Device::SerialPort (or Win32::SerialPort) perl module
|
|
|
|
with the command <code>"cpan -i Device::Serial"</code></br>
|
|
|
|
The default configuration will install fhem into /usr/local/bin,
|
|
|
|
/usr/local/lib/FHEM and /var/log/fhem. Edit the Makefile to change
|
|
|
|
this.
|
|
|
|
|
|
|
|
To install & start fhem type:<pre>
|
2008-07-28 12:34:30 +00:00
|
|
|
make install-pgm2
|
2009-02-11 12:58:22 +00:00
|
|
|
perl /usr/local/bin/fhem.pl /var/log/fhem/fhem.cfg</pre>
|
2008-07-28 12:34:30 +00:00
|
|
|
|
2009-12-05 09:00:12 +00:00
|
|
|
After starting, the logfile should look like:<pre>
|
2008-07-28 12:34:30 +00:00
|
|
|
2008.06.15 16:17:03 2: FHEMWEB port 8083 opened
|
|
|
|
2008.06.15 16:17:03 0: Server started (version ...)
|
|
|
|
</pre>
|
|
|
|
Connect to fhem with an internet browser:
|
|
|
|
<a href="http://localhost:8083/fhem">http://localhost:8083/fhem</a>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
<a name="FHZ"/>
|
2009-12-22 11:00:54 +00:00
|
|
|
<h3>Attaching an FHZ/CUL</h3>
|
2008-07-28 12:34:30 +00:00
|
|
|
<ul>
|
|
|
|
Attach the FHZ1000 or FHZ1300 to your computer, and look for a file named
|
|
|
|
/dev/ttyUSB0 or /dev/tts/USB0 (or /var/elv on the Fritz!Box).
|
|
|
|
Define it for fhem (by typing it in the
|
2009-12-05 09:00:12 +00:00
|
|
|
"Fhem cmd" input field in the browser):<pre>
|
2008-07-28 12:34:30 +00:00
|
|
|
define FHZ1 FHZ /dev/ttyUSB0</pre>
|
2009-12-05 09:00:12 +00:00
|
|
|
You can find details <a href="commandref.html#define">here</a> and
|
|
|
|
<a href="commandref.html#FHZ">here</a>. Instead of an FHZ you can also
|
|
|
|
use a <a href="commandref.html#CUL">CUL</a> with slightly different
|
2009-12-22 11:00:54 +00:00
|
|
|
parameters (define CUL CUL /dev/ttyACM0 1234).
|
2008-07-28 12:34:30 +00:00
|
|
|
|
2009-12-05 09:00:12 +00:00
|
|
|
<br><br>
|
|
|
|
<b>Note:</b> Don't forget to type "save" in the "Fhem cmd" input field of
|
|
|
|
the browser after defining a device or setting its attribute. Otherwise
|
|
|
|
the changes will disappear after the next start.</br><br> </ul>
|
2008-07-28 12:34:30 +00:00
|
|
|
|
2009-12-22 11:00:54 +00:00
|
|
|
<a name="autocreate"/>
|
|
|
|
<h3>Automatically creating transmitters</h3>
|
|
|
|
<ul>
|
|
|
|
The sample configuration file installed via "make install-pgm2" has
|
|
|
|
configured an <a href="commandref.html#autocreate">autocreate</a>
|
|
|
|
instance. This will automatically create fhem devices upon reception
|
|
|
|
of a message form this device (typically a sensor like S300 or FHT).
|
|
|
|
Just wait for a while, and re-check your browser for newly appeared
|
|
|
|
devices. You can use <a href="commandref.html#rename"> rename</a> to
|
|
|
|
rename the automatically created device, e.g. type in the input field of
|
|
|
|
the web frontend:<pre>
|
|
|
|
rename FHT_1234 fht.kitchen</pre>
|
|
|
|
</ul>
|
|
|
|
|
2008-07-28 12:34:30 +00:00
|
|
|
|
|
|
|
<a name="FS20rx"/>
|
|
|
|
<h3>Configuring FS20 receivers</h3>
|
|
|
|
<ul>
|
2009-12-05 09:00:12 +00:00
|
|
|
Configure the <a href="commandref.html#FS20">FS20</a> device in
|
|
|
|
fhem first with:<pre>
|
2008-07-28 12:34:30 +00:00
|
|
|
define lamp1 FS20 1234 56</pre>
|
2009-12-05 09:00:12 +00:00
|
|
|
|
2008-07-28 12:34:30 +00:00
|
|
|
Now press the button on the device for a while until its LED starts to
|
|
|
|
blink. Click on the "on" link in the fhem window to send a command. The
|
2009-12-05 09:00:12 +00:00
|
|
|
LED should terminate blinking, the device is programmed to housecode
|
|
|
|
1234, device code 56. You can also use the 4-base ELV notation.
|
|
|
|
Now set the model attribute of the device:<pre>
|
2008-07-28 12:34:30 +00:00
|
|
|
attr lamp1 model fs20st</pre>
|
2009-12-05 09:00:12 +00:00
|
|
|
|
2008-07-28 12:34:30 +00:00
|
|
|
to get only the commands available for this device.
|
|
|
|
<a href="commandref.html#model">Here</a> is a complete list of models.<br>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<a name="FS20tx"/>
|
2009-12-05 09:00:12 +00:00
|
|
|
<h3>Misc. RF transmitters (FS20/EM/S300 etc.)</h3>
|
2008-07-28 12:34:30 +00:00
|
|
|
<ul>
|
2009-12-05 09:00:12 +00:00
|
|
|
Wait a while, until the transmitter sent some data. In the logfile
|
|
|
|
(Browser window: "All together" -> Logs:Logfile:text) a line
|
|
|
|
will appear:<pre>
|
|
|
|
FS20 Unknown device <HOUSECODE, Button <BTN> Code <CDE>, please define it</pre>
|
2008-07-28 12:34:30 +00:00
|
|
|
|
|
|
|
Now define a device:<pre>
|
2009-12-05 09:00:12 +00:00
|
|
|
define piri1 FS20 <HOUSECODE> <BTN></pre>
|
|
|
|
|
2008-07-28 12:34:30 +00:00
|
|
|
Set the model attribute of the device:<pre>
|
|
|
|
attr lamp1 model fs20piri</pre>
|
2009-12-05 09:00:12 +00:00
|
|
|
|
2008-07-28 12:34:30 +00:00
|
|
|
to get only the commands available for this device.
|
2009-12-05 09:00:12 +00:00
|
|
|
<a href="commandref.html#model">Here</a> is a complete list of FS20
|
|
|
|
models.<br> For other device-types similar messages should appear.
|
|
|
|
</ul>
|
2008-07-28 12:34:30 +00:00
|
|
|
</ul>
|
|
|
|
|
|
|
|
<a name="FHT"/>
|
|
|
|
<h3>Configuring FHT devices</h3>
|
|
|
|
<ul>
|
2009-12-05 09:00:12 +00:00
|
|
|
Wait for a while (2-5 mins) till the FHT is sending some signals. In the
|
|
|
|
logfile ("All together" -> Logs:LogFile:text) a line should
|
|
|
|
appear:<br><pre>
|
|
|
|
FHZ1: Unknown FHT device detected, define one to get detailed information</pre>
|
2008-07-28 12:34:30 +00:00
|
|
|
|
2009-12-05 09:00:12 +00:00
|
|
|
Define your FHT device with an arbitrary code in order to load the FHT
|
|
|
|
module, see <a href="commandref.html#FHT">this</a> link for details:<pre>
|
|
|
|
define MyFHT FHT 1111</pre>
|
|
|
|
|
|
|
|
The next message in the log will contain more details:<pre>
|
|
|
|
FHT Unknown device <HOUSECODE>, please define it</pre>
|
|
|
|
|
|
|
|
Delete and create your device again:<pre>
|
|
|
|
delete MyFHT
|
|
|
|
define MyFHT FHT <HOUSECODE></pre>
|
|
|
|
|
|
|
|
If there is no signal for a while, then check <a href="faq.html#faq6">
|
2008-07-28 12:34:30 +00:00
|
|
|
this</a> FAQ entry.
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<a name="at"/>
|
|
|
|
<h3>Timed commands / Notification</h3>
|
|
|
|
<ul>
|
|
|
|
To execute commands at a given time / periodically, you have to define
|
|
|
|
devices of the type at. See the definition <a href="commandref.html#at">
|
2009-12-05 09:00:12 +00:00
|
|
|
here</a> and the examples <a href="example.06_at">here</a> The last link
|
|
|
|
only works if you are reading this HOWTO from your fhem Web.<br/><br/>
|
|
|
|
|
|
|
|
To execute commands if a device sent a message you have to define
|
|
|
|
devices of the type <a href="commandref.html#notify">notify</a> or
|
|
|
|
<a href="commandref.html#watchdog">watchdog</a>. In order to understand
|
|
|
|
the fhem events better you can open a telnet session to your fhem<pre>
|
|
|
|
telnet localhost 7072</pre>
|
|
|
|
|
|
|
|
and type <pre>
|
|
|
|
inform timer</pre>
|
|
|
|
|
|
|
|
Now you will receive in this telnet session all events, just like the
|
|
|
|
notifies/watchdogs do. You can even simulate events by using the
|
|
|
|
<a href="commandref.html#trigger">trigger</a> command:<pre>
|
|
|
|
trigger lamp1 on</pre>
|
2008-07-28 12:34:30 +00:00
|
|
|
</ul>
|
|
|
|
|
|
|
|
<a name="rooms"/>
|
|
|
|
<h3>FHEMWEB look and feel.</h3>
|
|
|
|
<ul>
|
|
|
|
It makes sense to group your devices into rooms by setting the room
|
|
|
|
attribute. FHEMWEB puts devices without a room attribute into the
|
|
|
|
"Unsorted" room. Devices in the room "hidden" will not be shown.
|
|
|
|
<br/><br/>
|
|
|
|
|
|
|
|
Set the title of the webpage by setting the title attribute of the global
|
|
|
|
device ("All together" -> global)<br/><br/>
|
|
|
|
|
|
|
|
Edit the colors / fonts by changing the style.css ("Edit files" ->
|
|
|
|
style.css)<br/><br/>
|
|
|
|
|
|
|
|
Further FHEMWEB attributes:
|
|
|
|
<a href="commandref.html#webname">webname</a>,
|
|
|
|
<a href="commandref.html#plotmode">plotmode</a>,
|
|
|
|
<a href="commandref.html#plotsize">plotsize</a>.
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<a name="log"/>
|
|
|
|
<h3>Logging data</h3>
|
|
|
|
<ul>
|
|
|
|
To log messages into files, define devices of the type <a
|
|
|
|
href="commandref.html#FileLog">FileLog</a>. To log messages into a
|
|
|
|
database, see the contrib/dblog directory in the fhem
|
|
|
|
distribution.<br/><br/>
|
|
|
|
|
|
|
|
FHEMWEB has builtin support for displaying FileLog type logs as plots,
|
|
|
|
see the <a href="#plot">plot</a> section below.<br/><br/>
|
|
|
|
|
2009-12-05 09:00:12 +00:00
|
|
|
The size of each logfile will be determined by its wildcard characters
|
|
|
|
(year/month/week/day), look at the <a href="commandref.html#FileLog">
|
|
|
|
FileLog</a> definition.
|
|
|
|
Don't forget to enable archiving with the <a
|
|
|
|
href="commandref.html#nrarchive">nrarchive</a> or <a
|
|
|
|
href="commandref.html#archivedir">archivecmd</a> attributes.
|
2008-07-28 12:34:30 +00:00
|
|
|
</ul>
|
|
|
|
|
|
|
|
<a name="plot"/>
|
|
|
|
<h3>Plotting logs</h3>
|
|
|
|
<ul>
|
|
|
|
To convert a log into a plot in FHEMWEB, set the
|
|
|
|
<a href="commandref.html#logtype">logtype</a> attribute of the
|
|
|
|
corresponding FileLog. Take a look at the available gnuplot files in the
|
|
|
|
"Edit files" section, they contain the corresponding FileLog definition
|
|
|
|
example.<br/><br/>
|
|
|
|
|
|
|
|
When displaying the plot, you can convert it into a "weblink", which can
|
|
|
|
in turn have a room attribute, to group more than one Plot together. If
|
|
|
|
the weblink refers to the current logfile, then it will be stored as a
|
2009-12-05 09:00:12 +00:00
|
|
|
CURRENT weblink, and it will always display the most recent log (you do
|
|
|
|
not have to redefine it if the logfile changes due to year/month/date
|
|
|
|
parameters in its name).
|
|
|
|
|
2008-07-28 12:34:30 +00:00
|
|
|
<br/><br/>
|
|
|
|
|
|
|
|
The logs can be converted to a plot either with gnuplot (which must be
|
|
|
|
installed and in your PATH), or via the builtin SVG module, in this case
|
2009-12-05 09:00:12 +00:00
|
|
|
your internet browser must support SVG. Firefox, opera and the
|
|
|
|
iPhone/Android borwser support SVG out of the box, Internet Explorer does
|
|
|
|
it via the Adobe "SVG viewer" plugin. To use SVG graphics, set the <a
|
2008-07-28 12:34:30 +00:00
|
|
|
href="commandref.html#plotmode">plotmode</a> attribute to SVG.<br><br>
|
|
|
|
|
2009-12-05 09:00:12 +00:00
|
|
|
To zoom in the log you have to set plotmode to gnuplot-scroll or SVG. The
|
2008-07-28 12:34:30 +00:00
|
|
|
gnuplot files must have #FileLog entries in order to be useable with
|
2009-12-05 09:00:12 +00:00
|
|
|
scrolling, see the supplied gnuplot files for an example.<br><br>
|
2008-07-28 12:34:30 +00:00
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<a name="tips"/>
|
|
|
|
<h3>FHEMWEB tips</h3>
|
|
|
|
<ul>
|
|
|
|
You can first set an attribute to an arbitrary (wrong) value, then click
|
|
|
|
on the attribute: you will be guided to the correct place in the
|
|
|
|
documentation; now you can change the attribute value to the correct
|
|
|
|
one.<br/><br/>
|
|
|
|
|
|
|
|
Password/HTTPS<br>
|
|
|
|
These features are implemented by apache, and apache must be configured
|
|
|
|
to redirect the page to 01_FHEMWEB.pm. For this purpose add the following
|
|
|
|
lines to your httpd.conf:<pre>
|
|
|
|
<Proxy *>
|
|
|
|
AuthType Basic
|
|
|
|
AuthName "Password Required"
|
|
|
|
AuthUserFile /home/httpd/etc/passwd
|
|
|
|
Require valid-user
|
|
|
|
Allow from 127.0.0.1
|
|
|
|
</Proxy>
|
|
|
|
ProxyPass /fhem http://localhost:8083/fhem
|
|
|
|
ProxyPassReverse /fhem http://localhost:8083/fhem</pre>
|
|
|
|
|
|
|
|
and then restart httpd with apachectl graceful. To create the password
|
|
|
|
file, execute<br/>
|
|
|
|
htpasswd -c /home/httpd/etc/passwd <username>
|
|
|
|
<br/><br/>
|
|
|
|
|
|
|
|
To enable HTTPS, please check the web. In essence:<br>
|
|
|
|
<ul>
|
|
|
|
<li>Edit httpd.conf, add:<pre>
|
|
|
|
LoadModule ssl_module lib/apache/mod_ssl.so
|
|
|
|
Include /etc/httpd/conf/ssl.conf</pre></li>
|
|
|
|
<li>Create a server certificate</li>
|
|
|
|
<li>Start httpd with the startssl option (SSL or the like must be set in
|
|
|
|
one of your system files, look at /etc/init.d/httpd).</li>
|
|
|
|
</ul>
|
2008-08-08 10:46:25 +00:00
|
|
|
<br/><br/>
|
|
|
|
|
|
|
|
To display "foreign" (non fhem) files as a plot or a just as plain text,
|
|
|
|
configure a fake logfile with the correct filename and an unused regexp,
|
|
|
|
e.g.<br><pre>
|
2009-12-05 09:00:12 +00:00
|
|
|
define messages FileLog /var/log/messages fakelog</pre>
|
2009-05-23 07:32:08 +00:00
|
|
|
</ul>
|
2009-12-05 09:00:12 +00:00
|
|
|
<br>
|
2008-07-28 12:34:30 +00:00
|
|
|
|
2009-05-23 07:32:08 +00:00
|
|
|
<a name="structure"/>
|
|
|
|
<h3>Complex structures</h3>
|
|
|
|
<ul>
|
|
|
|
Put your devices in different rooms. You can now use the
|
|
|
|
room=<roomname> specification to set different devices at once.
|
|
|
|
See the <a href="commandref.html#devspec">devspec</a> paragraph for details.<br>
|
|
|
|
For more complex scenarios consider the <a href="commandref.html#structure">
|
|
|
|
structure</a> module. You can define different structure levels like
|
|
|
|
floors, buildings, etc. and set all elements of a gives structure at once.
|
|
|
|
</ul>
|
2008-07-28 12:34:30 +00:00
|
|
|
|
|
|
|
<body>
|
|
|
|
</html>
|