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

SerialPort 9x -> 10.x problem #19

Open
VincentSC opened this issue Apr 9, 2023 · 2 comments
Open

SerialPort 9x -> 10.x problem #19

VincentSC opened this issue Apr 9, 2023 · 2 comments

Comments

@VincentSC
Copy link
Contributor

Hi Sebastian,

Long time not "spoken"! :)

I got a problem since some time, and I did not realize till today it was in this package caused by 3460ba4

node-red-contrib-comfoair gives these errors:

9 Apr 20:53:08 - [error] [comfoair:c5f08486.64a36] TypeError: SerialPort is not a constructor
9 Apr 20:53:08 - [error] [comfoair:f912a0a0.e8fe98] TypeError: SerialPort is not a constructor
9 Apr 20:53:08 - [error] [comfoair:d1308d38.3511f] TypeError: SerialPort is not a constructor

Eventually I got here: https://serialport.io/docs/guide-upgrade#upgrading-from-9x-to-10x

Everywhere this needs to change:
const SerialPort = require('serialport'); -> const { SerialPort } = require('serialport');.

  • node-red-contrib-comfoair/comfoair-connection.js
  • comfoair/ComfoairStream.js
        this.port = new SerialPort(options.port, {
            baudRate: options.baud || 9600
        }, cb);

has to change to

        this.port = new SerialPort({ 
            path: options.port,
            baudRate: options.baud || 9600
        }, cb);

I tested successfully with both downgrading back to serialport 9.2.8 and the above fixes with 10.5.0.

@sofa74surfer
Copy link

Hello @VincentSC , do you know, what to change here: https://github.com/coolchip/node-red-contrib-comfoair/blob/master/comfoair-connection.js
I changed, const { SerialPort } = require('serialport');, but the second thing to change about "path". I really not familiar with java and java script, so I have no clue how to adapt this path-change to the code in node-red-contrib-comfoair/comfoair-connection.js. It looks completely different to comfoair/ComfoairStream.js.

@VincentSC
Copy link
Contributor Author

A month ago I moved to MacOS and I had no dev-env there yet. I think I can make a PR this week, as it's now set up.

@coolchip Got time later this week to review that PR?

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

2 participants