RFXCOM 2.0 binding

@Zirum, working thing example cab be found from rfxcom binding page http://docs.openhab.org/addons/bindings/rfxcom/readme.html

Forgive me, but I am unable to get the information on that (and this thread) to work.

Bridge config:
Q1) Seems to me like the information in the serialPort is wrong. At least when I change it to “/dev/ttyUSB0”, it goes online in PaperUI, and starts identifying things.

As follows…

Bridge rfxcom:bridge:usb0 [ serialPort="/dev/ttyUSB0" ]

rather than

Bridge rfxcom:bridge:usb0 [ serialPort="/dev/tty.usbserial-06VVEG1Y" ]

Q2: What is actually the 06VVEG1Y-number?
Q3: What type of protocols is enabled? PaperUI shows none, but surely my nexas are picked up. No need to configure?

Thing config
Q4: I’d like to additionally assign the following details in the thing-file, is it possible?

  • Name
  • Thing Id
  • Location

Q1) You need to adapt used serial port, “/dev/tty.usbserial-06VVEG1Y” is just an example

Q2) 06VVEG1Y is serial number of my rfxcom controller :slight_smile: In Mac, serial number is included to serial port device name. Serial port name depends which operating system is used.

Q3) By default rfxcom binding doesn’t change configuration of the rfxcom controller, so all protocols which are enabled by default or you have changed e.g. via RFXmngr should work. You can give all configuration parameters also to thing file.

Bridge rfxcom:bridge:usb0 [ serialPort="/dev/ttyUSB0" setMode="XXXXXX" ]

See all available commands from https://github.com/openhab/openhab2-addons/blob/master/addons/binding/org.openhab.binding.rfxcom/ESH-INF/thing/bridge.xml

Q4) This not related to rfxcom binding, so you can use generic way (see more details from https://www.eclipse.org/smarthome/documentation/features/dsl.html).

Bridge rfxcom:bridge:thingidlabel” @ “location” [ serialPort="/dev/ttyUSB0" ]

Thanks a bunch, Pauli, works like a charm. Eclipse reported validation errors, so I did not bother to check if it worked initially. But surely it did. Sorry for that…

Very much appreciated!

Not sure if this belongs in this thread, a new one, or if it should be followed up on github. Mentioned it in a thread on github, but it might not be actually related when reading a little more thoroughly.

I have had problems for a while that the rfxcom bridge goes offline for 5-10 seconds when it is “stressed” with multiple updates (like toggling 5-6 items on and off for example). Log looks like this:

Openhab.log

2016-12-09 23:31:51.143 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber 'org.eclipse.smarthome.core.thing.firmware.FirmwareUpdateService@a4d975' takes more than 5000ms.
2016-12-09 23:31:51.145 [WARN ] [ome.core.thing.internal.ThingManager] - Handler for thing 'rfxcom:lighting2:3a698b45:436566_2' takes more than 5000ms for processing event
2016-12-09 23:31:51.165 [WARN ] [g.rfxcom.handler.RFXComBridgeHandler] - No response received from transceiver
2016-12-09 23:31:56.206 [WARN ] [g.rfxcom.handler.RFXComBridgeHandler] - No response received from transceiver
2016-12-09 23:31:56.299 [WARN ] [g.rfxcom.handler.RFXComBridgeHandler] - Sequence number '106' does not match, expecting number '110'
2016-12-09 23:31:56.363 [WARN ] [g.rfxcom.handler.RFXComBridgeHandler] - Sequence number '107' does not match, expecting number '110'
2

Event.log

2016-12-09 23:31:46.098 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:3a698b45' changed from OFFLINE (COMMUNICATION_ERROR) to ONLINE
2016-12-09 23:31:51.147 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:3a698b45' changed from OFFLINE (COMMUNICATION_ERROR) to ONLINE
2016-12-09 23:31:51.150 [ItemCommandEvent          ] - Item 'Kjokken_Lys_Hjornelampe' received command ON
2016-12-09 23:31:51.203 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:3a698b45' changed from OFFLINE (COMMUNICATION_ERROR) to ONLINE
2016-12-09 23:31:51.205 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:3a698b45' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR)
2016-12-09 23:31:51.222 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:3a698b45' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR)
2016-12-09 23:31:51.228 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:3a698b45' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR)
2016-12-09 23:31:56.251 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:3a698b45' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR)
2016-12-09 23:31:56.267 [ItemStateChangedEvent     ] - Kjokken_Lys_TakInngang changed from 50 to 30
2016-12-09 23:31:56.273 [ItemStateChangedEvent     ] - Kjokken_Lys_TakInngang changed from 30 to 100
2016-12-09 23:31:56.305 [hingStatusInfoChangedEvent] - 'rfxcom:lighting2:3a698b45:108_1' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2016-12-09 23:31:56.315 [hingStatusInfoChangedEvent] - 'rfxcom:lighting2:3a698b45:109_0' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2016-12-09 23:31:56.321 [hingStatusInfoChangedEvent] - 'rfxcom:lighting2:3a698b45:548818_1' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2016-12-09 23:31:56.327 [hingStatusInfoChangedEvent] - 'rfxcom:lighting2:3a698b45:14540818_11' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2016-12-09 23:31:56.346 [hingStatusInfoChangedEvent] - 'rfxcom:lighting2:3a698b45:7800694_3' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2016-12-09 23:31:56.355 [hingStatusInfoChangedEvent] - 'rfxcom:lighting2:3a698b45:107_1' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2016-12-09 23:31:56.364 [hingStatusInfoChangedEvent] - 'rfxcom:lighting2:3a698b45:101_0' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2016-12-09 23:31:56.379 [hingStatusInfoChangedEvent] - 'rfxcom:lighting2:3a698b45:390046_1' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2016-12-09 23:31:56.385 [hingStatusInfoChangedEvent] - 'rfxcom:lighting2:3a698b45:6490_1' changed from ONLINE to OFFLINE (BRIDGE_OFFLINE)
2

Any suggestions what it may be related to? Any helps much appreciated :slight_smile: !

I am also experiencing problems. And the solutions in this thread have not helped.

I have manually added the “RFXCOM USB Transceiver”, it is ONLINE, receives nothing, and things discovery crashes on JD2xx exceptions…

This is the thread.

Hi there,

Has anyone been able to get OH2 and RFXCOM working - I had it sort of working a while back, but halted my migration due to the mood message not being supported (and not having the time to make the transition to OH2). I’m now trying to migrate again, but experiencing problems with RFXCOM.

I’m running the Beta OH2 release, updated and upgraded.

I’ve got the following currently configured:
rfxcom.cfg:

rfxcom:serialPort=/dev/ttyUSB0

rfxcom.things:

	Bridge rfxcom:bridge:rfxcom [ serialPort="/dev/ttyUSB0" ] {
		Thing lighting5 15770872_16 "Mood" @ "Lounge" [deviceId="15770872.16", subType="LightwaveRF,Siemens"]
		Thing lighting5 15776004_16 "Mood" @ "Bedroom 1" [deviceId="15776004.16", subType="LightwaveRF,Siemens"]
	}

	rfxcom:lighting5:rfxcom:15770872_16 (Type=Thing, Status=ONLINE, Label=Lounge Mood, Bridge=rfxcom:bridge:rfxcom)
	rfxcom:lighting5:rfxcom:15776004_16 (Type=Thing, Status=ONLINE, Label=Bedroom1 Mood, Bridge=rfxcom:bridge:rfxcom)
	rfxcom:bridge:rfxcom (Type=Bridge, Status=ONLINE, Label=RFXCOM USB Transceiver, Bridge=null)
  1. Smarthome Designer doesn’t like my things file, on the 1st thing definition, it highlights the following:
Multiple markers at this line
- mismatched input '@' expecting '}'
- no viable alternative at input 'subType'
- The word 'Siemens' is not correctly spelled
- no viable alternative at input 'deviceId'

On the 2nd thing definition it highlights:

Multiple markers at this line
- missing EOF at '@'
- The word 'Siemens' is not correctly spelled
- Provide a thing UID in this format:
 <bindingId>:<thingTypeId>:<thingId>

Openhab ignores the bridge definition, giving the following in openhab.log:

2017-02-18 14:22:02.134 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'rfxcom.things'
2017-02-18 14:22:02.161 [WARN ] [.thing.internal.GenericThingProvider] - Thing Lounge does not have a bridge so it needs to be defined in full notation like <bindingId>:Lounge:Mood
2017-02-18 14:22:02.164 [WARN ] [.thing.internal.GenericThingProvider] - Thing Lounge does not have a bridge so it needs to be defined in full notation like <bindingId>:Lounge:Mood
2017-02-18 14:22:02.169 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'rfxcom.things'
2017-02-18 14:22:02.193 [WARN ] [.thing.internal.GenericThingProvider] - Thing Lounge does not have a bridge so it needs to be defined in full notation like <bindingId>:Lounge:Mood
2017-02-18 14:22:02.196 [WARN ] [.thing.internal.GenericThingProvider] - Thing Lounge does not have a bridge so it needs to be defined in full notation like <bindingId>:Lounge:Mood

Which seems to be where I’m currently stuck, I’ve compared my bridge definition to that in the docs, and can’t see anything wrong (and it worked back in November).

I’ve got logging set to TRACE, but see no TRACE level items in the log:

openhab> log:get org.openhab.binding.rfxcom
Logger                     | Level
----------------------------------
org.openhab.binding.rfxcom | TRACE

I’m out of ideas what to check or try next…

Cheers
James

I’ve been using it for a couple of days now just fine, I added the RFXCOM binding through paperui and added the “things” as they came in the inbox.
Since I’m upgrading from OH1 I’ve reused my items file and edited the channels accordingly (found the channel string by checking the thing name in paper UI), example:

rfxcom.items:
Contact DoorLockStateBasement "Basement door" <lock> (basement) { channel="rfxcom:lighting2:usb0:15632578_10:contact" }

rfxcom.things
Bridge rfxcom:bridge:usb0 [ serialPort="/dev/ttyUSB0" ]

NB:

  • I’m using OH2 snapshot #791

Thanks Alpoy,

I’ve removed my things file for the time being in an attempt to configure through the paperUI (I recall doing this the first time in order to understand the syntax).

I don’t see anything in the inbox (paperui or karaf console), but exceptions thrown in openhab.log:

2017-02-18 19:26:32.897 [DEBUG] [org.openhab.binding.rfxcom          ] - BundleEvent INSTALLED - org.openhab.binding.rfxcom
2017-02-18 19:26:33.071 [DEBUG] [org.openhab.binding.rfxcom          ] - BundleEvent RESOLVED - org.openhab.binding.rfxcom
2017-02-18 19:26:33.082 [DEBUG] [org.openhab.binding.rfxcom          ] - BundleEvent STARTING - org.openhab.binding.rfxcom
2017-02-18 19:26:33.114 [DEBUG] [org.openhab.binding.rfxcom          ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={component.name=org.openhab.binding.rfxcom.discovery, component.id=200, service.id=343, service.bundleid=227, service.scope=bundle} - org.openhab.binding.rfxcom
2017-02-18 19:26:33.164 [ERROR] [org.openhab.binding.rfxcom          ] - [org.openhab.binding.rfxcom.discovery(200)] Error during instantiation of the implementation object
java.lang.NoClassDefFoundError: org/openhab/binding/rfxcom/RFXComBindingConstants
	at org.openhab.binding.rfxcom.internal.discovery.RFXComBridgeDiscovery.<init>(RFXComBridgeDiscovery.java:56)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.8.0_101]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[:1.8.0_101]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.8.0_101]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)[:1.8.0_101]

I’ll try and apt-get update/upgrade, followed by an uninstall and re-install of the whole OH2 packages.

Cheers
James

@james_2_roberts I’m by no means an expert on the binding, but I do have it working happily on OH2 via paperUI. I would suggest you go through paperUI first just to make sure that you have the binding working correctly, before trying to get the text based .things file method working.

Also are you using beta 5 or the release version of OH2? If you are still on beta 5, I suggest you upgrade to the release version.

One other point - I don’t think you need the rfxcom.cfg file with the OH2 binding as the serial port is configured in the thing definition (as an aside, even if you did use a config file, the syntax of your line does not look correct as with OH2 we no longer prefix the binding name on each line of the config file - thus your line should read serialPort=/dev/ttyUSB0 ).

Thanks @smar,

I’m making progress. I performed a clean install of OH2 (apt-get purge, followed by install), this time I started with an empty list of bindings and just installed the rfxcom binding, along with the rfxcom.cfg file.

The rfxcom wasn’t found by the paperUI, so there’s no way I can configure it?

I did try the following .things file:

Bridge rfxcom:bridge:usb0 [ serialPort="/dev/ttyUSB0" ] {
	Thing lighting5 15770872_16 "Mood" @ "Lounge" [deviceId="15770872.16", subType="LightwaveRF,Siemens"]
	Thing lighting5 15776004_16 "Mood" @ "Bedroom 1" [deviceId="15770872.16", subType="LightwaveRF,Siemens"]
	}

which gave the following output in events.log:

2017-02-19 08:15:21.221 [ThingAddedEvent           ] - Thing 'rfxcom:bridge:usb0' has been added.
2017-02-19 08:15:21.317 [ThingAddedEvent           ] - Thing 'rfxcom:lighting5:usb0:15770872_16' has been added.
2017-02-19 08:15:21.477 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:usb0' changed from UNINITIALIZED to INITIALIZING
2017-02-19 08:15:21.502 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:usb0' changed from INITIALIZING to OFFLINE
2017-02-19 08:15:21.512 [hingStatusInfoChangedEvent] - 'rfxcom:lighting5:usb0:15770872_16' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)
2017-02-19 08:15:21.516 [hingStatusInfoChangedEvent] - 'rfxcom:lighting5:usb0:15776004_16' changed from UNINITIALIZED to INITIALIZING
2017-02-19 08:15:21.522 [hingStatusInfoChangedEvent] - 'rfxcom:lighting5:usb0:15776004_16' changed from INITIALIZING to OFFLINE (BRIDGE_OFFLINE)
2017-02-19 08:15:21.525 [ThingAddedEvent           ] - Thing 'rfxcom:lighting5:usb0:15776004_16' has been added.
2017-02-19 08:15:21.529 [hingStatusInfoChangedEvent] - 'rfxcom:lighting5:usb0:15770872_16' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2017-02-19 08:15:21.533 [hingStatusInfoChangedEvent] - 'rfxcom:lighting5:usb0:15770872_16' changed from INITIALIZING to OFFLINE (BRIDGE_OFFLINE)

At which point OH2 appears to have crashed…

Cheers
James

What if you only define the bridge in the things file, and let the lighting5 things add them self by creating some activity on the rfxcom device (switch on the lights assuming these are light devices etc.)

At least, when I got my rfxcom bridge defined, the things came ‘automagically’ in the inbox when the devices started to communicate (temperature sensors by timer, door sensors after I open/closed the door and so on).

I followed the PaperUI route, installing both the RFXCOM binding through the PaperUI, and also configuring it manually, specifying only the serial port as: /dev/ttyUSB0
The resulting logs show:

==> events.log <==
2017-02-19 12:22:07.615 [ThingAddedEvent           ] - Thing 'rfxcom:bridge:a99227cd' has been added.
2017-02-19 12:22:07.669 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:a99227cd' changed from UNINITIALIZED to INITIALIZING
2017-02-19 12:22:07.679 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:a99227cd' changed from INITIALIZING to OFFLINE

==> openhab.log <==
2017-02-19 12:22:07.766 [ERROR] [g.rfxcom.handler.RFXComBridgeHandler] - Connection to RFXCOM transceiver failed: invalid port

Cheers
James

hm, I’m using a raspberry pi so the only suggestion I have left is to check /etc/default/openhab2:
I’ve added this (specifically /dev/ttyUSB0 for rfxcom):
EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyAMA0:/dev/ttyACM0"

Also added “openhab” to the dialout group in /etc/group.

Remember to restart after these changes

Thanks @lfs_alp5,

Changes made, restarting as I type…

==> events.log <==
2017-02-19 14:26:41.912 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:c62488dd' changed from INITIALIZING to OFFLINE
2017-02-19 14:26:41.914 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:c62488dd' changed from UNINITIALIZED to INITIALIZING

==> openhab.log <==
2017-02-19 14:26:41.999 [ERROR] [g.rfxcom.handler.RFXComBridgeHandler] - Connection to RFXCOM transceiver failed: invalid port

At which point OpenHAB2 stops running, PaperUI doesn’t respond…

Going to give this one last try, using the things file again and see if that’s any better.

If it would help, I’ll raise a bug, but I’m not sure what would help…

tried again with the following .things file:

Bridge rfxcom:bridge:usb0 [ serialPort="/dev/ttyUSB0" ] {}

and the following happens before OpenHAB2 bails out:

==> openhab.log <==
2017-02-19 14:34:46.462 [INFO ] [ore.internal.i18n.LocaleProviderImpl] - Locale set to en_EN
2017-02-19 14:35:12.616 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'rfxcom.things'
2017-02-19 14:35:23.348 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
2017-02-19 14:35:23.676 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui

==> events.log <==
2017-02-19 14:35:26.783 [ThingAddedEvent           ] - Thing 'rfxcom:bridge:usb0' has been added.
2017-02-19 14:35:26.847 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:usb0' changed from UNINITIALIZED to INITIALIZING
2017-02-19 14:35:26.873 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:usb0' changed from INITIALIZING to OFFLINE

@james_2_roberts Just reading back up the thread, I see that you tried the paperUI route but you were not able to get it to work due to an ‘invalid port’ error. How exactly did you specify the port? i.e. did you manually install the RFXCom USB Transceiver?

Also, just to make sure that you’ve got all the bases ticked, are you 100% sure you have the port correct and accessible to the openhab user? Have you started openHAB with the port in the environment variable correctly (EXTRA_JAVA_OPTS)?

Hi @smar,

When I used the PaperUI route, I manually added the thing as an RFXCOM USB Transceiver specifying the port as follows:

/dev/ttyUSB0

That gave me:

==> events.log <==
2017-02-19 12:22:07.615 [ThingAddedEvent           ] - Thing 'rfxcom:bridge:a99227cd' has been added.
2017-02-19 12:22:07.669 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:a99227cd' changed from UNINITIALIZED to INITIALIZING
2017-02-19 12:22:07.679 [hingStatusInfoChangedEvent] - 'rfxcom:bridge:a99227cd' changed from INITIALIZING to OFFLINE

==> openhab.log <==
2017-02-19 12:22:07.766 [ERROR] [g.rfxcom.handler.RFXComBridgeHandler] - Connection to RFXCOM transceiver failed: invalid port
pi@openhab ~ $ groups openhab
openhab : openhab dialout
pi@openhab ~ $ cat /etc/default/openhab2
EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyAMA0:/dev/ttyACM0"

RFXCOM works perfectly without any issues at all on OH1.8.3

I use the RFXCOM 1.x binding with OH2 and manual configuration without any issues on my RPi2B.

Remember to reboot your Pi after messing with the serial port:

sudo reboot now

As Robert says, you can use the 1.8 binding in OH2, if you prefer.

For the OH2 binding, the only other things that I can think of to check are:

  1. Check that the device actually exists at /dev/ttyUSB0 (you can just do a ls -la /dev/ttyUSB0). Frequently with Linux, when you plug/unplug a device, it increments the device port number, hence the reason it is usually easier to use a symlink for the port, so you know what it is going to be every time.

  2. As far as I am aware, the serial bundle should be installed by default. However, it may be worth checking in your karaf that this has actually been installed.