### Description

Fhem is a GPL'd perl server for house automation. It is used to automate some common tasks in the household like switching lamps / shutters / heating / etc. and to log events like temperature/humidity/power consumption.
The program runs as a server, you can control it via web-frontends, telnet, command line program or TCP/IP directly.
In order to use fhem you'll need a 24/7 server (PC, MacMini, Fritz!Box, NAS, etc) with a perl interpreter and some hardware to access the devices, see the "Supported hardware" section below. Some of the fhem hardware-modules need special perl modules (e.g. Device::SerialPort) in order to work, see the corresponding section in the commandref.html.

### Download

Current Version: (as of =DATE=): fhem-=VERS=.tar.gz, fhem-=VERS=.deb, fhem-=VERS=-fb7390.image, fhem-=VERS=-fb7270.zip
See the CHANGED file for current changes.
Nightly SVN version: a tarball, or from the fhem commandline via updatefhem.
Please fill out our survey, as we'd like to know which FHEM modules are in use. Here are the results.

### Frontend screenshots

Builtin pgm2 / external pgm5 web frontend: overview, the same rendered for smartphones, detail, SVG-plots, dark style.
pgm3 web frontend: screenshot gallery
myHCE: screenshot gallery
fheME: screenshot gallery
HomeMini: screenshot & download
iPhone frontends: Fhemobile (native app), dhs-computertechnik or phyfhem

### Features

- support for a lot of protocols used in house automation like FS20, OneWire, X10, HomeMatic, KNX, EnOcean. See the Hardware section for more.
- autocreating devices/logs when receiving data from a new device: start fhem and watch how the plots of your sensors are appearing automatically.
- logging events to files or databases, with regexp filters
- notifying external programs or scripts when receiving certain events
- timed commands (e.g. switching a lamp on from sunset till midnight)
- watchdog (e.g. trigger if the HMS100-FIT is inactive for HH:MM:SS)
- modular architecture, easy to add your special device
- different web frontends, choose your favorite

### Supported hardware

- Via an attached CUL or CUN (see www.busware.de) access to the following protocols: FS20 (all devices), EM (EM1000EM, EM1000GZ and EM1000WZ), FHT80b, HMS, S300 (KS300, S300TH, KS555, S555TH, etc), HomeMatic (selected devices), La Crosse TX2/TX3.
- Via an attached FHZ1000 or FHZ1300 access to the following protocols: FS20 (all devices), FHT80b, HMS, KS300. Note: For the WLAN version of the FHZ1300 see this link.
- reading and sending X10 events via the CM11 module (with access to a X10 computer interface)
- S300 devices via an attached WS300
- EM1010PC and attached EM1000WZ, EM1000EM or EM1000GZ
- reading attached SCIVT devices
- reading attached M232 devices
- reading attached WS2000/WS25000 devices, also via raw network converters (xport)
- extract sensor data from IPWE networked weather data receiver
- Via an attached DS9490R or DS9097 access to the following Dallas 1-wire sensors: DS18S20, DS1820, DS18B20
- Via an attached KM271 access to the Buderus Logamatic 2107
- Allnet devices: Allnet 3076, Temperatures sensors and Allnet 4027 relay box connected to an Allnet 4000
- Davis VantagePro2 weatherstation
- RFXCOM RF receivers/transmitters e.g for different Oregon Scientific weather sensors. Tested: BTHR918N, THGR810, THR128, THWR288A, WTGR800.
- Via the ELV USB-WDE1 access to the S300/S555 family of sensors.
- Via an eQ-3 HomeMatic Lan Configurator access to selected HomeMatic devices.
- Via the eibd or a TUL (see www.busware.de) access to the EIB/KNX protocol.
- Via a TCM120 (e.g. the BSC BOR) or a TCM310 (e.g. busware EUL) access to the EnOcean protocol.
  A detailed description is to be found in the fhem reference.

### Documentation

fhem fuer Einsteiger (pdf, german)
HOWTO.html for a short installation/configuration.
commandref.html contains a detailed description of all features/modules.
Our wiki at fhemwiki.de
Frequently Asked Questions: faq.html
Google-Group: http://groups.google.com/group/fhem-users
Although most entries are in german here, don't be afraid to ask something in english.
contrib/README describes some loosely coupled useful modules / scripts which can be used with fhem.
Protocol descriptions and other useful stuff: http://fhz4linux.info/

### Links

Homepage: http://fhem.de/fhem.html
Development source at SVN@sourceforge: http://fhem.svn.sourceforge.net
Frontends:

- Martins Web frontend (webpgm3): http://www.martin-haas.de/fhz
- Another Martins Web frontend (myHCE): http://www.fischer-net.de/projekte/haustechnik/myhce.html
- Frontend for the iPhone: http://www.gschaden.com/wp/2009/01/18/fhem-iphone-gateway/ or http://www.dhs-computertechnik.de/support-iphone.html
- LinViex (home automation frontend): http://sourceforge.net/projects/linviex

Device/OS Specific installation guides:

- Instructions for the Fritz!Box
- Instructions for Nas/Routers (NSLU2): http://www.martin-haas.de/fhz/nslu2fhz
- Instructions for the Allnet all6250: http://wiki.dungeon.de/all6250_opennas_mit_fhem
- Linux driver installation: http://fhem.de/linux.html
- Misc USB problems: http://fhem.de/USB.html
- Russels Blog for Windows user: http://russellallen.info/category/FHEM.aspx
- Windows driver installation: http://fhz4linux.info/tiki-index.php?page=Driver%20installation
  (use "Solution B", only COM1..COM9 is supported)

Commercial products:

- http://www.dhs-computertechnik.de: Integration of FHZ and NAS running FHEM. Using an enhanced transmitter to achieve more distant transmission. Full integrated solution for Home-Control and beyond (other service like UPS management, etc. are also available).
- CUL: Hardware shop, firmware homepage, CUL fans google group

### Installation

#### Fritz!Box

- See the detailed documentation here, and after installation connect to http://localhost:8083/fhem. Follow the HOWTO for adding devices.

#### Debian/Ubuntu

- Install this package, and connect to http://localhost:8083/fhem. Follow the HOWTO for adding devices.

#### Unix / OSX

- Make sure you have perl. Install the module Device::SerialPort with "sudo cpan Device::SerialPort" (OSX user can skip this part).
- Check the Makefile for the installation path, then type make install-pgm2.
- Check the installed configuration file and start fhem as advised.
- Follow the HOWTO for adding devices.

#### Windows

Note:If you are using cygwin for your perl installation you can follow the guidelines for Unix.
- Be sure you have perl.exe in your path (%PATH%), and the module Win32::SerialPort is installed.
- Make sure that you can access the serial USB device via virtual COM-Port or via socket(e.g. `COMX or xport:10001`).
- Create a configuration file (see the examples directory and docs/commandref.html)
- Start the server with `fhem.pl <configfile>`

General notes for webfrontends:
You don't have to install all of them, one is probably more than enough :-).
The numbering has historical reasons: not actively maintained versions are not described here.
Important: Make sure you add some protection (.htaccess, etc) else everybody will be able to set your devices.

### Web frontend 2 (webfrontend/pgm2)

This frontend is a FHEM module implementing a HTTP server, no further programs are needed. It has support for grouping devices into rooms, manipulating devices, direct fhem commands, displaying logfiles as text or plot (SVG builtin or PNG by gnuplot), navigating/zooming in the plots, HTTP basicAuth, HTTPS and IPV6 (with the IO::Socket::SSL and IO::Socket:INET6 perl modules)
Screenshots: overview, detail, SVG-plots.
It installed by default, but it can be deconfigured.

### Web frontend 3 (webfrontend/pgm3)

This frontend is PHP based and was contributed by Martin Haas. Look at the webfrontends/pgm3/docs for more documentation. A lot more details and screenshots can be found on Martins page: http://www.martin-haas.de/fhz
pgm3 may run on an other machine than fhem.
The Devices of 95% of the users are detected and configured automatically. Further 4% are adaptable by the function UserDef. See config.php for explanation.
Installation:

- Install PHP5, the php5-Apache-Modules, gnuplot and php5-gd. Every current distribution should do all the needed configuration without your input.
- Create a directory in the Apache2 DocumentRoot (e.g.: /var/www/pgm3) and copy all the files from the webfrontend/pgm3 to this directory.
  Make sure that this directory is writeable by the webserver (e.g. User www-data.www-data)!
- Call <your-site>/pgm3/index.php and follow the instructions on screen
- The official WIKI of pgm3 is now http://fhemwiki.de
- Troubleshooting: right-click on the graphic then "show graphic".

### Web frontend 5 (webfrontend/pgm5)

This frontend is CGI/CSS based. It has support for rooms, and FHT/KS300 logs. This webfrontend is an update of the former pgm2 (up to 4.2): It resides in YOUR HTTP server, and doesn't provide an own, like the FHEMWEB module does.
Why to use this:
1) If you want to stick with your Web-Servers (due to restrictions, ports or any other reason)
2) If you have a NAS (Network attached storage) and limited CPU-Power. This frontend can render the graphics in the background (in intervals) and sends only the rendered graphics to the HTML-Page.
3) If you need the FHEMRENDERER to render the images for other/own pages.
A lot more details can be found on http://www.dhs-computertechnik.de/support.html
Installation:

- Copy the file fhemweb.pl and *.css to your cgi-bin directory (/home/httpd/cgi-bin), the icons (*.gif) to your httpd icons (/home/httpd/icons), and commandref.html to the html directory (/home/httpd/html) (or also to cgi-bin directory).
  Note: The program looks for icons in the following order:
  'device-name.state', 'device-name', 'device-type.state', 'device-type'
- The *.gplot files should be reused from the built-in FHEMWEB and should reside in the installed FHEM directory. Here we don't provide specific *.gplot files as the mechanisms are exactly the same.
- If you want to have access to plotted logs, then make sure that gnuplot is installed and set the logtype for the FileLog device (see commandref.html and example/04_log). Copy the file contrib/99_weblink.pm to the installed FHEM directory.
- Copy the file pgm5/02_FHEMRENDERER.pm to the installed FHEM directory. This gives you a graphic rendering engine (gnuplot & gnuplot-scroll at the moment), which can be configured to renderer images in intervals.
- Call 'your-site'/cgi-bin/fhemweb.pl

### License:

Copyright:

- Rudolf Koenig (r dot koenig at koeniglich dot de)
- Raoul Matthiessen (webfrontends/pgm1)
- Martin Haas (webfrontends/pgm3)
- Olaf Droegehorn (webfrontends/pgm5)

License: GPL (v2)
Thanks to TOSTi for inspiration and numerous other people for help.