Introduction
In part one of this series of posts I described my general objectives. In this post, I will describe how to install FHEM on an ARM-based system and attach the wireless USB stick to communicate with the sensors and actors.
Requirements
In general, you can use any hardware. I recommend using an ARM-based system due to its low energy consumption. You can use for example the well known Rasberry-pi or my favourite choice – the cubietruck.
On the software side I love Debian. If you use the rasberry you can find different OS options. With the cubietruck I recommend the Debian based image of Igor.
Additionally, you need a sender/receiver to interact with your wireless sensors and other devices. I chose the USB RF stick jeelink (v3) for about 33 EUR. Make sure that you are buying the one with the correct frequency. As observed for now, most common cheap wireless devices work with 868 MHz. You can also be even cheaper using an Arduino USB stick and a few cables. I will integrate the link if I find it again.
Installation
Installing the system is not part of my posts. You can find many Information on this matter in the internet.
- Hook the USB-RF-stick to your system (from now on, I will say cubietruck)
- SSH to it as root
- FHEM is using PERL, therefore we need to install the required package
apt-get -f install && apt-get install perl libdevice-serialport-perl libio-socket-ssl-perl libwww-perl libxml-simple-perl -y
- Download FHEM package (Check for the newest version)
wget http://fhem.de/fhem-5.5.deb -O /tmp/fhem-5.5.deb
- Install FHEM
dpkg -i /tmp/fhem-5.5.deb
- Stop FHEM, since it was started automatically on installation
/etc/init.d/fhem stop
- You need to allow the user fhem access to the USB-tty device by adding it to the group (in my case dialout)
# check ACL of USB tty ls -l /dev/ttyUSB* # add fhem to the group usermod -aG dialout fhem
- It is more save to change the log path to a absolute path name
sed -i 's/\.\/log\//\/opt\/fhem\/log\//' /opt/fhem/fhem.cfg
- Start FHEM
/etc/init.d/fhem start
- Access FHEM using you browser
http://<system-IP>:8083
Update FHEM
FHEM is under constant development the downloaded version is only a stable snapshot but already very old. You should definitely consider updating the version now. I consider you have done this in future posts.
- Set backup option in unsorted->global (FHEM)
attr backup_before_update 1
- Set the backup dir in unsorted->global (FHEM)
attr global backupdir /Volumes/BigHD
- Set ACL to allow the user fhem to write in this folder
- To support the FHEM project you should set the following option (FHEM)
attr global sendStatistics onUpdate
- Check Update (FHEM)
update check
- Install updates (FHEM)
update
The update will be aborted until you confirm the message you saw
notice confirm <ID>
- Install updates (FHEM)
update
Configure Jeelink
Normally, configuration of FHEM is done by using the web interface. Use the the textbox in the to to execute them
- Add the jeelink adapter (define <name> JeeLink <USB-tty@speed>)
define myJeeLink0 JeeLink /dev/ttyUSB0@57600
Final words
Now FHEM is ready to be used. Read the following post to see how to setup some sensors.