Identifying Arduino on USB via serial ports

I have written a Java utility to scan serial ports and identify connected arduino devices. This is a command line utility. It’s main purpose is to query each serial port, receive a unique response from an arduino, then modify the binding file Bridge serialPort setting to that arduino. After the binding file is modified OpenHAB can start with the correct serial port mapping.

Mainly this is for systems using more than one arduino, where the order of cold boot startup can alter which serial port USB mapping an arduino is on. I have tested this on Windows and Linux with two arduino connected, though there should not be an upper limit (hardware providing).

Were can I upload the .jar file (and supporting settings file) to?

Apologies if this is the wrong forum…

No, this is awesome work
search this forum for ‘market place’ or click the link in the upper right hand corner of this forum ‘github’ for a direct link to openHAB source code

I have the utility ready for the community. It is a .jar file packaged in a .zip file (supporting files for documentation etc). How do I upload the ZIP file? The upload filter precludes a zip file, only allows some file extensions.

I could rename the .zip to .pdf or something, which would allow the upload, and then the end user would have to rename it back to .zip to expand the archive, but this seems silly

Here’s how to share it in the marketplace. You’ll want to read both posts in detail to make sure your submission is in line.

If you do this for Arduino then, can you guarantee that query you trigger over serial port does not trigger side effects with other kind of devices?
The problem is known, my non invasive solution to it is listed here [co7io] Persistent serial port identifier provider for openhab. You can look at github sources of org.connectorio.addons.io.transport.serial.persistent to see how an decorator on top of serial port layer could be made. Maybe then binding could use dedicated serial port filter/selector (such api does not existing in OH at this moment) to limit options.

Best,
Łukasz

I did not create an addon. This is a standalone application meant to be run just before OpenHAB starts from a reboot of the host computer. I query each USB port (via a serial port) for a unique identifier, then map that identifier to the binding file Bridge statement, and modify the Bridge serialPort parameter value.

USBScanner.txt (13.0 KB)

I have attached the documentation which explains this in more detail.

You will have to add some C code to the arduino (I supply a sample) which reads the serial port, recognizes the USB Scanner query, and responds with the unique identifier.

I have tested this with other devices attached, and have found no issues. There is nothing invasive, it is just a text string sent to the USB device.

I will be using this here, as we now have five arduino with almost 150 sensors spread throughout the house.

Ideally I would just attach the .ZIP file to the first post which people can then d/l, expand the ZIP, then make use of the files.

So I take it then, that there is no way to upload a zip file.

So I either don’t make it available, or I play some silly games with file extensions :frowning:

Small advice, if you need to share a bunch of scripts then you can create github repository and upload it there. Github gives you possibility to generate “zip” or “tar.gz” link which takes most recent version of repository contents and stream them to caller.

For example: https://github.com/fhinkel/create-download-link/archive/refs/heads/master.zip
Takes contents of GitHub - fhinkel/create-download-link: Create a link to download a text file. (master branch) and gives all sources to you.