-
Notifications
You must be signed in to change notification settings - Fork 13
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
Error - "Writing to COM port" #70
Comments
This might be related to some recent issues with the I don't have a Windows 10 system here to test on, and in fact I don't regularly test on Windows - I have been relying on |
Thank you for your reply.
As I am not very good in the npm package world and the "MISSING" intrigued me, I did an
But I still have the same problem. A
It looks like I already have serialport 7.1.2 if I understand correctly ? PS: I found this https://discourse.nodered.org/t/not-possible-to-communicate-via-com-port-with-rfxcom/1909 Someone who seems to have the same problem as me (as of last July) |
Yes, you have the latest version of serialport, and the most recent version of node-rfxcom supported by the current node-red-contrib-rfxcom (which is due for an upgrade in the next few days). I don't understand the MISSING message though - it would seem to mean you didn't have node-rfxcom installed at all, which would have given you a different error entirely. Please can you cd to the installation directory of
This will search for RFXCOM devices on all system serial ports as returned by the |
Looks like my RFX is not found. (It's very strange, knowing that windows detects it well (it is listed in COM and LPT) my VCP drivers are up to date and the RFXMngr works fine. |
I did a clean install of node and npm, then I just installed rfxcom and its dependencies. Then I launched this with node :
And I have this output :
I have less information but the initialization does not seem to succeed. It seems to be a problem related to |
I am also a maintainer of |
Ok, thank you for your time. I have done some tests with System.IO.Ports in .NET and also with only the "serialport" package under node.js to make sure that I am not having problems communicating with my COM port. Both work well (or at least I get the data bytes of my probes). [js] : const SerialPort = require('serialport')
const port = new SerialPort('COM8', function (err) {
if (err) {
return console.log('Error: ', err.message)
}
});
port.baudRate = 38400;
port.on('data', function (data) {
console.log('Data:', data)
})
port.on('error', function(err) {
console.log('Error: ', err.message)
}); [Output] :
Regarding writing, I copied the functions
|
Changing this function in this way in rfxcom.js (v.2.0.0) seems to have "solved" the problem. I imagine that everything I have quoted is important. So it may not be a perfect solution, but maybe it will give you some insights. this.on("ready", function () {
console.log("ready");
self.receiving = true;
self.getRFXStatus(function (err) {
if (err) {
self.close();
self.emit("disconnect", err);
}
});
/*self.resetRFX(function (err) {
if (err) {
self.close();
self.emit("disconnect", err);
} else {
setTimeout(function () {
self.flush(function (err) {
if (err) {
self.close();
self.emit("disconnect", err);
} else {
self.receiving = true;
self.getRFXStatus(function (err) {
if (err) {
self.close();
self.emit("disconnect", err);
}
});
}
});
}, 500);
}
});*/
}); Now I have :
(Do not take into account additional debug info, it comes from my tests.) Edit : serialport/node-serialport#1403 |
Many thanks for your bug-hunting efforts! It does indeed look like the underlying issue is serialport #1409. The code you have commented out is part of the logic that ensures robust handling of arbitrary disconnections & reconnections of RFXtrx433 devices, so I don't want to remove it altogether. The flush() is important, as there is no guarantee the RFXtrx433 won't send random data to the host after connection & before the reset is received. I think the best approach is probably to test the platform, and either call flush() or not as appropriate. With a bit of luck the data parser will cope with any spurious data, but if not, the user will have to disconnect & reconnect again. Hopefully, the serialport guys will sort this out soon (as well as the asynchronous callback issue #1751, for which a pull request awaits merging). |
You're welcome. It was not much :) Indeed I had other problems after removing this part of the function. I was well connected to the RFX but node-red did not seem to know it was the case since under the sensor-node I had "connecting ..." on the other hand I receive the data well. So I ended up just removing the flush like this : this.on("ready", function () {
self.resetRFX(function (err) {
if (err) {
self.close();
self.emit("disconnect", err);
} else {
setTimeout(function () {
self.receiving = true;
self.getRFXStatus(function (err) {
if (err) {
self.close();
self.emit("disconnect", err);
}
});
}, 500);
}
});
}); Also, when I redeploy my nodes, the COM8 tells me "Access Denied" and I have to redeploy again for it to work. Now, indeed if I understood you correctly, I expose myself to the risk of receiving corrupted data etc ... and a bad management of disconnections / reconnections. I also hope that serialport guys can take a look at this problem. |
It seems the latest fix to serialport has introduced yet another bug, which causes a segfault on macOS & Linux. Version 6.2.2 seems to be the best available at present, but it still has the Windows issue you found. Rather than publishsing an interim version with a partially-functional workaround (I tested removing the call to Sorry if this is causing you problems! Normal service will be resumed as soon as possible. |
I have now published rfxcom version 2.0.1 - this rolls back to serialport version 6.2.2, while including the partially-functional workaround. You can |
I'm happy to say |
Indeed everything seems to work very well now on my environement:
Thank you so much ! |
Hello,
I am currently experiencing a problem with the communication between my "RFXtrx433E" and this contrib.
To begin here the details of my setup :
My RFX is connected on the COM8 and it is well detected by the RFXmngr (I also receive the packets).
But in the node-red debug output console I got this :
etc ...
In my
rfxtrx-port
node I simply write "COM8" for theSerial port
. The problem may come from there ?Any help would be very appreciated.
The text was updated successfully, but these errors were encountered: