New binding: panStamp wireless Arduino modules

Yes, it does work, great !

Some problems I saw until now (Win 8.1 x64):

  1. When running it for the first time from exe file the dialogue “Add network…” does not appear with apparently no error, but running it from console there is an exception thrown because rxtxSerial.dll is not available. I installed that and could go further

  2. Initially the same add network wizard gives an error that it cannot connect to the server - tried that several times with no success. I did try to connect to that debug port with a raw tcp client, I could do that. After closing my raw connection also the wizard could connect

Both of these errors are strange.

  1. It should not be looking for rxtxSerial.dll. The exe includes a pre-packaged copy of nrjavaserial and should load libNRJavaSerial.dll from the jar.

  2. Makes no sense at all

I saw later that on openhab console there was an exception thrown continuously until I closed it. Unfortunately I have no log for that, but was something coming out from panstamp binding.

I’ll post the exception log here if I get it again

Here it is. Comes into opehnab console after I close the GUI

java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source) ~[na:1.8.0_51]
at java.net.SocketInputStream.read(Unknown Source) ~[na:1.8.0_51]
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source) ~[na:1.8.0_51]
at sun.nio.cs.StreamDecoder.implRead(Unknown Source) ~[na:1.8.0_51]
at sun.nio.cs.StreamDecoder.read(Unknown Source) ~[na:1.8.0_51]
at java.io.InputStreamReader.read(Unknown Source) ~[na:1.8.0_51]
at java.io.BufferedReader.fill(Unknown Source) ~[na:1.8.0_51]
at java.io.BufferedReader.readLine(Unknown Source) ~[na:1.8.0_51]
at java.io.BufferedReader.readLine(Unknown Source) ~[na:1.8.0_51]
at me.legrange.swap.tcp.TcpTransport$Reader.run(TcpTransport.java:192) ~[na:na]
2015-10-05 23:51:31.329 [ERROR] [legrange.swap.tcp.TcpTransport] - null

Happens also when trying to connect from the same machine or a different machine

When running the client from the sme machine where rxtxSerial.dll was never installed, this problem does not appear. Only the exception at exit is still there.

Hi,

I’m glad to see that there is finally a binding supporting panstamps in openhab. Thanks for the effort there.

I’m running openhab 1.7.1 on a raspberry pi which also has a shield for raspberry pi connected to it to act as a modem in a panstamp network.

Unfortunately I get the following error in openhab log when using your binding:
07:23:37.526 [DEBUG] [o.b.p.internal.PanStampBinding:248 ] - startNetwork()
07:23:37.554 [INFO ] [gnu.io.CommPortIdentifier :333 ] - static CommPortIdentifier:getPortIdentifiers()
07:23:37.585 [INFO ] [gnu.io.RXTXCommDriver :355 ] - RXTXCommDriver:initialize(), osName: Linux
07:23:37.599 [INFO ] [gnu.io.RXTXCommDriver :466 ] - scanning device directory /dev/ for ports of type 1
07:23:37.639 [ERROR] [o.b.p.internal.PanStampBinding:267 ] - Error reading modem settings for serial network on /dev/ttyAMA0: Could not find serial port ‘/dev/ttyAMA0’

Did I configure something wrongly?

Unfortunately I don’t have a free panstamp to give it a try with panstick connected to USB.

Thanks & Regards,
Olti

Does your openhab user belong to the dialout group?

sudo usermod -a -G dialout openhab

A normal “apt-get” install of openHAB runtime on Raspberry Pi should run as the openhab user, which will need permissions to access the serial port. Adding the openhab user to the dialout group usually achieves this.

Yes it belongs to dialout group. Double checked that.

I’m logged in as user openhab most of the time and I’m also able to run swapdmt from the python tools.

UPDATE: I created a symlink called /dev/ttyS0 which points to /dev/ttyAMA0 and error is gone.
Any idea why it depends on the name or did I find a bug?

This is interesting.

I googled a bit and think that what happened to you is a known problem with Java serial IO on the Raspberry Pi. The binding uses nrjavaserial which is a fork of RXTX to do serial IO. It seems that RXTX and it’s derivatives assume that your serial port will be named /dev/ttySx or /dev/ttyUSBx and simply won’t pick up (they refer to enumerate) other ports. This is annoying given that you actually pass in the name of the port you want to use!

The recommended workaround is to pass the name of the serial port to Java using a property like
-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0

I like your solution however, it’s not like ttyS0 wil suddenly appear on the Pi since the hardware doesn’t exist.

Reference: http://angryelectron.com/rxtx-on-raspbian/

So you’ve got the comms fixed, does the binding work for you?

I’m now using udev to automatically create a symlink from /dev/ttyS0 to
/dev/ttyAMA0 and it seems to be working quite well.

It seems that the binding is working in general but unfortunately I had
some issues with my client device and couldn’t test it properly yet.

Additionally it seemed I had huge performance issues yesterday that need
further investigation. It started after getting the panstamp binding
working but not sure whether it is really related to the binding.

I will give it a new try this evening and let you know.

I’ve updated the binding based on the code review @watou did, and also included a new version of the underlying panstamp library to fix some issues reported by the panstamp lead developer.

I would appreciate it testers would try the latest build from here: https://github.com/AutoMates/openhab-panstamp-test

Ok ultil now, running since yesterday evening.

Thank you for the update! Still going?

Hi,
I wanted to test this binding and i have an RGBdriver board.
Could you give me an example of how i could use it with openhab?
I found that of the product code i have to take is 1/3, but if i try to use the switch example I get unsupported command type OnOffType.

I’ll look into this. Can you please post your item configuration?

Sure :slight_smile:

here it is:
Color RGBlevel “RGBled” { panstamp=“address=1,productCode=1/3,register=11,endpoint=‘RGBlevel’” }

I saw that the RGBdriver boards are no for sale anymore, do you know if there will be new produced for the panstamp4?

Any news on this?

Hello!

I am newbuy here. I have a Panstamp and do some automatization on the end devices, but do not have “command centre” (lagarto max is suxx for me).

At this moment I try use OpenHub as main part, but Panstamp have change Lagarto Swap to support MQTT.

And can you say rigth way - run lagarto-swap MQTT+mosquitto+OpenHUB MQTT or simply OpenHUB Panstamp Binding?

Thanks!

@Serg It depends on what you prefer. The idea is that users should be able to run openHAB with the panStamp binding and not need Lagarto.