openHAB2 and EnOcean binding

openhab2
enocean
Tags: #<Tag:0x00007f014d23a7d0> #<Tag:0x00007f014d239f88>

(Patrick Kötschau) #1

Hello,
I’m trying to get the enocean binding running.
I’m running openHab on an Raspberry with the EnOcean USB Stick.
With FHEM I can switch my actuators, so the hardware should be ok.
In my log file it seems as if the connection to the USB port works:

2016-11-04 21:17:17.984 [DEBUG] [mpl.info.InfoBundleTrackerCustomizer] - Ignore incorrect info null provided by bundle org.openhab.binding.enocean
2016-11-04 21:17:18.032 [INFO ] [g.apache.aries.spifly.dynamic.bundle] - Bundle Considered for SPI providers: org.openhab.binding.enocean
2016-11-04 21:17:18.032 [INFO ] [g.apache.aries.spifly.dynamic.bundle] - No 'SPI-Provider' Manifest header. Skipping bundle: org.openhab.binding.enocean
2016-11-04 21:17:18.046 [DEBUG] [mpl.info.InfoBundleTrackerCustomizer] - Ignore incorrect info null provided by bundle org.openhab.core.compat1x
2016-11-04 21:17:18.147 [INFO ] [.enocean.internal.bus.EnoceanBinding] - Connecting to Enocean [serialPort='/dev/ttyUSB0' ].

I defined several switches with different IDs for test but none works:

Switch Rocker (All) {enocean="{id=FF:B5:96:80, eep=F6:02:01}"}
Switch Rocker2 (All) {enocean="{id=FF:B5:96:80, eep=F6:02:01}"}      
Switch Rocker3 (All) {enocean="{id=01:9E:6B:2D, eep=F6:02:01}"}
Switch Rocker4 (All) {enocean="{id=01:9E:6B:2D, eep=F6:02:01}"}      
Switch Rocker5 (All) {enocean="{id=AA:BB:CC:01, eep=F6:02:01}"}
Switch Rocker6 (All) {enocean="{id=AA:BB:CC:01, eep=F6:02:01, channel=A}"}
Switch Rocker7 (All) {enocean="{id=AA:BB:CC:01, eep=F6:02:01, channel=B}"}

I used the IDs from my confifs in FHEM:
BaseID FFB59680
ChipID 019E6B2D

One thing I recognized:
With FHEM I can see the LED blink when I switch an actuator, but with openHAB nothing happens.

Any ideas where to look for?


(Örjan Backsell) #2

Hi!
I have an EnOcean USB Stick running with an STM 330.
I run openhab2_4_offline on an ordinary desktop.
I do think that your binding doesn’t start as expected, actually just a guess but we have to start somewere.

See below for some printings from my system: (there are more lines in the answers, but these are regarding to enocean)

openhab>bundle:list -s
1.9.0.201609170110 | org.openhab.binding.enocean

openhab>feature:list
openhab-binding-enocean | 1.9.0.b2 | x | Started | openhab-aggregate-xml | EnOcean Binding

And from the logfile, these lines are from the boot of openhab2
2016-10-24 19:51:28.758 [DEBUG] [org.openhab.binding.enocean ] - BundleEvent STARTING - org.openhab.binding.enocean
2016-10-24 19:51:28.791 [DEBUG] [ng.enocean.internal.EnoceanActivator] - enocean binding has been started.
2016-10-24 19:51:28.792 [DEBUG] [org.openhab.binding.enocean ] - BundleEvent STARTED - org.openhab.binding.enocean
2016-10-24 19:51:28.796 [DEBUG] [org.openhab.binding.enocean ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.enocean.EnoceanBindingProvider}={component.name=org.openhab.binding.enocean.genericbindingprovider, component.id=165, service.id=302, service.bundleid=194, service.scope=bundle} - org.openhab.binding.enocean
2016-10-24 19:51:28.976 [DEBUG] [org.openhab.binding.enocean ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService}={event.topics=openhab/command/*, service.pid=org.openhab.enocean, component.name=org.openhab.binding.enocean.binding, component.id=164, service.id=306, service.bundleid=194, service.scope=bundle} - org.openhab.binding.enocean
2016-10-24 19:51:29.006 [INFO ] [.enocean.internal.bus.EnoceanBinding] - Connecting to Enocean [serialPort=’/dev/ttyUSB0’ ].

I hope that it might give you some hints to get further in your investigations.

Regards Örjan


(Örjan Backsell) #3

I have done some test’s and found out as below:
In Eclipse IDE, Run / Run Configuration / Tab Plug-ins, Fill in org.openhab.io.transport.serial and org.openhab.binding.enocean (1.9.0.qualifier)

It’s possible to test that the binding is OK with the Validate Plug-ins button.
My STM 330 has an button and it seems to work out best if I click the button on the EnOcean for it to communicate at least at first start.

It will then be possible to see the signals in Eclipse IDE, Console window as:
2016-01-27 18:28:13.572 [INFO ] [org.opencean.core.ESP3Host :72 ] - RadioPacket4BS[header=[Header: dataLength=0A, optionalDataLength=07, packetType=01, crc8h=EB], payload=Payload: data=[A5, 00, 00, 23, 08, 01, 81, B0, 58, 00], optionaldata=[01, FF, FF, FF, FF, 30, 00], crc8d=66], raw=[55, 00, 00, 07, 01, 6C, 01, FF, FF, FF, FF, 30, 00, 4A], [sender=01:81:B0:58, repeaterCount=0], [db0=08, db1=23, db2=00, db3=00, teachIn=false]
2016-01-27 18:28:13.577 [DEBUG] [.e.internal.bus.EnoceanBinding:321 ] - Packet received: RadioPacket4BS[header=[Header: dataLength=00, optionalDataLength=07, packetType=01, crc8h=6C], payload=Payload: data=[], optionaldata=[01, FF, FF, FF, FF, 30, 00], crc8d=74], raw=[55, 00, 00, 07, 01, 6C, 01, FF, FF, FF, FF, 30, 00, 4A], [sender=01:81:B0:58, repeaterCount=0], [db0=08, db1=23, db2=00, db3=00, teachIn=false]

Regards Örjan


(Patrick Kötschau) #4

Hi Örjan,

thanks for your support.
I’ve tried to follow your suggestions.

Here is the output:

openhab>bundle:list -s
195 | Active   |  80 | 1.9.0.201611060211    | org.openhab.binding.enocean

openhab>feature:list
openhab-binding-enocean                   | 1.9.0.SNAPSHOT   | x        | Started     | openhab-aggregate-xml   | EnOcean Binding

openhab.log
2016-11-09 10:41:30.818 [DEBUG] [org.openhab.binding.enocean         ] - BundleEvent STARTING - org.openhab.binding.enocean
2016-11-09 10:41:30.819 [DEBUG] [ng.enocean.internal.EnoceanActivator] - enocean binding has been started.
2016-11-09 10:41:30.820 [DEBUG] [org.openhab.binding.enocean         ] - BundleEvent STARTED - org.openhab.binding.enocean
2016-11-09 10:41:30.826 [DEBUG] [org.openhab.binding.enocean         ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.enocean.EnoceanBindingProvider}={component.name=org.openhab.binding.enocean.genericbindingprovider, component.id=168, service.id=297, service.bundleid=195, service.scope=bundle} - org.openhab.binding.enocean
2016-11-09 10:41:30.890 [DEBUG] [org.openhab.binding.enocean         ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService}={event.topics=openhab/command/*, service.pid=org.openhab.enocean, component.name=org.openhab.binding.enocean.binding, component.id=167, service.id=300, service.bundleid=195, service.scope=bundle} - org.openhab.binding.enocean
2016-11-09 10:41:30.908 [INFO ] [.enocean.internal.bus.EnoceanBinding] - Connecting to Enocean [serialPort='COM3' ].
2016-11-09 10:41:30.995 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
2016-11-09 10:41:31.900 [DEBUG] [.enocean.internal.bus.EnoceanBinding] - Updating item state for items [Rocker1, TestRocker1, TestRocker2, TestRocker3, Rocker4, Rocker2, Rocker3]

My configuration looks as following.
I know it might be looking odd, but I made several tests… :wink:
Items:

Group All
Group:Switch:OR(ON, OFF) 		Lights 		"All Lights [(%d)]" 								(All)

Switch TestRocker1 "TestRocker1" (All,Lights) {enocean="{id=AA:BB:CC:02, eep=F6:02:01}"}
Switch TestRocker2 "TestRocker2" (All,Lights) {enocean="{id=FF:B5:96:80, eep=F6:02:01}"}
Switch TestRocker3 "TestRocker3" (All,Lights) {enocean="{id=01:9E:6B:2D, eep=F6:02:01}"}
Switch Rocker1 "Rocker1" (All,Lights) {enocean="{id=FF:B5:96:80, eep=F6:02:01, channel=A}"}
Switch Rocker2 "Rocker2" (All,Lights) {enocean="{id=FF:B5:96:80, eep=F6:02:01, channel=B}"}      
Switch Rocker3 "Rocker3" (All,Lights) {enocean="{id=01:9E:6B:2D, eep=F6:02:01, channel=A}"}
Switch Rocker4 "Rocker4" (All,Lights) {enocean="{id=01:9E:6B:2D, eep=F6:02:01, channel=B}"}      
/*
Switch Rocker6 "Rocker5" (All,Lights) {enocean="{id=AA:BB:CC:01, eep=F6:02:01, channel=A}"}
Switch Rocker7 "Rocker6" (All,Lights) {enocean="{id=AA:BB:CC:01, eep=F6:02:01, channel=B}"}
*/

Rules:

import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*

var Number counter = 1
var Timer timer = null

/**
 * This is a demo rule which simulates a real dimmer by reacting to increase/decrease commands 
 * and posting an updated state on the bus 
 */

rule "TestLight1"
	when
		Item TestRocker1 received command
	then
	if(receivedCommand==ON) {
		sendCommand(Rocker1, ON)
		sendCommand(Rocker2, ON)
		sendCommand(Rocker3, ON)
		sendCommand(Rocker4, ON)
		/*sendCommand(Rocker5, ON)
		sendCommand(Rocker6, ON)*/
	}
	else if (receivedCommand==OFF) {
		sendCommand(Rocker1, OFF)
		sendCommand(Rocker2, OFF)
		sendCommand(Rocker3, OFF)
		sendCommand(Rocker4, OFF)
		/*sendCommand(Rocker5, OFF)
		sendCommand(Rocker6, OFF)*/
	}
end
rule "TestLight2"
	when
		Item TestRocker2 received command
	then
	if(receivedCommand==ON) {
		sendCommand(Rocker1, ON)
		sendCommand(Rocker2, ON)
		sendCommand(Rocker3, ON)
		sendCommand(Rocker4, ON)
		/*sendCommand(Rocker5, ON)
		sendCommand(Rocker6, ON)*/
	}
	else if (receivedCommand==OFF) {
		sendCommand(Rocker1, OFF)
		sendCommand(Rocker2, OFF)
		sendCommand(Rocker3, OFF)
		sendCommand(Rocker4, OFF)
		/*sendCommand(Rocker5, OFF)
		sendCommand(Rocker6, OFF)*/
	}
end
rule "TestLight3"
	when
		Item TestRocker3 received command
	then
	if(receivedCommand==ON) {
		sendCommand(Rocker1, ON)
		sendCommand(Rocker2, ON)
		sendCommand(Rocker3, ON)
		sendCommand(Rocker4, ON)
		sendCommand(Rocker5, ON)
		sendCommand(Rocker6, ON)
	}
	else if (receivedCommand==OFF) {
		sendCommand(Rocker1, OFF)
		sendCommand(Rocker2, OFF)
		sendCommand(Rocker3, OFF)
		sendCommand(Rocker4, OFF)
		sendCommand(Rocker5, OFF)
		sendCommand(Rocker6, OFF)
	}
end

Sitemap:

sitemap demo label="Neu"
{
	 Frame label="EnOcean Pi"
    {
		Switch item=TestRocker1 label="TestRocker1"
		Switch item=TestRocker2 label="TestRocker2"
		Switch item=TestRocker3 label="TestRocker3"
		Switch item=Rocker1 label="Rocker1"
    	Switch item=Rocker2 label="Rocker2"
    	Switch item=Rocker3 label="Rocker3"
    	Switch item=Rocker4 label="Rocker4"
/*    	
		Switch item=Rocker5 label="Rocker5"
		Switch item=Rocker6 label="Rocker6"
*/
    }  
}

My problem still is that obviously no command is sended over the ST300 USB stick. Otherwise the led would blink or my actuators would react on it.

Unfortunatly I don’t have Eclipse installed and I’m not used to it.

Best regards,
Patrick


(Patrick Kötschau) #5

Hi Örjan,

I managed to install ans run Eclipse with openHab2.
But when running it the way you told me I get an error

How can I solve it?
As I told you, I’m a noob… :wink:

Greetings,
Patrick

Sorry, I found out I made an error in selecting the bindings.
Now it works, but I’m still trying to find the output…
Because I don’t know how to load the binding within the IDE, or where the config files are…


(Örjan Backsell) #6

Hi!

Great so far!

Me too, a noob… I meen, but it’s very interesting things so I do think
we just have to be curious, and make one small step after the other.

If you start/launch openhab from Eclipse IDE you should see these lines
in the Console window in the lower part of Eclipes IDE.

If you can’t see the console window just try to, Window / Show View ->
/ Console

I have sometimes had to push the button on STM 330, to make it
communicate with my enocean-USB i think.

Regards Örjan

Den 2016-11-10 kl. 12:38, skrev Patrick Kötschau:


(Patrick Kötschau) #7

Yes, I can see the console.
Actually I#m only getting this entry:
2016-11-10 16:02:43.918 [DEBUG] [.b.e.internal.EnoceanActivator:34 ] - enocean binding has been started.
Right now I’m trying to change the OPENHAB_HTTP_PORT because my port 8080 is already used. And where do I set the COM-Port of my device?

Unfortunatly my USB 300 doesn’t have a button to push. I somehow have to “push the button” per software.


(Örjan Backsell) #8

How To change port:

In Eclipse IDE Run / Run Configurations… / Tab Arguments and like :
Dorg.osgi.service.http.port=8090

The button is on my temperature-sensor STM300, should have mentioned it,
sorry for that.

I’m a little confused about the port-config, but you can always try with,

Make a file named enocean.cfg with the following text:

EnOcean USB adapter serial port

serialPort=/dev/ttyUSB0

This file will be placed in Eclipse Package Explorer / Infrastructure /
demo-resources / src / main / resources / services

//Basse

Den 2016-11-10 kl. 16:18, skrev Patrick Kötschau:


(Örjan Backsell) #9

I just found out that you should even be able to see the enocean-frames
in 'openhab2’offline/userdata/logs/openhab.log

But then you have to start openhab outside Eclipse, like #./start.sh as
usual.

To switch port in this case: export OPENHAB_HTTP_PORT=8090 and this will
only switch port for this terminal-session.

Den 2016-11-10 kl. 16:18, skrev Patrick Kötschau:


(Julian Sprenger) #10

ENOCEAN USB300

Hello I am new in openHAB and I have problems how to configure EnOcean devices with openHAB2. I am running a Raspberry Pi 3 and I do not know if I need to write my own binding for the USB300 or is it now supported with openHAB2? Any suggestions?


(Christoph Wempe) #11

It is already supported .
http://docs.openhab.org/addons/bindings/enocean1/readme.html


(Rainer) #12

Hello
after some time I get the enocean binding running.
My problem is that I receive data from the enocean-device but my item is not adjusted and also the rule will not be executed.

Here is my item:

Switch FensterContact   "FensterContact"  {enocean="{id=01:A1:EB:1F, eep=D5:00:01, parameter=CONTACT_STATE}"}

And here are the log entries:

18:04:30.685 [INFO ] [org.opencean.core.ESP3Host          ] - Received RadioPacket with value Pressed
18:04:30.686 [DEBUG] [.enocean.internal.bus.EnoceanBinding] - Received new value Pressed for device at EnoceanParameter: {id="01:A1:EB:1F", parameter="LEARN_BUTTON"}
18:04:30.689 [INFO ] [org.opencean.core.ESP3Host          ] - Received RadioPacket with value Open
18:04:30.689 [DEBUG] [.enocean.internal.bus.EnoceanBinding] - Received new value Open for device at EnoceanParameter: {id="01:A1:EB:1F", parameter="CONTACT_STATE"}
18:04:30.690 [DEBUG] [.enocean.internal.bus.EnoceanBinding] - Packet received: RadioPacket1BS[header=[Header: dataLength=00, optionalDataLength=07, packetType=01, crc8h=6C], payload=Payload: data=[], optionaldata=[01, FF, FF, FF, FF, 4F, 00], crc8d=43], raw=[55, 00, 00, 07, 01, 6C, 01, FF, FF, FF, FF, 4F, 00, 2B], [sender=01:A1:EB:1F, repeaterCount=0], [dataByte=00

Any ideas how to solve this problem?
Thanks in advace
rainer


(J Schwarz) #13

Good morning @rainer300,

maybe you should change “Switch” to “Contact” because you use a single contact input with this EEP [quote=“rainer300, post:12, topic:16217”]
eep=D5:00:01
[/quote]

Try it with:

I would try this first. But maybe someone with more knowledge here has answer to that.

Best,
SchwarzJ


(Rainer) #14

Hi SchwarzJ,

nearly the same result, but now i receive the message with the value “OPEN” - unfortunatly only when the contact is “closed”:sob:

18:18:05.661 [INFO ] [org.opencean.core.ESP3Host          ] - RadioPacket1BS[header=[Header: dataLength=07, optionalDataLength=07, packetType=01, crc8h=7A], payload=Payload: data=[D5, 00, 01, A1, EB, 1F, 00], optionaldata=[01, FF, FF, FF, FF, 56, 00], crc8d=-57], raw=[55, 00, 00, 07, 01, 6C, 01, FF, FF, FF, FF, 56, 00, C1], [sender=01:A1:EB:1F, repeaterCount=0], [dataByte=00
18:18:05.668 [INFO ] [org.opencean.core.ESP3Host          ] - Received RadioPacket with value Pressed
18:18:05.669 [DEBUG] [.enocean.internal.bus.EnoceanBinding] - Received new value Pressed for device at EnoceanParameter: {id="01:A1:EB:1F", parameter="LEARN_BUTTON"}
18:18:05.671 [INFO ] [org.opencean.core.ESP3Host          ] - Received RadioPacket with value Open
18:18:05.672 [DEBUG] [.enocean.internal.bus.EnoceanBinding] - Received new value Open for device at EnoceanParameter: {id="01:A1:EB:1F", parameter="CONTACT_STATE"}
18:18:05.673 [DEBUG] [an.internal.profiles.StandardProfile] - Received new value OPEN for items [FensterContact (Type=ContactItem, State=Uninitialized)]
18:18:05.675 [DEBUG] [.enocean.internal.bus.EnoceanBinding] - Packet received: RadioPacket1BS[header=[Header: dataLength=00, optionalDataLength=07, packetType=01, crc8h=6C], payload=Payload: data=[], optionaldata=[01, FF, FF, FF, FF, 56, 00], crc8d=-63], raw=[55, 00, 00, 07, 01, 6C, 01, FF, FF, FF, FF, 56, 00, C1], [sender=01:A1:EB:1F, repeaterCount=0], [dataByte=00


(J Schwarz) #15

Hmm that’s bad.

How does it work with:

Number     FensterContact     "FensterContact"     { enocean="{id=01:A1:EB:1F, eep=D5:00:01, parameter=CONTACT_STATE:closed}" }

Do you only use Enocean?
For example I use the Sensative AB Stripe, but this needs Z-Wave.


(Konstantin) #16

Hello,
Finally my window contact is working with USB300, latest openhabian on Raspberry Pi Zero W . Here is my configuration:
Items:
Contact TelefuncenWindowsContact “Telefuncen” { enocean="{id=00:89:24:4D, eep=D5:00:01, parameter=CONTACT_STATE}" }
Services:
# EnOcean USB adapter serial port
serialPort=/dev/ttyUSB0
Sitemaps:
Text item=TelefuncenWindowsContact label="Window"
It is important to download and add org.openhab.binding.enocean-1.9.0.jar under openhab2-addons folder. Restart is required.

My idea was to migrate from FHEM, but if OpenHAB is not able to send Enocean telegrams i will stay on my existing setup. This project look promising, but without this main (at least for me) functionality i do not have another choice.


(Christoph Wempe) #17

If you want to connect FHEM and openhab, have a look at my Rademacher solution.


(Rainer) #18

Hallo again,
I installed the enocean binding with the paper-ui and the USB300 is conected with socat to the virtual port /dev/ttyS0.

My configuration for the Eltako FTK-rw:

Contact FensterContact   "FensterContact"  (Wohnzimmer) { enocean="{id=01:A1:EB:1F, eep=D5:00:01, parameter=CONTACT_STATE}" }  

Services:

# EnOcean USB adapter serial port
serialPort=/dev/ttyS0

Sitemaps:

Text item= FensterContact label="Fenster"

Rule:

rule "enocean2"
when
	item FensterContact changed 
then
     logInfo("EnOcean","rule") 
       if (receivedCommand==OPEN)
    {
        …..
        …..
    }
    else 
    {
        …..
        …..

    }
end

  • I get only one signal, if the contact is closed, however with the message OPEN
  • I get no signal when the contact is opened
  • In no case is the rule will be started, also not with an error message
  • Also new for me ist the parameter = “LEARN_BUTTON”

Logfile:

19:04:03.513 [INFO ] [org.opencean.core.ESP3Host          ] - RadioPacket1BS[header=[Header: dataLength=07, optionalDataLength=07, packetType=01, crc8h=7A], payload=Payload: data=[D5, 00, 01, A1, EB, 1F, 00], optionaldata=[01, FF, FF, FF, FF, 49, 00], crc8d=83], raw=[55, 00, 00, 07, 01, 6C, 01, FF, FF, FF, FF, 49, 00, 55], [sender=01:A1:EB:1F, repeaterCount=0], [dataByte=00
19:04:03.517 [INFO ] [org.opencean.core.ESP3Host          ] - Received RadioPacket with value Pressed
19:04:03.518 [DEBUG] [.enocean.internal.bus.EnoceanBinding] - Received new value Pressed for device at EnoceanParameter: {id="01:A1:EB:1F", parameter="LEARN_BUTTON"}
19:04:03.518 [INFO ] [org.opencean.core.ESP3Host          ] - Received RadioPacket with value Open
19:04:03.518 [DEBUG] [.enocean.internal.bus.EnoceanBinding] - Received new value Open for device at EnoceanParameter: {id="01:A1:EB:1F", parameter="CONTACT_STATE"}
19:04:03.519 [DEBUG] [an.internal.profiles.StandardProfile] - Received new value OPEN for items [FensterContact (Type=ContactItem, State=Uninitialized)]
19:04:03.520 [DEBUG] [.enocean.internal.bus.EnoceanBinding] - Packet received: RadioPacket1BS[header=[Header: dataLength=00, optionalDataLength=07, packetType=01, crc8h=6C], payload=Payload: data=[], optionaldata=[01, FF, FF, FF, FF, 49, 00], crc8d=85], raw=[55, 00, 00, 07, 01, 6C, 01, FF, FF, FF, FF, 49, 00, 55], [sender=01:A1:EB:1F, repeaterCount=0], [dataByte=00

btw: in additional I use the rfccom-binding with different devices and this works fine :wink:

Any suggestions?
Thanks in advance
rainer300


(Rainer) #19

Now it works :grinning:

My Item:

Contact FensterContact  { enocean="{id=01:A1:EB:1F, eep=D5:00:01, parameter=CONTACT_STATE}" 

and the rule (Item not item):

rule "enocean2"
when
	Item FensterContact changed 
then
        …..


Can i use eltako enocean actors?
(Holger) #20

Is the id = 01:A1:EB:1F the ID of your Fenster Contact or is this the ID of the Enocean server hardware?
Thanks Holgus