chasenicholl / homebridge-weatherflow-tempest

WeatherFlow Tempest Homebridge Plugin
Apache License 2.0
15 stars 2 forks source link

Set `reuseAddr` to `true` on the UDP socket #26

Open bourquep opened 2 days ago

bourquep commented 2 days ago

Is your feature request related to a problem? Please describe: I want to install another tool on the same Mac mini running Homebridge and this plugin which would also handle the Tempest local API data by decoding packets received on UDP port 50222. However, that other tool is currently unable to open a socket because the Homebridge plugin already has a socket open for that port.

Describe the solution you'd like: I am no Node networking expert so I asked ChatGPT (🤷🏻‍♂️), and it appears that creating the socket like this would fit the bill:

dgram.createSocket({ type: 'udp4', reuseAddr: true })
chasenicholl commented 17 hours ago

Thanks! I'll take a look into this. Is the other tool a homebridge plugin in the same runtime and using the same port?

bourquep commented 16 hours ago

It's a WeeWX device driver: https://github.com/captain-coredump/weatherflow-udp

FYI, I have already submitted a PR to address this: #27