New openHab2 EnOcean binding

Hi there!

I am working on an EnOcean openHab2 binding for quite some time. As some of you already know it is somehow difficult to develop an official binding because of IP concernings about the EEPs. As you can read here the idea to solve this problem is to use an external lib which handles the communication and EEP stuff. However as I could not find such a lib which fulfils all my needs I implemented all that stuff by myself. So this binding will never get an official binding, but works pretty well as long as we do not have an official binding.

This binding contains the following features:

  • No need for a thrid party lib, full EnOcean stack implemented, hence full control over the gateway (for ex enable repeater function)
  • Auto discovery with teach-in implemented
  • Developed on USB300 and running on EnOcean PI gateway
  • Bidirectional communication, hence openHab items get updated if devices are controlled outside of openHab
  • Switching, dimming, rollershutter, metering and rocker switch EEP implemented

You can find the current version here

A precompiled version can be found there, too. I would be glad if you could test this binding with your devices, tell me what could have been done better or which features you are missing and which EEPs should be implemented next.
Fell free to ask me any question about this binding.

Update 2018-03-12

  • Rocker switches support profiles now, added Play/Pause profile
  • For those of you who cannot wait for new EEPs implemented => use a GenericThing instead. These things must do the Enocean <-> Openhab conversion with transformation funcs
  • Polling for refreshable things like D2-01 things
  • Seperated F6_02_01/02 EEP to precisely define which button is UP/DOWN

Keep up the good work.


Hi Daniel,

That sounds great. I tested your binding and discovery works very good. Unfortunately I can’t use my rocker switch :wink: For example, my item definition is:

Switch Test_enocean "entest" {channel = "openocean:rockerSwitch:8e47db56:fefee263:generalSwitchB"} 

And if I toggle the switch I only get this message in the log:

openocean:rockerSwitch:8e47db56:fefee263:rockerswitchB triggered UP_PRESSED

And the event log says at the same time that the binding gets a teach in event. I tried it with and without a sender ID. Did I missed something?

Great work by the way!

Hi Peter, sorry for my late answer.

How do you want to use your rocker switch? If it is a physical rocker switch, you can listen to the events “UP_PRESSED” and “DOWN_PRESSED”. For example I use these events in a rule to trigger my sonos

rule "Bad Sonos ON"
    Channel 'openocean:rockerSwitch:4326d3ef:fefdaf7c:rockerswitchB' triggered DOWN_PRESSED
    if(Sonos_Bad_Control.state != "PLAYING"){
        if(Sonos_Bad_Radio.state != "WDR2 Rheinland"){
            Sonos_Bad_Radio.sendCommand("WDR2 Rheinland")

rule "Bad Sonos OFF"
    Channel 'openocean:rockerSwitch:4326d3ef:fefdaf7c:rockerswitchB' triggered UP_PRESSED

In this case you do not need a senderId, because you are just listening to your physical rocker switch.
However if you created a “virtual rocker switch” to control some actuator, you need a senderId to send messages. In this case you first have to pair your virtual rocker switch with your actuator. Put your actuator in learning mode and switch your rocker in openhab. Afterwards your rocker switch and your actuator are paired and you are able to control it within openhab. However it is not the best way to control your actuators this way, because you won’t be able catch the response messages of your actuators. It would be better to directly control your actuators. I hope I could help you.

By the way, I am currently cleaning up the log messages. So your won’t get these teach in events in your log any longer if you have not started the discovery.

I am absolutely loving that there are movement on an enocean binding. So gigant thank you from me.

I have a problem when I am trying to add a thing, but getting an ERROR: 500 - Internal Server Error. Probably a missing permission setting, but I am lost. Have you had any experience with this?

Hi Chistian,

nice to hear, that there is a demand for such a binding in the openhab community.

What kind of thing did you try to add? Could you already add the OpenOcean Bridge? Missing permissions should come into play only for the bridge because of the serial port. All other things should not have permissions problems. Could you post a screenshot of the thing config just before you hit the accept button?

I think I should add more hints related to config problems. Just another point on my todo :grinning:

I have just checked my code. The main reason for an Error 500 is a missing bridge during thing configuration. I have updated the binding. Now you will get a readable status message in this case.

I also added a new channel “Receiving Status” which holds information about the signal quality and repeater count of the last received message of a thing.

I added the bridge. :smiley: SĂĄ first obstacle is gone.

Now I am stuck with the next configuration_pending

I am using Ocean Pi on port /dev/ttyAMA0 and I am trying to connect a rocker switch. Thanks you for your effort.

During this “trying to connet to gateway” initialisation phase the binding tries to open the specified serial port. If another binding or process already opened the port, you get stuck in this phase. Could you do me a favor and use the latest version of this binding, remove the brigde and add it again? The current version produces more log and status messages during this critical initialisation phase.

Hi all
first of all @fruggy83: great work! I actually started my OpenHAB journey 3 years back with integrating an enocean switch.
These days, I have a lot of devices (and bindings) integrated, except for enocean. Now that I stumbled over this post, however, I am actually thinking of setting up a separate dev environment just to test your binding,

However, I have one question (which was the reason until now not to use enocean anymore): I read that the EnoceanPI does not play well with Raspberry 3 - is that still true or would I be able to install a new Openhabian (for example) on a Pi3 with EnoceanPI and everything is up and running, or do I need to modify more things? Same question actually for the Raspberry Pi2 - I also have a spare one of those lying around, though I’d prefer the 3


Hi @Pezzi42,
as I am currently the only one who is using this binding in a productive environment, I would also recommand to set up a seperate testing environment to not mix up your current setup. However I must tell you that this binding works quite well in my environment :grinning:
I would be very glad if you (as an expert) could set up a dev environment and share your experiences with me. Some improvements could already be implemted from the current feedback and more testers hopefully result in a more stable binding.

I developed this binding on an USB300 stick and I am running it on a Raspberry PI 3 with an Ocean Pi. So quite the same setup that you prefere. I do not have any experiences with Ocean Pi and a Pi2, however the combo Pi2 and USB300 worked well.
Thanks to the new openhabian image, this binding should nearly work out of the box. You just have to set up the serial port and permissions with openhabian-config
and activate the serial bundle with the karaff console. Thats it :grinning:

Hello @fruggy83

I downloaded the latest viersion.
My next bump on the road is this error:

I tried deactivating the serial port like you wrote in the last port.

and the event log:

2018-02-22 18:31:21.133 [hingStatusInfoChangedEvent] - 'openocean:bridge:4ce5ad74' changed from     UNINITIALIZED to INITIALIZING
2018-02-22 18:31:21.142 [hingStatusInfoChangedEvent] - 'openocean:bridge:4ce5ad74' changed from INITIALIZING to OFFLINE (CONFIGURATION_PENDING): trying to connect to gateway...
2018-02-22 18:31:22.149 [hingStatusInfoChangedEvent] - 'openocean:bridge:4ce5ad74' changed from OFFLINE (CONFIGURATION_PENDING): trying to connect to gateway... to OFFLINE (CONFIGURATION_PENDING): starting receiving and sending threads...
2018-02-22 18:31:22.158 [hingStatusInfoChangedEvent] - 'openocean:bridge:4ce5ad74' changed from OFFLINE (CONFIGURATION_PENDING): starting receiving and sending threads... to OFFLINE (CONFIGURATION_PENDING): trying to get bridge base id...

Hi @Bayees
this is really strange. As you can see on the event log the connection to the serial port could be successfully established (trying to connect to gateway). Afterwards the threads for sending and receiving could also be started.
During the next step the binding sends a message to the Ocean Pi to determine the base id of the gateway. However something happens here. If you still want to walk road, it would be fine if you could rise the log level for the binding. Just log into the karaf console and type in

log:set TRACE org.openhab.binding.openocean

Afterwards delete and recreate the bridge. Hopefully we can find out what happens with the help of the log. If you own an enocean rocker switch it would be good if you could trigger it, so we can see if receiving enocean messages really works.

Adding the bridge with log trace on:

22:26:02.076 [DEBUG] [org.openhab.binding.openocean        ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={, service.bundleid=203, service.scope=singleton} - org.openhab.binding.openocean
22:26:02.093 [DEBUG] [org.openhab.binding.openocean        ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.core.status.ConfigStatusProvider}={, service.bundleid=203, service.scope=singleton} - org.openhab.binding.openocean
22:26:02.120 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'openocean:bridge:0d5cfd90' changed from UNINITIALIZED to INITIALIZING
22:26:02.130 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'openocean:bridge:0d5cfd90' changed from INITIALIZING to OFFLINE (CONFIGURATION_PENDING): trying to connect to gateway...
22:26:05.120 [INFO ] [ransceiver.OpenOceanSerialTransceiver] - Could not connect to serial port /dev/ttyAMA0
22:26:05.129 [DEBUG] [rnal.transceiver.OpenOceanTransceiver] - Listening on port: /dev/ttyAMA0
22:26:05.134 [DEBUG] [nocean.handler.OpenOceanBridgeHandler] - request base id
22:26:05.133 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'openocean:bridge:0d5cfd90' changed from OFFLINE (CONFIGURATION_PENDING): trying to connect to gateway... to OFFLINE (CONFIGURATION_PENDING): starting receiving and sending threads...
22:26:05.129 [DEBUG] [rnal.transceiver.OpenOceanTransceiver] - start sending packets
22:26:05.146 [DEBUG] [rnal.transceiver.OpenOceanTransceiver] - new request arrived
22:26:05.160 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'openocean:bridge:0d5cfd90' changed from OFFLINE (CONFIGURATION_PENDING): starting receiving and sending threads... to OFFLINE (CONFIGURATION_PENDING): trying to get bridge base id...
22:26:05.166 [DEBUG] [rnal.transceiver.OpenOceanTransceiver] - new request arrived
22:26:05.167 [TRACE] [rnal.transceiver.OpenOceanTransceiver] - sending request
22:26:05.179 [TRACE] [rnal.transceiver.OpenOceanTransceiver] - 5500010005700838
22:26:05.187 [ERROR] [rnal.transceiver.OpenOceanTransceiver] - exception while sending data null
22:26:05.193 [TRACE] [rnal.transceiver.OpenOceanTransceiver] - sending request
22:26:05.200 [TRACE] [rnal.transceiver.OpenOceanTransceiver] - 5500010005700309
22:26:05.208 [ERROR] [rnal.transceiver.OpenOceanTransceiver] - exception while sending data null
22:26:05.215 [DEBUG] [rnal.transceiver.OpenOceanTransceiver] - awaiting packets to send

After pushing the switch

22:27:58.897 [TRACE] [rnal.transceiver.OpenOceanTransceiver] - Received Sync Byte
22:27:58.905 [TRACE] [rnal.transceiver.OpenOceanTransceiver] - Received header, data length 7 optional length 7 packet type 1
22:27:58.913 [TRACE] [rnal.transceiver.OpenOceanTransceiver] - publish event for: 002f2730
22:27:58.920 [TRACE] [rnal.transceiver.OpenOceanTransceiver] - f650002f27303002ffffffff3c00
22:27:59.089 [TRACE] [rnal.transceiver.OpenOceanTransceiver] - Received Sync Byte
22:27:59.097 [TRACE] [rnal.transceiver.OpenOceanTransceiver] - Received header, data length 7 optional length 7 packet type 1
22:27:59.104 [TRACE] [rnal.transceiver.OpenOceanTransceiver] - publish event for: 002f2730
22:27:59.111 [TRACE] [rnal.transceiver.OpenOceanTransceiver] - f600002f27302002ffffffff3c00

Thanks a lot, I think i know what is happening.
First of all my way to recognize if a serial port is already in use, is not working :grinning: The entry “could not connect to serial port …” is in most cases triggered by an already used serial port. In this case I actually do not abort the initialisation so the binding goes on and tries to request the base id. However this is not possible without an open serial port, so you get exceptions while sending data.

However you can see log entries when you trigger your rocker switch with enocean id 002f2730. So I think you have already created a working bridge, which blocks the serial port and listens to enocean messages. Could you please verify that you have created just one bridge. This bridge has to be selected when you create other openocean things.

Hi Daniel,

Got it. I bound the channels to a switch item. Now I am using the channel states in rules according to your example. Works very well! Thank you.

Are you planning to add additional eep’s? For example the A5-02-05?

And I tried your last binding and maybe found a bug. It seems to me that your new version blocks other serial ports, so only the one used by binding is available for other bindings… If I delete the enocean bindig and restart openhab all other serial ports are available again. I guess this is related to your previous post?

1 Like

Hi @peter.boehm,

I am glad to hear that it is working now (somehow :thinking:). What other bindings do you use which are not working now after using my binding? Do they use the same port as my binding or another port? What OS do you use? I will have a look tomorrow, if I can fix this problem.

Are you planning to add additional eep’s? For example the A5-02-05?

I plan to implement all EEPs. However as I only own the mentioned devices, I am not really able to test other EEPs. So it would be great if you could do the testing. Do you even own more enocean devices?

Hi Daniel,

Here is my setup:

Plattform = Latte Panda x64
OS = Debian 9 with Kernel 4.14
Java = Oracle Java 1.8.0_161
OH = 2.3.0 Build #1219

I use 4 devices (masked by udev):
/dev/zwave with Chris development version of the zwave binding
/dev/zigbee with Chris development version of the zigbee binding
/devserial11 with the serial binding
/dev/enocean with your binding

If your binding is not loaded the first 3 working as expected. If your binding is loaded only the zwave binding is working. /dev/serial11 and /dev/zigbee are not available to openhab. I get a “Unable to open serial port”

I only have a couple of switches and a temperature sensor right now. But I would like to buy some more devices :slight_smile:

Hello @fruggy83

So, I have now set up my dev environment with the enoceanpi.

Installing everything was fine, my rocket switch was discovered immediately when I pressed it.

However, I now hat the issue that I cannot link the channels to an item.
More precisely, the channels „Rockerswitch channel A“ and Channel B cannot be linked. They have the channel type „generalswitch“

The channel receiving state I could link to an item, and that item also receives something when I press the switch.

The switch itself is a bit older, FT55.

Am I missing something?


Hi @peter.boehm

very nice setup :grinning: I made some investigations about your problems and found some issues with the lib I use for rxtx communication. So I think I have to switch lib to the one used by the other bindings. Give me some time to fix it.

The implementation of A5-02 EEP group is nearly finished.

Hi @Pezzi42

Rocker switches are somehow special. In general I distinguish two kind of devices. Sensors, which can only receive messages, and actuators, which are furthermore able to send messages. However I implemented the rocker switches as a mixture of both.
You can use the rocker switch thing as an actuator to send switching messages. In this case you use the generalSwitch channels. There are two channels as a rocker switch can have two rockers, one channel for each rocker. To properly send messages you have to manually set a senderId.
However if you want to receive messages of your physical rocker switch FT55, the rocker switch is used as a sensor. In this case you do not need a senderId and have to use the rockerSwitch channels. These channels are implemented as trigger channels, which emit an event (“DOWN_PRESSED” or “UP_PRESSED”) whenever you trigger your FT55. So you cannot link them to an item. Instead you have to define a rule to react to the them. For example I use the following rules to trigger my Sonos in my bath, whenever I trigger my FT55:

rule "Bad Sonos ON"
    Channel 'openocean:rockerSwitch:4326d3ef:fefdaf7c:rockerswitchB' triggered DOWN_PRESSED
    if(Sonos_Bad_Control.state != "PLAYING"){
        Sonos_Bad_Radio.sendCommand("WDR2 Rheinland")        

rule "Bad Sonos OFF"
    Channel 'openocean:rockerSwitch:4326d3ef:fefdaf7c:rockerswitchB' triggered UP_PRESSED

If your FT55 switches a light on or off with a FSR and you want to visualize the light state in openhab, I would recommend you to directly add the FSR as a thing (Central command). In this case your light can be switched by your FT55 or any other switch (motion sensor or so on) and the FSR tells openhab if he switched the light on or off.

I hope I could explain it in some degree. If not, feel free to ask me any questions.


ps I already have the new openhab feature “profiles” on my todo, so you will later be able to map the rocker switch events to light, dimmer or any other kind of items.