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

NodeManager and MySensors openHAB binding: constant reset #373

Closed
wmarkow opened this issue Jun 19, 2018 · 5 comments
Closed

NodeManager and MySensors openHAB binding: constant reset #373

wmarkow opened this issue Jun 19, 2018 · 5 comments

Comments

@wmarkow
Copy link

wmarkow commented Jun 19, 2018

Environment:

  • NodeManager installed on Arduino Uno
  • NodeManager configured to be a Serial Gateway
  • NodeManager has enabled FEATURE_DEBUG flag
  • Arduino Uno connected to openHAB
  • openHAB has installed MySensors Binding

Result:
MySensors openHAB Binding constantly reconnects to serial port causing the Arduino Uno to be restarted as well. This looks a bit poor.

This behavior is a side effect of printing to serial port some "bogus" (debug) characters by NodeManager. When NodeManager is configured to be a Serial Gateway, those debug messages doesn't follow the MySensors Serial API.

I think that MySensors openHAB Binding should be resistant to such a bogus messages. I have already reported this issue as tobof/openhab-addons/issues/116.

Here are the log messages that are printed to serial port by Arduino Uno with NodeManager:

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

While I'm good with NodeManager sendings debug messages to serial port, there is only one thing that could be improved in NodeManager. This message looks faulty but it could be easily improved:

RADIO...0;255;3;0;14;Gateway startup complete.

I believe that a new line character is missing after RADIO...

@user2684 user2684 added the bug label Jun 19, 2018
@user2684
Copy link
Contributor

Thanks for reporting this issue. I believe would be a bit harder to make NodeManager following the MySensors Serial API since the structure of the message is completely different and sometimes it is needed to print out something different than just numbers. Workaround would be to turn FEATURE_DEBUG OFF, as you have probably already done.
The newline missing is because NodeManager prints "RADIO..." than after the radio communication has been established, prints out an "OK" so to make radio troubleshooting when the MySensors debug is off easier because the OK never comes if there is any communication issue. Makes sense?

@wmarkow
Copy link
Author

wmarkow commented Jun 22, 2018

Thanks, I didn't take a closer look in the source code and I didn't know about that FEATURE_DEBUG flag. I have switched it OFF and everything works fine.

Related that radio debug messages: maybe it would be good idea to use Serial.println anyway and display debug messages always with newline at the end. In that case it could look like on the example below

Checking RADIO...
0;255;3;0;14;Gateway startup complete.
RADIO OK

@user2684
Copy link
Contributor

Fixed by #387 by forcing FEATURE_DEBUG to OFF if MY_GATEWAY_SERIAL is defined.
I've noticed NodeManager's debug for a gateway bring also an additional problem: slow down the communication with the controller, especially at low baud rates, preventing a controller supporting smart sleep to respond timely. Hence disabling debug output for a serial gateway looks like the best option for now

@wmarkow
Copy link
Author

wmarkow commented Jul 20, 2018

Sounds good for now. I can imagine that a lot of debug messages can slow down the communication (and data processing by Arduino), especially at lower baud rates.

@user2684
Copy link
Contributor

Reopening it since I found a better solution. With #391 debug output is using MySensors' hwDebugPrint() and is no more redirected to the serial port. In this way, the MySensors library automatically convert any debug output in I_LOG_MESSAGE messages when running as a gateway which is fully compatible with any controllers and NodeManager's debug output is not lost

@user2684 user2684 reopened this Jul 23, 2018
@user2684 user2684 added the fixed label Jul 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants