FHEM and LWRF, an alternative approach that works with the FHEM Mobile App

  • January 12, 2013 at 17:51 #3969

    Chris very kindly added his FHEM perl module the other day. I have tried it out , and whist it works well, I couldn’t get it to work quite right with the floorplan and FHEM IOS application,

    I have come up with a different soultion based on tricking FHEM to think that the LWRF wifilink is an FS20 unit.  This allows it to work with the FHEM IOS App, and makes the states come up nicely in floorplan.

    Here is how to do it (based on an ubuntu virtual machine with FHEM installed to /opt/fhem)

    Copy the two perl LWRF_Dim.pl LWRF_Switch.pl files to your fhem directory (I put them in /opt/fhem/FHEM/LWRF). Make them executable with chmod 777, modify them to change the IP address of your LWRF wifi link.

    Add a new device to the fhem_cfg.pm, Here is an example of one of mine listed below, the FS20 home code and device code can be ignored, the three arguments to the perl script are room (1-8), device(1-6) and state(0-1 for the LWRF_Switch.pl and 0-32 for the LWRF_Dim.pl)

    define WineCooler FS20 0401 00
    define act_on_WineCooler notify WineCooler {\
    if ("%" ne "off") {\
    system("perl /opt/fhem/FHEM/LWRF/LWRF_Switch.pl 4 1 1" )\
    } else {\
    system("perl /opt/fhem/FHEM/LWRF/LWRF_Switch.pl 4 1 0" )\


    Once all this is done you should get the nice states, and be able to add graphs etc.  I’ll try and write up a bit of a tutorial for setting up FHEM and the LWRF for a house in due course, with things like, graphs, logs, floorplans etc.


    • This topic was modified 6 years, 8 months ago by Jmg123.
    • This topic was modified 6 years, 8 months ago by Jmg123.
    • This topic was modified 6 years, 8 months ago by Jmg123. Reason: Added links to code, rather than upload file
    January 12, 2013 at 18:53 #3973

    Oh wow, that’s a good idea.  I did wonder how to get the LWRF devices showing up in the apps and posted something in the FHEM google group, but it didn’t help much – probably because the native language of the group appears to be Deutsch!  I wondered whether the apps themselves look for the devices natively supported in FHEM rather than there being a standard interface that all devices support. The latter would be better.

    I shall give this a go on my instance and if it works, perhaps move some of my timed sequences over to FHEM and see how they work.

    I guess one way to combine the two would be to create FS20 dummy devices and then use the notify functionality to replicate the command on the LWRF devices that way there would be no need to call shell scripts.

    Just one comment, chmod 777 seems a bit overkil 755 should be plenty although I guess it isn’t overly important if you are the only user of the Ubuntu box or VM!

    Chris Mills
    Founder and Editor - LightwaveRF Community
    http://cpmills.com/ https://staging.lightwaverfcommunity.org.uk

You must be logged in to reply to this topic.

Topic Tags