Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SerialPortGateway reconnects to serial port to frequently #116

Open
wmarkow opened this issue Jun 19, 2018 · 2 comments
Open

SerialPortGateway reconnects to serial port to frequently #116

wmarkow opened this issue Jun 19, 2018 · 2 comments
Labels

Comments

@wmarkow
Copy link

wmarkow commented Jun 19, 2018

Expected Behavior

Serial port gateway should not reconnect to serial port so frequently. It is bad for performance and - every reconnect to serial port - resets the connected ArduinoUno Gateway Device as well.

Current Behavior

I'm using a MySensors Serial Port gateway which is running a mysensors/NodeManager. It looks like NodeManager sends to serial port some bogus characters which doesn't follow the MySensors Serial API:

NodeManager v1.7
LIB V=2.3.0-alpha R=- E=- T=G A=A S=- B=-
RADIO...0;255;3;0;14;Gateway startup complete.
0;255;0;0;17;2.3.0-alpha
OK
0;255;3;0;11;NodeManager
0;255;3;0;12;1.0
READY 

MY I=0 M=255 
INT P=3 M=255
INT P=2 M=255

MySensors OpenHAB Binding has a mechanism that reconnects to serial port if more than 5 bogus messages are received on serial port. In the short log above you can see 11 messages, from which only 3 seems to be correct.
Morover ArduinoUno restarts on every attempt to connect to serial port - actually this is a correct behavior but a side effect of this is that NodeManager sends again those bogus messages to MySensors Binding and the whole cycle repeats.
I'm attaching the openHAB-reset-serial-gateway.log fro reference.

Possible Solution

I would say that the mechanism of detecting bogus frames could be changed on the MySensors Binding side. The binding could just flush (and possibly log them with the debug level) the garbage messages. It may be not possible to avoid sending such a messages from the attached hardware gateway: i.e. some library (like a hardware sensor) may be written in the way that it constantly prints something bogus to serial port. MySensors Binding should be resistant to such a messages.

Does openHAB contain some internal mechanism to check if Gateway is up and running? If so, maybe we could use it?

Steps to Reproduce (for Bugs)

Run openHAB-2.4.0-SNAPSHOT, install mysensors binding (that binding which is compatible with openHAB-2.4.0 take a look at #114), attach the Arduino Uno with installed NodeManager. Configure MySensor Serial Gateway correctly in openHAB.

Your Environment

@wmarkow wmarkow closed this as completed Jun 19, 2018
@wmarkow
Copy link
Author

wmarkow commented Jun 19, 2018

I think I have just accidentally closed this issue. I'm reopening it again.

@wmarkow
Copy link
Author

wmarkow commented Jun 22, 2018

I didn't know that those debug messages (I called them bogus before) from NodeManager can be switched off by setting FEATURE_DEBUG to OFF. When I did this, the MySensors Binding works stable and do not reconnect to serial port.

Now I'm not sure if this issue is a bug. Maybe it is more like improvement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants