njh / node-red-contrib-owfs

Node-RED node for talking to 1-wire devices using owfs
http://flows.nodered.org/node/node-red-contrib-owfs
Apache License 2.0
8 stars 8 forks source link

OWFS Client Socket Not Closing... #25

Open micah-quinn opened 3 years ago

micah-quinn commented 3 years ago

Hello! Thanks for all the work on a great node-red module.

I have a 1-wire network with 14 devices on it. They are DS2413s (a 2 pin GPIO chip). They will need to be polled at fairly high frequency and so I noticed that the owfs client socket is not closing after doing a client.read. It appears that the node-owfs requires an explicit destroy on the returned socket to close it. I assume this is because owserver supports persistent connections and may not be sending an end after responding. I've spent some time trying to figure out a solution, but honestly I'm not that well versed in promisification, so I need some help.

The net result after polling these devices once per second for a few minutes is 100s of open socket connections to owserver. If you can maintain the socket object through the promisification and destroy it at the end of the call, I think this will fix it. Perhaps a more ideal fix would be to support persistent connections, but I think that requires modification to the node-owfs library. Please let me know if you need more details.

brano1990 commented 3 years ago

hi did you find the solution? i need to read 50ms on 10pcs ds2408

micah-quinn commented 3 years ago

I did not investigate this any further. I wound up writing my own module to read the DS2413s directly rather than using node-red-contrib-owfs:

https://github.com/micah-quinn/node-red-contrib-1w-ds2413

brano1990 commented 3 years ago

@micah-quinn super and is your module read DS2408? can you help me import your module into the red node?

micah-quinn commented 3 years ago

Sorry, I'm not sure I understand your question. You'll simply have to look at my code and the Node-Red documentation to figure out how to install it. My code only attempts to read DS2413 modules.