Closed roysjosh closed 2 years ago
This is still referenced in the popular HASS thread about getting Nanoleaf working over HAP: https://community.home-assistant.io/t/homekit-accessory-protocol-hap-over-coap-udp-was-nanoleaf-essentials-bulb-via-thread-coap/335167/93
Just curious if @chrysn has seen this yet.
@roysjosh Until upstream responds, what happens if we just pass in -3000
instead of 0
I'm working on a Home Assistant component that needs to communicate with several devices at the same time. Additionally, the devices can push notifications which seems to require a server context with a Site attached to receive them. Unfortunately, another user who has the
ws
transport enabled is getting the following upon the creation of the second server context:This is in spite of me passing a
bind=('::',0)
parameter to thecreate_server_context
call asking for a random port: https://github.com/Jc2k/aiohomekit/pull/52/files#diff-4d3bce65cb96997bae448f68447d41b128f33e8fbdffb019c73caa183ce28833R480It looks like the
ws
transport doesn't know that 0 means random as it adds a fixed value of 3000 to ports that aren'tNone
: https://github.com/chrysn/aiocoap/blob/master/aiocoap/transports/ws.py#L190I don't think using an environment variable is a good solution here as that is process-wide and I don't know what other HA plugins might require. Do you think a
transport=
parameter tocreate_server_context
would be an appropriate solution? Or would you prefer a fix to thews
transport? Both? Looking forward to your thoughts here. Thanks!