FHEM: 2. Installation of FHEM

By | 8. September 2014

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.

  1. Hook the USB-RF-stick to your system (from now on, I will say cubietruck)
  2. SSH to it as root
  3. 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
  4. Download FHEM package (Check for the newest version)
    wget http://fhem.de/fhem-5.5.deb -O /tmp/fhem-5.5.deb
  5. Install FHEM
    dpkg -i /tmp/fhem-5.5.deb
  6. Stop FHEM, since it was started automatically on installation
    /etc/init.d/fhem stop
  7. 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
  8. 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
  9. Start FHEM
    /etc/init.d/fhem start
  10. 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.

  1. Set backup option in unsorted->global (FHEM)
     attr backup_before_update 1
  2. Set the backup dir in unsorted->global (FHEM)
     attr global backupdir /Volumes/BigHD
  3. Set ACL to allow the user fhem to write in this folder
  4. To support the FHEM project you should set the following option (FHEM)
     attr global sendStatistics onUpdate
  5. Check Update (FHEM)
     update check
  6. Install updates (FHEM)
     update

    The update will be aborted until you confirm the message you saw

    notice confirm <ID>
  7. 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

  1. 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.

print

Leave a Reply

Your email address will not be published. Required fields are marked *