Maintainer for BACNET binding

Hi,
the issue with device not discovered turned out to be silly error by me - I did specify binding address as local IP instead of “0.0.0.0”. Broadcast traffic is received only on socket bound to “0.0.0.0”. Maybe this should be mentioned in readme.md that this should be wildcard address, not interface address.

Regarding reading of device properties, this only influences DiscoveryMain as I understand. Probably it is worth processing “not supported” exceptions, and skip to next property there.

I’m currently experimenting with creating OH2 BACnet binding with discovery - to discover devices as things, and objects as channels. Will see where will this lead :slight_smile:

Yeah, broadcast address is not documented. DiscoveryMain by default reads this information from network interface configuration so it is portable and requires minimal effort to discover devices. All it needs is proper configuration. 0.0.0.0 is an specific value which means that you want to listen on all interfaces, it doesn’t really need to be like this, usually it is sufficient to set latest octet in your interface settings to 255. Ie if your computer interface is 192.168.x.15 then broadcast address is 192.168.x.255. Broadcast addresses are coming from bacnet/ip specification. You can find over internet some short description how frame is structured, sadly now I have no copy of such document locally.

I started work on bacnet binding from OH2 but troubles with bacnet4j and its api forced me to take it aside and clean up interactions. To test if everything works I made DiscoveryMain. Sadly I got stuck with OH2 and dynamic channels (each discovered property becomes new channel for device) a while ago. Everything is described here: https://www.eclipse.org/forums/index.php/t/1079027/. I didn’t go back since then to OH2 binding code, but made quickly OH1 version which anyway was starting point for all fights. I still should have last years copy of OH2 code. If you are interested in playing with it I will push it to github.
Feel free to post pull requests if you can for both bacnet4j wrapper and binding as well.

Cheers,
Lukasz

Yes, this would be a help to check.

I’ve managed to move the bacnet4j to v4 branch of GitHub - MangoAutomation/BACnet4J: BACnet/IP stack written in Java. Forked from http://sourceforge.net/projects/bacnet4j/ repository,
and the RequestUtils.getObjectList(localDevice,remoteDevice) works nice for my device, so looks hopfull.
Also - in v4 of the bacnet4J they have created a lot of utilities, so will check the need for bacnet4j-wrapper.

regards,
Ugis

This is really great news since 3.x was really buggy and had ancient parts. Even basic discovery+property fetch did not get through because of threading issues. Not sure if this will be a case, but with older version it was not possible to respond for messages from event listener code. This caused initial binding code quite complex because it had to manage multiple threads just for basic communication. I also see that last commits are solving wrong handling of simple ACKs meaning we will finally get possibility to see if property writes went fine.

Has anyone been able to get this new binding to read from a MS/TP device?
I was able to get it to work with arrizer’s old binding in 1.8, but seems I am unable with the new binding in OpenHAB 2.

@AusSandman, could you please show configuration you used earlier? Updated binding code uses a slightly different property format which may be result why it is not working when copying items one-to-one.

Best regards,
Lukasz

FYI binding was not compatibile with OH 2.1, it was updated so it works with latest release. New binary is available here: https://github.com/openhab/org.openhab.binding.bacnet/tree/master/build.

1 Like

You might want to upload the jar in the Releases section?

Sir, yes sir!

Please do not use this as biinary archiwa was removed from source repository.

Release have been tagged and binary build have been atttached to to github page:

Kind regards,
Lukasz

Any plans to implement the object type “schedule” in this BACnet binding?

Hey Tommy,
I have very basic HVAC device with few inputs. I can not cover whole spec with it and I have no access to industrial installations to try it out.
I could try to get something working with basic PCAP dumps containing communication with device. It is not reliable way, but I could at least verify if frames/telegrams/pdu/apdu generated by openhab matches live trafic copy.

Cheers,
Lukasz

Hi Splatch;

I can’t find anywhere to set the write priority. Currently the binding is writing to the points priority array at level 16. I would like to be able to adjust the level to work within my installation.
The nicest solution would be to set the write priority on an item bases, but even as a global setting would work for me at this time.

I am very grateful for all your work on this binding. Thank You

Hey @MikeHinton,
Thank you for reaching out. I saw priorities, but with single HVAC device I owe I didn’t have good case for getting it on board. There is long standing issue for bacnet4j-wrapper to get this feature supported which needs to be solved first in order to get such feature implemented in binding.
I didn’t have much time lately to work on binding. There is one more issue related to discovery which was reported on forum, which still waits in backlog. I might be able to handle both at the same time, as I am closer to openahb than I used to be for past year.

Cheers,
Lukasz

Hi Lukasz;

Thanks for the quick response. I do hope this can be dealt with at some point. I am not intending to push the issue, I know how much work you guys do for us, and for free. We do appreciate it!
I will see if I can use logic on both ends to solve this in the meanwhile. The controller is programmable so I may be able to create a logic the will accomplish my needs.

Thank You
Mike

A new release of binding (1.13.0 - codename “catching up”) was just published: https://github.com/openhab/org.openhab.binding.bacnet/releases.

There are two new features:

  • Support for polling/writing from given IP addresses.
  • Support for custom priorities for write requests.

@MikeHinton feature you requestes is now in place.
@AusSandman - let me know if you still need MS/TP devices.
@Ugis_Springis - you might also want to play with it as there is now support for custom network numbers which should improve overall stability with complex networks and routers involved.

All others - please download & run!

I am trying to get the Bacnet binding to work.I am running OpenHAB 2.4 on a QNAP. I have copied the jar to the addons folder. but i am not getting the bacnet binding in OpenHAB after a restart.

i loaded OpenHAB 2.4 on a windows box and the same problem, im new to openHAB thinking i am doing something wrong,

is there a step that im missing?

Thanks

Hey, you need to install OH 1.x compatybility layer. This feature is not enabled by default and binding code which you use is in fact 1.x. AFAIR you should be able to find it in Extensions/Misc section under paperui.

There might be some extra dependencies, however these should be present at runtime. You can watch openhab logs to check what is the error. Depending on platform you will find them in /var/log/openhab(2) or in userdata/logs directory (in root of your installation) for your windows installation.

Hello,
I installed the 1.13 binding but it does not work.
Do you have a sample .cfg file?
Do you have a sample .items file?
Currently, I have not put a .cfg file
My item:
Switch Centre_Bacnet “Eclairage Bacnet” (gEcl_Eta) [“Lighting”] {bacnet=“device= 5583,type=binaryOutput,id=1,address=192.168.1.85:47808,networkNumber=65535”}
Log errors:
2019-03-17 19: 41: 19.600 [ERROR] [net.internal.queue.WritePropertyTask] - Unexpected error while setting value OFF for property Property [5583.BINARY_OUTPUT.1]

java.lang.NullPointerException: null

at org.openhab.binding.bacnet.internal.queue.WritePropertyTask.run (WritePropertyTask.java:62) [260: org.openhab.binding.bacnet: 1.13.0.201812290105]

at java.util.concurrent.Executors $ RunnableAdapter.call (Executors.java:511) [?:?]

at java.util.concurrent.FutureTask.run (FutureTask.java:266) [?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.access $ 201 (ScheduledThreadPoolExecutor.java:180) [?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:293) [?:?]

at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149) [?:?]

at java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:624) [?:?]

at java.lang.Thread.run (Thread.java:748) [?:?]

Regards

Arnaud

Hey,
For items syntax is described in github repo. Yours looks definitely fine. Sitemap is dependent on your items file thus there is no sample.

WRT stack trace - this is an error which could be coming from conversion. However when I checked your stacktrace it shows that client for network is not available. This means that binding is not in fully started mode and will not work. Have you succeeded with similar item definition for given device?