[Solved] Plugwise Binding - Bridge to stick 'Serial port already in use'

Hi there,
started to use OH2 on my RPI3.

i get the following message: Serial port already in use

that is from events.log
2018-06-13 12:36:52.676 [hingStatusInfoChangedEvent] - ‘plugwise:stick:demostick’ changed from UNINITIALIZED to INITIALIZING
2018-06-13 12:36:54.690 [hingStatusInfoChangedEvent] - ‘plugwise:stick:demostick’ changed from INITIALIZING to OFFLINE (COMMUNICATION_ERROR): Serial port already in use
2018-06-13 12:36:54.720 [hingStatusInfoChangedEvent] - ‘plugwise:circle:democircle’ changed from UNINITIALIZED to INITIALIZING
2018-06-13 12:36:54.735 [hingStatusInfoChangedEvent] - ‘plugwise:circle:democircle’ changed from INITIALIZING to OFFLINE (BRIDGE_OFFLINE)

In my default.things has

Bridge plugwise:stick:demostick "Demo Stick" [ serialPort="/dev/ttyUSB0" ]
Thing plugwise:circle:democircle "Demo Circle" (plugwise:stick:demostick) @ "Room 2" [ macAddress="000D6F00009955BB" ]

The stick is connected to a usb-port in de Raspberry PI 3, where dmesg | grep usb gives lines like this:

[    3.667113] usb 1-1.2: Detected FT232RL
[    3.668185] usb 1-1.2: FTDI USB Serial Device converter now attached to ttyUSB0

Is there somewhere i can see whom is using this serial port?
…or something like that…

edit: formatting & default.things

This works for me:

$ fuser -n file /dev/ttyUSB0

/dev/ttyUSB0:        10477

Then you can get additional process information using this PID with ps:

$ ps -fp 10477

UID        PID  PPID  C STIME TTY          TIME CMD
wouter   10477 10359  9 18:41 pts/2    00:00:55 /usr/lib/jvm/java-8-oracle/bin/java -Dopenhab.home=/home/wouter/software/openhab/demo -Dopenhab.conf=/home/wouter/software/openhab/demo/conf -Dopenhab.runtime=/home/wouter/software/openhab/demo/runtime -Dopenhab.userdata=/home/wouter/software/openhab/demo/userdata -Dopenhab.logdir=/home/wouter/software/openhab/demo/userdata/logs -Dfelix.cm.dir=/home/wouter/software/openhab/demo/userdata/config -Djetty.host=0.0.0.0 -Djetty.http.compliance=RFC2616 -Dorg.ops4j.pax.web.listening.addresses=0.0.0.0 -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Djava.awt.headless=true -XX:+UseG1GC -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/home/wouter/software/openhab/demo/runtime/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/home/wouter/software/openhab/demo/runtime/lib/ext -Dkaraf.instances=/home/wouter/software/openhab/demo/userdata/tmp/instances -Dkaraf.home=/home/wouter/software/openhab/demo/runtime -Dkaraf.base=/home/wouter/software/openhab/demo/userdata -Dkaraf.data=/home/wouter/software/openhab/demo/userdata -Dkaraf.etc=/home/wouter/software/openhab/demo/userdata/etc -Dkaraf.logs=/home/wouter/software/openhab/demo/userdata/logs -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=/home/wouter/software/openhab/demo/userdata/tmp -Djava.util.logging.config.file=/home/wouter/software/openhab/demo/userdata/etc/java.util.logging.properties -Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=true -classpath /home/wouter/software/openhab/demo/runtime/lib/boot/org.apache.karaf.diagnostic.boot-4.1.5.jar:/home/wouter/software/openhab/demo/runtime/lib/boot/org.apache.karaf.jaas.boot-4.1.5.jar:/home/wouter/software/openhab/demo/runtime/lib/boot/org.apache.karaf.main-4.1.5.jar:/home/wouter/software/openhab/demo/runtime/lib/boot/org.osgi.core-6.0.0.jar org.apache.karaf.main.Main

You might need to prefix the command with sudo if the process runs as another user.
It could also be another openHAB binding that is using the same serial port.

Thanks…
from fuser -n file /dev/ttyUSB0 came zero response, i think it was not in use

what i then tried was
systemctl stop openhab2
systemctl start openhab2
(with pi-password)
and…
now it’s working…no wait…
(events.log)
2018-06-13 21:58:14.099 [hingStatusInfoChangedEvent] - ‘plugwise:stick:demostick’ changed from UNINITIALIZED to INITIALIZING
2018-06-13 21:58:14.163 [hingStatusInfoChangedEvent] - ‘plugwise:circle:democircle’ changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
2018-06-13 21:58:14.195 [hingStatusInfoChangedEvent] - ‘plugwise:stick:demostick’ changed from INITIALIZING to ONLINE
2018-06-13 21:58:14.288 [hingStatusInfoChangedEvent] - ‘plugwise:circle:democircle’ changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2018-06-13 21:58:14.390 [hingStatusInfoChangedEvent] - ‘plugwise:circle:democircle’ changed from INITIALIZING to OFFLINE (CONFIGURATION_PENDING)
2018-06-13 21:58:14.513 [hingStatusInfoChangedEvent] - ‘plugwise:stick:ThingID_Bridge_PlugwiseStick_5f2522e0’ changed from UNINITIALIZED to INITIALIZING
2018-06-13 21:58:14.703 [me.event.ThingUpdatedEvent] - Thing ‘plugwise:stick:demostick’ has been updated.
2018-06-13 21:58:14.802 [hingStatusInfoChangedEvent] - ‘plugwise:circle:democircle’ changed from OFFLINE (CONFIGURATION_PENDING) to ONLINE (CONFIGURATION_PENDING)
2018-06-13 21:58:14.916 [me.event.ThingUpdatedEvent] - Thing ‘plugwise:circle:democircle’ has been updated.
2018-06-13 21:58:14.921 [hingStatusInfoChangedEvent] - ‘plugwise:circle:democircle’ changed from ONLINE (CONFIGURATION_PENDING) to ONLINE
2018-06-13 21:58:16.062 [me.event.ThingUpdatedEvent] - Thing ‘plugwise:circle:democircle’ has been updated.
2018-06-13 21:58:16.514 [hingStatusInfoChangedEvent] - ‘plugwise:stick:ThingID_Bridge_PlugwiseStick_5f2522e0’ changed from INITIALIZING to OFFLINE (COMMUNICATION_ERROR): Serial port already in use

  • i will try again tomorrow

Are you using openHABian or did you install openHAB on a RPi3 running an existing Raspbian installation?

If it’s Raspbian you also need to make sure the user running openHAB is a member of the groups that have permission to use serial ports.

See also:

Perhaps you have also added a discovered Stick via Paper UI -> Inbox?

Your logging shows two sticks being initialized:

2018-06-13 21:58:14.099 [hingStatusInfoChangedEvent] - ‘plugwise:stick:demostick’ changed from UNINITIALIZED to INITIALIZING
...
2018-06-13 21:58:14.513 [hingStatusInfoChangedEvent] - ‘plugwise:stick:ThingID_Bridge_PlugwiseStick_5f2522e0’ changed from UNINITIALIZED to INITIALIZING

You can remove the discovered Stick via Paper UI > Configuration > Things.

Then click the trash can icon to the right of the Stick with ThingUID:

plugwise:stick:ThingID_Bridge_PlugwiseStick_5f2522e0
1 Like

Yes! Solved!
I tried discovery a few times, but no items in inbox showed up. …
When i opened PaperUI > Inbox it showed all circle’s in my network.
I think discovery and display in Inbox takes some time or a restart :frowning:

I deleted the created _5f2522e0 - thing and looked at the log again…
Bridge and demostick now normally ONLINE.
and…auto discovery of all my circle’s again.

2018-06-15 13:53:22.420 [hingStatusInfoChangedEvent] - 'plugwise:circle:democircle' changed from ONLINE (CONFIGURATION_PENDING) to ONLINE
2018-06-15 13:53:23.532 [me.event.ThingUpdatedEvent] - Thing 'plugwise:stick:demostick' has been updated.
2018-06-15 13:53:24.747 [home.event.InboxAddedEvent] - Discovery Result with UID 'plugwise:circle:000D6F000099517E' has been added.
2018-06-15 13:53:25.683 [home.event.InboxAddedEvent] - Discovery Result with UID 'plugwise:circle:000D6F0000B1BCE6' has been added.

etc…

Thanks for ready my logs and reply to help

1 Like

That’s good news! :smile:

Discovery only runs periodically and when it runs it can take a while before it has retrieved all the information from the Stick.

You can also manually trigger discovery via Paper UI > Inbox and then click on “Search for things” and selecting the Plugwise Binding or clicking the “Scan” button in the top right corner.