UPB Binding Howto

Hello,

I’m trying to get the UPB Binding working on OpenHAB2 (on OpenSUSE for extra wrinkles!)

After some wrangling with USB port configuration (I had to install rxtx packages from Zypper), the binding appears to be working properly. All the various DEBUG/INFO messages in the log look normal (see below).

I think the serial port is being correctly read, as when I try and start Upstart (The UPB configuration Program), a bunch of UPB messages show up in the log, and cannot be read correctly (this makes sense I think, because the messages are all related to Upstart configuration.

I’ve created my items file, trying to control a handful christmas lights first, and verified the network number and module ids. The modules are all relay appliance modules; I believe they function as switches.

When I turn the items on and off (using HABPanel, or karaf shell (smarthome:status)), nothing appears in the log, and nothing happens in the real world. The modules all respond correctly using upstart (turning on and off).

Any help would be greatly appreciated!

Thanks,

Sherwin

UPB Log Entries (normal)

016-11-30 06:54:17.265 [DEBUG] [org.openhab.binding.upb             ] - BundleEvent [unknown:512] - org.openhab.binding.upb
2016-11-30 06:54:17.295 [DEBUG] [org.openhab.binding.upb             ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.upb.UPBBindingProvider}={component.name=org.openhab.binding.upb.genericbindingprovider, component.id=1, service.id=106, service.bundleid=233, service.scope=bundle} - org.openhab.binding.upb
2016-11-30 06:54:17.349 [DEBUG] [org.openhab.binding.upb             ] - BundleEvent STARTING - org.openhab.binding.upb
2016-11-30 06:54:17.349 [DEBUG] [org.openhab.binding.upb             ] - BundleEvent STARTED - org.openhab.binding.upb
2016-11-30 06:54:18.548 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'upb_christmas.items'
2016-11-30 06:54:19.444 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
2016-11-30 06:54:19.520 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2016-11-30 06:54:19.555 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /ui
2016-11-30 06:54:19.583 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2016-11-30 06:54:19.648 [DEBUG] [nhab.binding.upb.internal.UPBBinding] - Parsed UPB configuration:
2016-11-30 06:54:19.649 [DEBUG] [nhab.binding.upb.internal.UPBBinding] - Serial port: /dev/ttyUSB0
2016-11-30 06:54:19.649 [DEBUG] [nhab.binding.upb.internal.UPBBinding] - UPB Network: 1
2016-11-30 06:54:19.649 [INFO ] [nhab.binding.upb.internal.UPBBinding] - UPB binding starting up...
2016-11-30 06:54:19.714 [DEBUG] [org.openhab.binding.upb             ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler}={event.topics=openhab/command/*, service.pid=org.openhab.upb, port=/dev/ttyUSB0, network=001, component.name=org.openhab.binding.upb.binding, component.id=0, service.id=280, service.bundleid=233, service.scope=bundle} - org.openhab.binding.upb
2016-11-30 06:54:19.714 [INFO ] [b.core.service.AbstractActiveService] - UPB Service has been started

Example of UPB messages received from Upstart (not working/not supposed to be working):

2016-11-30 06:52:39.107 [DEBUG] [enhab.binding.upb.internal.UPBReader] - Received: [80]
2016-11-30 06:52:39.109 [DEBUG] [enhab.binding.upb.internal.UPBReader] - Received: [82]
2016-11-30 06:52:39.111 [DEBUG] [enhab.binding.upb.internal.UPBReader] - Received: [70]
2016-11-30 06:52:39.113 [DEBUG] [enhab.binding.upb.internal.UPBReader] - Received: [65]
2016-11-30 06:52:39.115 [DEBUG] [enhab.binding.upb.internal.UPBReader] - Received: [48]
2016-11-30 06:52:39.117 [DEBUG] [enhab.binding.upb.internal.UPBReader] - Received: [49]
2016-11-30 06:52:39.641 [DEBUG] [enhab.binding.upb.internal.UPBReader] - Received: [80]
2016-11-30 06:52:39.651 [DEBUG] [enhab.binding.upb.internal.UPBReader] - Received: [49]
2016-11-30 06:52:39.654 [DEBUG] [enhab.binding.upb.internal.UPBReader] - Received: [13]
2016-11-30 06:52:39.654 [DEBUG] [enhab.binding.upb.internal.UPBReader] - UPB Message: PRFA01P1
2016-11-30 06:52:39.654 [ERROR] [nhab.binding.upb.internal.UPBMessage] - Attempted to parse invalid message: PRFA01P1
java.lang.IllegalArgumentException: contains illegal character for hexBinary: FA01P1
        at javax.xml.bind.DatatypeConverterImpl.parseHexBinary(DatatypeConverterImpl.java:451)[:1.8.0_101]
        at javax.xml.bind.DatatypeConverter.parseHexBinary(DatatypeConverter.java:357)[:1.8.0_101]
        at org.openhab.binding.upb.internal.UPBMessage.fromString(UPBMessage.java:137)[233:org.openhab.binding.upb:1.9.0.201611290210]
        at org.openhab.binding.upb.internal.UPBReader.interpretBuffer(UPBReader.java:157)[233:org.openhab.binding.upb:1.9.0.201611290210]
        at org.openhab.binding.upb.internal.UPBReader.addData(UPBReader.java:110)[233:org.openhab.binding.upb:1.9.0.201611290210]
        at org.openhab.binding.upb.internal.UPBReader.run(UPBReader.java:180)[233:org.openhab.binding.upb:1.9.0.201611290210]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_101]
2016-11-30 06:52:57.702 [DEBUG] [enhab.binding.upb.internal.UPBReader] - Failed to read input stream.
java.io.IOException: Input/output error in nativeavailable
        at gnu.io.RXTXPort.nativeavailable(Native Method)
        at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1409)[233:org.openhab.binding.upb:1.9.0.201611290210]
        at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1323)[233:org.openhab.binding.upb:1.9.0.201611290210]
        at org.openhab.binding.upb.internal.UPBReader.run(UPBReader.java:176)[233:org.openhab.binding.upb:1.9.0.201611290210]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_101]
2016-11-30 06:52:57.702 [DEBUG] [enhab.binding.upb.internal.UPBReader] - UPBReader stopped.

Items file

Switch  Christmas_1     "Christmas Tree Living Room"    (Lights) {upb="id=1"}
Switch  Christmas_2     "Christmas Hallway Lights"      (Lights) {upb="id=2"}
Switch  Christmas_3     "Christmas Tree Party Room"     (Lights) {upb="id=3"}
Switch  Christmas_4     "Christmas 4"                   (Lights) {upb="id=4"}