Author Topic: MCV Vera V3, OpenWRT Perl, FHEM (5.2)  (Read 462 times)

jrkalf

  • Sr. Newbie
  • *
  • Posts: 34
    • Jelle's Place
MCV Vera V3, OpenWRT Perl, FHEM (5.2)
« on: January 23, 2012, 01:55:05 pm »
Hi,

This is my work in progress spot getting FHEM to run besides Vera software on a Vera device. Ultimate goal is to get it all running inside the web interface, but that'll be a long long long time from now. For now I've managed to do the easy part: Getting fhem to run on the Vera V3 (without the webfrontends).

What's FHEM?
FHEM is a software package created for controlling FS20 and FHT (and many more already) devices around the house. Nowadays fhem supports a large variety of Hardware. My main drive was to get the FS20 and FHT bit working as I use various binary switches of the FS20 product type and various FHT devices for central heating in my house.
A bit more about these protocols can be found in an early post by me on the domoticaforum.eu.
Main reason I started with FS20 and FHT: it's cheap.

So why FHEM on Vera?
Vera is pretty, fhem's main pgm2 frontend is a bit boring/ugly in my humble opinion: (http://fhem.de/pgm2-1.png).
And the ultimate goal is to find a way to script into the VERA webportal to communicate with the open socket FHEM uses to run on (7072) and include the FS20/FHT devices into the portal being able to use the scenes etc.

but that's a long long long way from happening.

Current status:
FHEM is running on Vera V3.

Installation guide:

Prerequisites:
  • Root access to the Vera
  • some knowledge of the linux commandline interface
  • some patience
  • A good reason for implementing this (like having a CUL, CUNO or FHZ pc and some of these FS20 and FHT devices
  • Last but not least: a bit of OpenWRT

Time to push some buttons:
  • edit the /etc/opkg.cfg
  • place a # in front of the src/gz on the first line like this:
    #src/gz snapshots http://download.mios.com/firmware/openwrt/ramips/packages
  • add a line below this src/gz line and make it look like:
    src/gz snapshots http://downloads.openwrt.org/snapshots/trunk/ramips/packages/
  • Perform a package repository update by executing:
    opkg update
  • Install perl:
    opkg install perl perlbase-base perlbase-config perlbase-io perlbase-essential perlbase-symbol perlbase-selectsaver perlbase-xsloader perlbase-socket perlbase-errno perlbase-time perlbase-dynaloader perlbase-autoloader perlbase-posix perlbase-fcntl perlbase-tie
  • when this is done, change the /etc/opkg.cfg back to it's original state!
  • Time to fetch fhem:
    - cd /tmp
    - wget http://fhem.de/fhem-5.2.tar.gz
    - tar -zxf fhem-5.2.tar.gz
  • Time to perform some custom installation magic:
    cd /tmp/fhem-5.2
    mkdir -p /overlay/usr/bin /overlay/usr/share/fhem /var/log/fhem /overlay/usr/share/doc/fhem /overlay/etc
    cp fhem.pl /overlay/usr/bin
    cp -r FHEM /overlay/usr/share/fhem/
    rm -rf examples_changed
    cp -r examples examples_changed
    perl -pi -e 's,modpath \.,modpath /overlay/usr/share/fhem,' examples_changed/[a-z]*
    perl -pi -e 's,([^h]) /tmp,$$1 /var/log/fhem,' examples_changed/[a-z]*
    cp examples_changed/sample_fhem /overlay/etc/fhem.cfg
    cp -rp contrib /overlay/usr/share/fhem

having this done you should be able to start fhem by executing:
/overlay/usr/bin/fhem.pl /overlay/etc/fhem.cfg

you can verify this by starting a telnet session to socket 7072:
telnet localhost 7072
and directly after that typing "help" followed by an carrier return (hit the bloody enter key!)
Fhem's socket is an open socket, not a telnet socket, so don't expect it to behave as you would like it to do.


updates will follow in due time...
If you can't fix it with a hammer, you've got an electrical issue.
Vera V3 UI5, domotiga (Aeon stick), FHEM (CUL-FS20/FHT)