MCV Vera V3, OpenWRT Perl, FHEM (5.2)

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: ([url=http://fhem.de/pgm2-1.png]http://fhem.de/pgm2-1.png[/url]).
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:

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

Time to push some buttons:

[ol][li]edit the /etc/opkg.cfg[/li]
[li]place a # in front of the src/gz on the first line like this:
[size=8pt][font=courier]#src/gz snapshots http://download.mios.com/firmware/openwrt/ramips/packages[/font][/size][/li]
[li]add a line below this src/gz line and make it look like:
[size=8pt][font=courier]src/gz snapshots http://downloads.openwrt.org/snapshots/trunk/ramips/packages/[/font][/size][/li]
[li]Perform a package repository update by executing:
[size=8pt][font=courier]opkg update[/font][/size][/li]
[li]Install perl:
[size=8pt][font=courier]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[/font][/size][/li]
[li]when this is done, change the /etc/opkg.cfg back to it’s original state![/li]
[li]Time to fetch fhem:

  • [size=8pt][font=courier]cd /tmp[/font][/size]
  • [size=8pt][font=courier]wget http://fhem.de/fhem-5.2.tar.gz[/font][/size]
  • [size=8pt][font=courier]tar -zxf fhem-5.2.tar.gz[/font][/size][/li]
    [li]Time to perform some custom installation magic:
    [size=8pt][font=courier]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
    [/font][/size][/ol]

having this done you should be able to start fhem by executing:
[size=8pt][font=courier]/overlay/usr/bin/fhem.pl /overlay/etc/fhem.cfg[/font][/size]

you can verify this by starting a telnet session to socket 7072:
[size=8pt][font=courier]telnet localhost 7072[/font][/size]
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…