-
-
Notifications
You must be signed in to change notification settings - Fork 242
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
Open-close function #539
Comments
hi, thank you for the issue, I added help wanted label in case someone knows an answer to this quiestion |
p.s. I think this one may be helpful for your question: try to close the connection after each data collection, wait for the connection to close and then re connect. |
Hi @yaacov , I now use the following:
Perhaps I should add the client.close, but when testing the client for connection it's already 'disconnected'. Best regards, |
Hi @yaacov , it's very strange. If I use the:
Then there never happens, no data. When I remove the client.close it opens (and keeps open) connections until the modbus server rans out of connections (always 16 sessions). |
did you try closing the connection after using the read data ? |
Hi @yaacov , Here the snipped:
If I place the client.close() directly after the read, on position #1, then I only get TransactionTimedOutErrors, none succeeds. If I place the client.close() directly after the read, on position #2, then I 16 transaction successes, after than only TransactionTimedOutErrors. |
try to move the close to after the self.log(...) in readHoldingRegisters |
hi @yaacov , I need more reads. The modbus registers are spread.
Closing after the first read is nog desired. |
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all can you collect all reads, and then close after the last one is finished? |
Hi @yaacov , thank you for your reply. I tried that, but returned an error that the body could not be read. I'll try it again later today as suggested in the reference. best regards, |
Hi @yaacov , Bingo. I just past 100 reads.
|
Hi All,
I try to implement the TCP method this for a Homey device with multiple SUB-devices. Because of that I need the connection to be closed after data exchange.
Is there a way to open and close the client from within a interval function?
Best regards
The text was updated successfully, but these errors were encountered: