FHEMWEB Howto
Note: 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.
Starting
Attaching an FHZ device
Configuring FS20 receivers
Configuring FS20 transmitters
Configuring FHT devices
Timed commands / Notify
FHEMWEB look and feel
Logging data
Plotting logs
FHEMWEB tips
Starting
Install & start fhem with the command:
make install-pgm2
perl /usr/local/bin/fhem.pl fhem.cfg
The logfile should look like:
2008.06.15 16:17:03 2: FHEMWEB port 8083 opened
2008.06.15 16:17:03 0: Server started (version ...)
Connect to fhem with an internet browser:
http://localhost:8083/fhem
Attaching an FHZ device
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):
define FHZ1 FHZ /dev/ttyUSB0
Look here for more.
Configuring FS20 receivers
Configure the device in fhem first e.g. with:
define lamp1 FS20 1234 56
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.
Set the model attribute of the device:
attr lamp1 model fs20st
to get only the commands available for this device.
Here is a complete list of models.
Configuring FS20 transmitters
Make sure the global loglevel is at least 3 (attr global verbose 3, check
the fhem.cfg file in the Edit files section).
Now make sure that the transmitter is sending a signal. In the logfile
(FHEMWEB: "All together" -> Logs -> Logfile -> text) a line should
appear:
FS20 Unknown device HOUSECODE, Button BTN Code CDE, please
define it
Now define a device:
define piri1 FS20 HOUSECODE BTN
Set the model attribute of the device:
attr lamp1 model fs20piri
to get only the commands available for this device.
Here is a complete list of models.
Configuring FHT devices
Make sure the global loglevel is at least 3 (attr global verbose 3, check
the fhem.cfg file in the Edit files section).
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:
FHT Unknown device HOUSECODE, please define it
Now define a device:
define livingroom FHT HOUSECODE
If there is no signal for a while, the check
this FAQ entry.
Timed commands / Notification
To execute commands at a given time / periodically, you have to define
devices of the type at. See the definition
here or examples here.
To execute commands if a device sent a message, then you have to define
devices of the type notify. See the definition
here.
FHEMWEB look and feel.
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.
Set the title of the webpage by setting the title attribute of the global
device ("All together" -> global)
Edit the colors / fonts by changing the style.css ("Edit files" ->
style.css)
Further FHEMWEB attributes:
webname,
plotmode,
plotsize.
Logging data
To log messages into files, define devices of the type FileLog. To log messages into a
database, see the contrib/dblog directory in the fhem
distribution.
FHEMWEB has builtin support for displaying FileLog type logs as plots,
see the plot section below.
See the attributes
archivedir,
archivecmd,
nrarchive
attributes for archiving the logs.
Plotting logs
To convert a log into a plot in FHEMWEB, set the
logtype 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.
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.
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 plotmode attribute to SVG.
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
get function, see the supplied
gnuplot files for an example.
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
FileLog definition. Don't forget to
enable archiving with the
archivedir or
archivecmd attributes.
FHEMWEB tips
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.
Password/HTTPS
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:
<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
and then restart httpd with apachectl graceful. To create the password
file, execute
htpasswd -c /home/httpd/etc/passwd <username>
To enable HTTPS, please check the web. In essence: