[co7io] BACnet v2 binding for openHAB 2.x

Yes, it worked fine in the 2.x version. I remember you had to do a fix for it to work though.

I think the way we got it working before was with explicit assignment of IP address to every bacnet device identifier. Normally we get this back from discovery.
With above way we could send “targeted” message. I believe same should be a case with current version. Could you please post fragments of your old 2.x (item/channel definition) and 3.x binding config (thing definition)?

Here is the bridge that I link items to that gives me the error :

and here is what my 2.X config looked like :

Number	RES_EC_T_RET_URB	"Aquotec Temp Ret-URB [%.1f °C]"		  (gHvac)		{bacnet="device=61001,type=analogInput,id=1,networkNumber=50610,refreshInterval=300000"}

Hi @splatch,

I recently “purchased” the OH3.x bacnet binding. Still new to OH, trying to figure things out on my own but not seeing much info about the bacnet MSTP option.
Was hoping to use a USB-RS485 adapter to interface with some VAV controllers.

Got the binding installed. Got the USB adapter drivers installed, I just don’t see any way to choose that USB adapter in the “BACnet/MSTP Bridge” config, code, or any relevant info in the instructions.\

Is this application supported?

Thank you,

Hey Bram,
Thanks for getting the binding and investing time into testing it. The setup you have is supported and it should be working in binding version you downloaded. I got it running with one person before thus we can do quick verification of your environment.

In order to make sure that your adapter is working properly we need to conduct basic steps.

  1. Make sure that ttyUSBx/ttySx/ttyACMx/ttyAMAx device created for your adapter is accessible from “dialout” group.
  2. Add openhab to dialout group (this is not mandatory for openhabian since it is default there)
  3. Modify openhab startup configuration to enumerate ports created by your adapter (gnu.io.rxtx.SerialPorts).

Given that I don’t know your USB adapter I can’t tell you which entry will be created for it. You can check it by doing ls -la /dev/tty* before and after plugging of your adapter. Difference will be port name to be pulled into bacnet binding serialPort config option.

Steps 1 and 3 are described in official docs of openHAB: Serial Port Configuration | openHAB.
Please be aware that assigned port identifiers are not persistent. If you use multiple USB peripheries they can be changed between system restarts.

Best,
Ɓukasz

@splatch any luck with this one ? If not, do you know if there is a way to use the 2.X binding in OH3 ?

I tried re-running discovery and got this error, maybe the additional details help :

2021-06-15 17:17:14.007 [ERROR] [.bacnet4j.transport.DefaultTransport] - Error during send: OutgoingConfirmed [maxAPDULengthAccepted=480, segmentationSupported=segmented-both, service=ReadPropertyRequest [objectIdentifier=device 61001, propertyIdentifier=protocol-services-supported, propertyArrayIndex=null], consumer=com.serotonin.bacnet4j.transport.ServiceFutureImpl@11e4784, address=Address [networkNumber=50610, macAddress=[1]], linkService=null]
java.lang.IllegalArgumentException: Not an I/P mac
	at com.serotonin.bacnet4j.npdu.ip.IpNetworkUtils.getIpBytes(IpNetworkUtils.java:115) ~[bundleFile:?]
	at com.serotonin.bacnet4j.npdu.ip.IpNetworkUtils.getInetAddress(IpNetworkUtils.java:89) ~[bundleFile:?]
	at com.serotonin.bacnet4j.npdu.ip.IpNetworkUtils.getInetSocketAddress(IpNetworkUtils.java:96) ~[bundleFile:?]
	at com.serotonin.bacnet4j.npdu.ip.IpNetwork.sendNPDU(IpNetwork.java:298) ~[bundleFile:?]
	at com.serotonin.bacnet4j.npdu.Network.sendAPDU(Network.java:118) ~[bundleFile:?]
	at com.serotonin.bacnet4j.transport.DefaultTransport.sendForResponse(DefaultTransport.java:991) ~[bundleFile:?]
	at com.serotonin.bacnet4j.transport.DefaultTransport$OutgoingConfirmed.sendImpl(DefaultTransport.java:405) ~[bundleFile:?]
	at com.serotonin.bacnet4j.transport.DefaultTransport$Outgoing.send(DefaultTransport.java:336) ~[bundleFile:?]
	at com.serotonin.bacnet4j.transport.DefaultTransport.run(DefaultTransport.java:486) [bundleFile:?]
	at java.lang.Thread.run(Thread.java:829) [?:?]

For 2.x and 3.x, especially if you are bound to 1.x binding you can use remoteopenhab binding which does bridging between these two versions.

Error you got comes from fact that you git (probably) mstp slave id for an ip transport.

1 Like

I think I got it to work by creating a MS/TP device and forcing the IPV4 bridge on it (in the code, the UI would not allow it). :slight_smile: thanks for the hint !

@splatch
Aha! I didn’t see a dropdown in the paperui to set the serialPort option but figured it out in the code screen.
Now I have a communication error but I feel like that is progress.
I am using a ch341-uart USB adapter that claims linux compatibility. Did finally get the drivers installed although get this message:

[    5.187866] ch341-uart ttyUSB2: break control not supported, using simulated break
[    5.188139] usb 1-1.3: ch341-uart converter now attached to ttyUSB2

May get a different adapter.

Thanks for the help. Will keep plucking away at it.

@splatch Would you know which adapter was used with success before? thx

Your dmesg message looks perfectly fine, the break support is something which can be controlled by software driver I believe.
If you was able to pick ttyUSB2 in openHAB then it should work at least till the point where it does raise an transport exception. The transport error might be result of conflicting setup of nodes. I do get caught usually on parity/stop bit settings which can differ from one hardware supplier to other. Double check catalog cards of devices you owe to confirm serial settings. You can also test adapter with YABE (under Windows), if it works then look for latest driver for linux.
I’ve found some complains about ch341, but they are pretty old (~2014) or related to GPIO board which isn’t your case.

Anyhow, converter I used for my own tests is isolated rs485/usb/uart powered by “FTDI FT232 Serial (UART) IC” chip.

I am trying to install the 3.X binding (org.connectorio.addons.feature.bacnet-3.0.0-20210402) on openHABian 3.1.0 and I am getting the following error message:

2021-07-16 01:18:49.551 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-binding-bacnet': Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-bacnet; type=karaf.feature; version="[3.0.0.SNAPSHOT,3.0.0.SNAPSHOT]"; filter:="(&(osgi.identity=openhab-binding-bacnet)(type=karaf.feature)(version>=3.0.0.SNAPSHOT)(version<=3.0.0.SNAPSHOT))" [caused by: Unable to resolve openhab-binding-bacnet/3.0.0.SNAPSHOT: missing requirement [openhab-binding-bacnet/3.0.0.SNAPSHOT] osgi.identity; osgi.identity=co7io-binding-bacnet; type=karaf.feature [caused by: Unable to resolve co7io-binding-bacnet/3.0.0.SNAPSHOT: missing requirement [co7io-binding-bacnet/3.0.0.SNAPSHOT] osgi.identity; osgi.identity=org.connectorio.addons.binding.bacnet; type=osgi.bundle; version="[3.0.0.SNAPSHOT,3.0.0.SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve org.connectorio.addons.binding.bacnet/3.0.0.SNAPSHOT: missing requirement [org.connectorio.addons.binding.bacnet/3.0.0.SNAPSHOT] osgi.wiring.package; filter:="(&(osgi.wiring.package=javax.measure)(version>=1.0.0)(!(version>=2.0.0)))"]]]

Am I missing any prerequisites?

Binding so far works only with OH 3.0.x. Last openHAB release updated library which handle measurement units. This was a breaking change which requires recompilation of addon.

Thanks for the info!

I was able to successfully install on openHAB 3.0.2.

Any luck with MSTP connection?

Good luck then! Feel free to drop a line about hardware you got covered, so maybe search engines will being more people to play with openHAB. :slight_smile:

Anyhow, I found some optimizations for discovery process to make it more reliable and less dependent of initialization sequence.

Have been trying the bacnet devices with Yabe. Only getting garbage communication. May try another usb adapter.

Hi splatch, I’m trying to integrate Johnson Controls NAEs into openHAB2, and I found that [co7io] BACnet v2 binding is best for my needs
My system is openHAB (on Raspberry Pi) <-> NAE <-> Sensors. In Paper UI I can see BACnet IPv4 network thing in the Inbox, but I can see NAE thing. openHAB and NAE is on the same network.
I would like to use textual configuration to define things, as I can backup my system easily. I have read the manual but couldn’t figure out how to do it. Can you explain more detail about binding or help me defines or give me some examples? Thank you!

Can you confirm you CAN or CAN NOT see NAE? From sentence it seems like you have trouble discovering other device.

For textual configuration, I know documentation example is outdated and likely doesn’t work. I have another piece of configuration based on XML which I use with own setups. Please have a look below - with little effort you should be able to transform that into openHAB things DSL.

<things>
  <thing type="co7io-bacnet:analog-value"  label="Temperature sensing n.0, i.3, av.33">
    <id>co7io-bacnet:analog-value:0_3:av_33</id>
    <bridge>co7io-bacnet:ip-device:10_11_12_255:0_3</bridge>
    <config>
      <instance>33</instance>
    </config>
  </thing>

  <bridge type="co7io-bacnet:ip-device" label="BACnet Controller n.0, i.3">
    <id>co7io-bacnet:ip-device:10_11_12_255:0_3</id>
    <bridge>co7io-bacnet:ipv4:10_11_12_255</bridge>
    <config>
      <instance>3</instance>
      <address>10.11.12.217</address>
      <port>47808</port>
      <refreshInterval>30000</refreshInterval>
      <network>0</network>
    </config>
  </bridge>
  <bridge type="co7io-bacnet:ipv4" label="BACnet IPv4 network 10.11.12.255">
    <id>co7io-bacnet:ipv4:10_11_12_255</id>
    <config>
      <localDeviceId>1339</localDeviceId>
      <port>47808</port>
      <refreshInterval>0</refreshInterval>
      <localNetworkNumber>0</localNetworkNumber>
      <broadcastAddress>10.11.12.255</broadcastAddress>
    </config>
  </bridge>
</things>

Given that openHAB DSL does validate identifiers and supports nesting you might save some work there.

1 Like

@splatch: Sorry, silly me! After times of struggle with the binding, insert then remove things in both Paper UI and textual file then I check the firewall and see it blocks port 47808!
So much time wasted! Sorry and thank you for your help!
PS: Some more documents and this binding will becomes the best :smiley: