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

node-red-node-serialport message duplication #1069

Open
mima232 opened this issue May 22, 2024 · 3 comments
Open

node-red-node-serialport message duplication #1069

mima232 opened this issue May 22, 2024 · 3 comments

Comments

@mima232
Copy link

mima232 commented May 22, 2024

Which node are you reporting an issue on?

node-red-node-serialport serial control node

What are the steps to reproduce?

Just send enable two or more times to control node

What happens?

All serial nodes that have output and are configured for the same port will emit multiple same messages according to number of issued enables

What do you expect to happen?

I expect to emit the unique message only one time

I've tried it with usb serial and with native rs232, both same behaviour.

  • Node-RED version: 3.1.9
  • node.js version: 20.13.1
  • npm version: 10.5.2
  • Platform/OS: Ubuntu 24.04 LTS
  • Browser: Chrome
@syoma755
Copy link

Have more or less the same issue with Node-Red 4.05 and node-red-node-serialport 2.0.3 on Windows 11:

If the serial port was disabled using "Serial Control" Node, the next time it is enabled, "Serial in" outputs each message twice or more times. The only way to stop it is to change some configurations in "Serial Port" Configuration node and restart the flow.

@Steve-Mcl
Copy link
Contributor

Could be event handlers not being removed or being (re)added a second, third time upon re-connection.

@syoma755 Would you confirm something please?

  • deploy
  • confirm single messages
  • disconnect / connect via "Serial Control"
  • confirm duplicate messages
  • disconnect / connect via "Serial Control"
  • confirm triplicate messages
  • and so on

That would help us investigate the issue.

@syoma755
Copy link

syoma755 commented Oct 17, 2024

Hi Steve

Just tried to reproduce it.

Sequence 1:

  • Started Node-Red from command Line

  • COM Port was connected automatically at flow start - both 'serial in' and 'serial out' show green 'connected' status

  • Sent single message over 'serial out'

  • Single messages received at 'serial in'

  • Sent {"enabled":true} payload to 'serial control'

  • output of 'serial control':
    {"serialport":"COM11","serialbaud":3000000,"databits":8,"parity":"none","stopbits":1,"dtr":"none","rts":"high","cts":"none","dsr":"none","enabled":true}

  • 'serial control' status stays green

  • 'serial in' became grey - not connected

  • Sent single message over 'serial out'

  • Double messages received at 'serial in'

  • Sent {"enabled":true} payload to 'serial control' once more

  • Output of 'serial control':
    {"serialport":"COM11","serialbaud":3000000,"databits":8,"parity":"none","stopbits":1,"dtr":"none","rts":"high","cts":"none","dsr":"none","enabled":true}

  • 'serial control' status stays green

  • 'serial in' stays grey - not connected

  • Sent single message over 'serial out'

  • Triple messages received at 'serial in'
    ...

  • sent few times {"enabled":true} payload to 'serial control'

  • the number of received messages to single requests at 'serial in' increases proportionally. 'serial in' shows grey status.

Sequence 2:

  • Started Node-Red from command Line

  • COM Port was connected automatically at flow start - both 'serial in' and 'serial out' show green 'connected' status

  • Sent single message over 'serial out'

  • Single messages received at 'serial in'

  • Sent {"enabled":false} payload to 'serial control'

  • Output of 'serial control':
    {"serialport":"COM11","serialbaud":3000000,"databits":8,"parity":"none","stopbits":1,"dtr":"none","rts":"high","cts":"none","dsr":"none","enabled":false}

  • 'serial control' status become gray - stopped

  • Both 'serial in' and 'serial out' become grey - stopped

  • Sent {"enabled":true} payload to 'serial control'

  • Output of 'serial control'
    {"serialport":"COM11","serialbaud":3000000,"databits":8,"parity":"none","stopbits":1,"dtr":"none","rts":"high","cts":"none","dsr":"none","enabled":true}

  • 'serial control' status become green

  • 'Serial in' shows green -connected status, 'serial out' shows grey - stopped status.

  • Sent single message over 'serial out'

  • Single messages received at 'serial in'

  • Sent {"enabled":true} payload to 'serial control'

  • output of 'serial control':
    {"serialport":"COM11","serialbaud":3000000,"databits":8,"parity":"none","stopbits":1,"dtr":"none","rts":"high","cts":"none","dsr":"none","enabled":true}

  • 'serial control' status stays green

  • 'Serial in' shows grey - not connected status, 'serial out' shows grey - stopped status.

  • 'serial in' became grey - not connected

  • Sent single message over 'serial out'

  • Double messages received at 'serial in'

  • further behaiviour same as in sequence 1.

Please note that also after disabling and enabling the serial port in Sequence two, I'm sometimes also get duplicated messages, but can not reproduce it reliably. Usually if 'serial in' becomes grey - not connected, after port enabling (even if node-red console shows that COM is connected), I will get duplicated messages. Especially if some other program was using this serial port in between.

Hope it helps to debug the issue.Let me know if

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

No branches or pull requests

3 participants