Can I move to OpenHAB from FHEM? (Would love to)

Hello everyone,

this is my first post so first of all: Hello and thanks for the great contributions in this community. I am currently running a well working FHEM setup, but would very much love to OpenHAB, and am now asking myself if everything I need is covered.

First of all, my FHEM setup works well, it took some time though. As a developer coming from the Java-World, I always experienced scripting FHEM as quite a code nightmare. There are no such things like an API or possibilities to really develop and debug your config. You have to raid a (to my feeling) very unsteady command reference, a wiki and a (very active) forum. But basically it is scripts (FHEM) over scripts (PERL), which you normally type into a browser-based editor, without any guidance. The given UI looks ridiculous and has a WAF of 0 so I built a simple HTML-page for the most important functions. But on the plus side again: Once you have done and accepted all that, I am pretty convinced that you can do anything, connect anything to everything as long as you are willing to fiddle with it long enough.

I looked at OpenHAB a bit an noticed, that this might be much more my style of thinking and implementing. The concepts in OpenHAB2 especially look good, and so I would like to think about migrating from FHEM to OpenHAB, but would appreciate some advice on my configuration, and if I currently can recreate a similar functionality in OpenHAB as I have in FHEM.

My requirements/components are:

  • Running on RPI2
  • Homematic, using Homematic USB Stick HM-CFG-USB as interface.
  • Heating is completely based on Homematic (Window/door sensors, thermostats, wall thermostats)
  • Geofence: I registered a geofence on all smartphones (all iPhones) of inhabitants of the home so the home knows who is at home and who is gone. (Three ways, IFTTT & Apple Friends using E-Mail, and the App Geofency/Locative with a direct URL call)
  • 433Mhz Plugs, which are operated by a sender and receiver connected to the raspberrys GPIO port
  • Graphing and Statistics, e.g. graphs showing temperature, thermostat valve operation and window state over the day
  • Sending e-mails and PUSH notifications (Currently Boxcar2)
  • Receiving e-mails and parsing their subject / sender.
  • Smoke detectors, also Homematic
  • Alarm function automatically activated with geofence using door/window sensors and the smoke detector as siren.
  • Bluetooth speaker connected to RPI2, which I use to read text (e.g. say hi to inhabitants coming back home, warning before alarm sets off…) on which is dynamically created by Google Text2speech API
  • Starting other Systems using WOL

Planned:

  • Accessing Google maps API to inform inhabitants that traffic on the way to work is dense

I think most of this should work, but would really appreciate any confirmation, thoughts or recommendations. Especially from community members that also came from FHEM.
Maybe waiting until OpenHAB2 is out of beta and released would be a good switching point, right?

Have a great day!

Best regards
PsychoD

Just a warning, if you approach the openHAB Rules DSL like Java, you will become frustrated and end up with overly complicated and brittle code. It does have an API so that is a leg up but Designer is a pretty basic IDE. It isn’t going to do much more for you than syntax highlighting and code completion using good old <ctrl><space>.

I don’t know FHEM but I don’t want you to think you will be able to come to OH and be able to code your rules in Java. And because the Rule’s DSL is more of an Actor Based Language rather than an OO or Structural focused language, if you try to code your rules like you would in Java or C/C++ you will become frustraited.

No problem. It has plenty of power.

There is a binding. I don’t use it so can’t say if your existing dongle or devices are supported. See this page.

There is IFTTT support through the my.openhab binding. There is also the Mqttitude Binding. OH also has a REST API so your App Geofency/Locative should be able to post updates to Items through the REST API. There is also a binding someone is working on (search the forum) that gets iPhone locations from Apple’s servers instead of from apps on the phone. Its not an official binding yet.

There is a GPIO binding.

OH supports graphing but it is very very basic and not super attractive. There is a companion app called Habmin2 which has better graphing. Or you can use an external database for persistence and use external tools to analyze and graph your data.

Emails are not problem. Boxcar2 does not appear to be supported by OH nor mqttWarn (a third party app a lot of people use to bridge between OH and other push notification services like Pushbullet). With my.openhab you can get notifications through the OH app on your phone and SMS should you desire.

Close by not quite. The MailControl Binding lets you receive command send via email in JSON format.

There are playSound and say actions which should do this. Getting the audio to play through the Bluetooth speaker is an OS config thing, not something OH has control over. Search the forums for using Google Text2speech. I think there have been recent changes to the API that has caused some people some trouble.

WOL is not natively supported but you can probably do it by calling a command line executable or script to do it using the Exec binding.

There is the ability to put Google Maps on your sitemap and drop icons on the map. I don’t know if that also includes traffic info though.

Not necessarily. You can get started with OH 1 and all your configurations and rules will port to OH 2 without modification. And most of what you learn will be transferable.

in oh1 you can use jsr223 engine with the script engine of your choose. groovy, jython, javascript.

still not compatible in oh2. bit I hope it will be with the release version :slightly_smiling:

Hi, thanks for the replies, I appreciate it!

Thanks for the heads up, I looked at the rule structure and it pretty much reminds me of Drools Expert, which I am briefly familiar with.

About the rest: Sounds very good!!

One question that still puzzles me is how I can include and operate my Homematic devices. I do not have a CCU, only the configuration USB stick HM-CFG-USB. Do I need a CCU to operate Homematic devices with OpenHAB?

One more question thing I could not find much information on is, how/if heating thermostats (esp. Homematic HM-CC-RT-DN) can be programmed on a timetable-basis. In FHEM, you can define a temperature list for times of the day and each day of the week, which is transmitted to the thermostat itself, which takes care for the switching even if your FHEM server went bust.
As far as I understood, you have to setup rules to emulate such behavior, or programm the temperature lists directly on the thermostat, right?

Thanks again!

Kind regards
Psy

More about Geofences:

You can have Location items that contain latitude and longitude (and optionally altitude). The state of the item can be set from scripts, bindings, REST API, etc. You can have a script trigger when a Location item’s state is within the geofence boundary. Example:

items:

Location WifesPhone
Switch WifeIsHome

rules:

import org.openhab.core.library.types.*

val PointType home = new PointType("1.2345,-5.4321")

rule IsWifeHome
when
  Item WifesPhone changed
then
  val Number wifeDistance = (WifesPhone.state as PointType).distanceFrom(home)
  WifeIsHome.postUpdate(if (wifeDistance < 500) ON else OFF)
end

About WOL: There is a binding! https://github.com/openhab/openhab/wiki/Wake-on-LAN-Binding-(WoL)

According to the wiki page you must have a “CCU1, CCU2, Homegear or lxccu”. Not knowing anything about Homematic I don’t really know what that even means.

Here are some Homematic examples which might be able to answer your questions. But for the most part the typical use case for OH is OH sends and receives data “just in time” and it typically does not “configure” devices with a bunch of parameters like you describe. But again, I don’t know Homematic so I don’t know if it supports that sort of use case.

That is the typical way to do it. One of the advantages is you can create a more dynamic schedule (e.g. based on actual dawn and dusk, current or projected weather conditions, whether or not you are home).

About HM-CFG-USB: When I last looked into OpenHAB (some 8 months ago) there was only support for the Homematic CCU. Coming from a (not sophisticated) FHEM environment with CFG-LAN I acquired a CCU2 but failed. I got the basic connections running but I got lost for anything more sophisticated (e.g. rules). Main reason was a lack of documentation. Don’t want to hurt anybody’s feeling, the issue could be entirely between keyboard and chair but I decided to wait for version 2 to have a second look then.

Good luck.
DJ

You don’t need a CCU to operate the HM-CFG-USB stick. Take a look at https://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb and Homegear (https://www.homegear.eu)

Hth,
Christian