2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00
fhem-mirror/fhem/docs/HOWTO.html
rudolfkoenig f65b113026 Howto moving
git-svn-id: https://svn.fhem.de/fhem/trunk@218 2b470e98-0d58-463d-a4d8-8e2adae1ed80
2008-07-28 12:34:30 +00:00

232 lines
9.1 KiB
HTML

<html>
<head>
<title>FHEMWEB Howto</title>
</head>
<body style="background-color: white;">
<h2>FHEMWEB Howto</h2>
<b>Note:</b> Don't forget to type "save" in the FHEMWEB/pgm2 "Fhem cmd"
input field after defining a device or setting its attribute. Otherwise the
changes will disappear after the next start.</br><br>
<a href="#starting">Starting</a><br/>
<a href="#FHZ">Attaching an FHZ device</a><br/>
<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/>
<a name="starting"/>
<h3>Starting</h3>
<ul>
Install & start fhem with the command:<pre>
make install-pgm2
perl /usr/local/bin/fhem.pl fhem.cfg</pre>
The logfile should look like:<pre>
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"/>
<h3>Attaching an FHZ device</h3>
<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
"Fhem cmd" input widget):<pre>
define FHZ1 FHZ /dev/ttyUSB0</pre>
Look <a href="commandref.html#define">here</a> for more.
</ul>
<a name="FS20rx"/>
<h3>Configuring FS20 receivers</h3>
<ul>
Configure the device in fhem first e.g. with:<pre>
define lamp1 FS20 1234 56</pre>
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
LED should terminate blinking, the device is programmed.<br/>
Set the model attribute of the device:<pre>
attr lamp1 model fs20st</pre>
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"/>
<h3>Configuring FS20 transmitters</h3>
<ul>
Make sure the global loglevel is at least 3 (attr global verbose 3, check
the fhem.cfg file in the Edit files section).<br>
Now make sure that the transmitter is sending a signal. In the logfile
(FHEMWEB: "All together" -> Logs -> Logfile -> text) a line should
appear:<pre> FS20 Unknown device HOUSECODE, Button BTN Code CDE, please
define it</pre>
Now define a device:<pre>
define piri1 FS20 HOUSECODE BTN</pre>
Set the model attribute of the device:<pre>
attr lamp1 model fs20piri</pre>
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="FHT"/>
<h3>Configuring FHT devices</h3>
<ul>
Make sure the global loglevel is at least 3 (attr global verbose 3, check
the fhem.cfg file in the Edit files section).<br>
Now wait for a while, till the FHT is sending some signals. In the
logfile (FHEMWEB: "All together" -> Logs -> LogFile -> text) a line
should appear:<pre> FHT Unknown device HOUSECODE, please define it</pre>
Now define a device:<pre>
define livingroom FHT HOUSECODE</pre>
If there is no signal for a while, the check <a href="faq.html#faq6">
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">
here</a> or examples <a href="example.06_at">here</a>.<br/><br/>
To execute commands if a device sent a message, then you have to define
devices of the type notify. See the definition
<a href="commandref.html#notify">here</a>.
</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/>
See the attributes
<a href="commandref.html#archivedir">archivedir</a>,
<a href="commandref.html#archivecmd">archivecmd</a>,
<a href="commandref.html#nrarchive">nrarchive</a>
attributes for archiving the logs.
</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
CURRENT weblink, and it will always display the most recent log.
<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
your internet browser must support SVG. Firefox and opera support SVG
out of the box, Internet Explorer does it via the Adobe "SVG viewer"
plugin. To use SVG graphics, set the <a
href="commandref.html#plotmode">plotmode</a> attribute to SVG.<br><br>
In order to look at historic data, you can either convert at the archive
entries to weblink in "plotmode=gnuplot" mode, or use the
"plotmode=gnuplot-scroll" or "plotmode=SVG" modes. In the latter case
you'll get the possibility to zoom or scroll in the plot. Note: the
gnuplot files must have #FileLog entries in order to be useable with
scrolling, as the filtering happens with the FileLog
<a href="commandref.html#FileLogget">get</a> function, see the supplied
gnuplot files for an example.<br><br>
It make sense to build large logfiles for scrolling in them (year
resolution), or smaller ones if you do not want to use the zoom/scroll
feature. The size of the logfiles 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#archivedir">archivedir</a> or
<a href="commandref.html#archivedir">archivecmd</a> attributes.
</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>
&lt;Proxy *&gt;
AuthType Basic
AuthName "Password Required"
AuthUserFile /home/httpd/etc/passwd
Require valid-user
Allow from 127.0.0.1
&lt;/Proxy&gt;
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 &lt;username&gt;
<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>
<body>
</html>