alexryd / node-shellies

Handles communication with Shelly devices
MIT License
35 stars 13 forks source link

Support CoAP unicast messages #22

Closed alexryd closed 3 years ago

alexryd commented 3 years ago

This will change the message code for Shelly unicast messages from 2.05 to 0.30 right before they are handled by the server, to work around the fact that the node-coap server will drop any requests with codes that don't start with a 0.

@jghaanstra Can you see if this works for you?

jghaanstra commented 3 years ago

Works!

I'd still like to suggest to remove line 64 (multicastInterface: networkInterface,) though. networkInterface is null anyway and removing this will make sure node-coap adds membership to all available interfaces.

alexryd commented 3 years ago

Nice!

Some users of my homebridge-shelly plugin need the networkInterface option so I can't remove that. On some systems, trying to add a UDP membership to a virtual network interface will result in an error, so in that case you need to be able to specify which interface you want.

jghaanstra commented 3 years ago

Ok clear.

alexryd commented 3 years ago

Does this work with the new motion sensor as well @jghaanstra?

jghaanstra commented 3 years ago

My motion sensor just crashed trying to update the unicast address. Cant get it online anymore.

jghaanstra commented 3 years ago

Hmm, strange. It turned itself off (shipping state). But yes, these changes also works with the motion sensor.

alexryd commented 3 years ago

Ok great, thanks. I'm going to merge and deploy this now then.