-
-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Problem Description
ComfoConnect bridge discovery fails silently on Windows systems, returning an empty list of bridges, while the same network setup works correctly on Linux.
Environment
- OS: Windows 11
- Python: 3.10+
- aiocomfoconnect: v0.1.15 (commit
b5c9570
) - Network: ComfoConnect bridge present and accessible on local network
Windows Network Configuration
The Windows system has a complex network setup with multiple adapters:
- Primary Ethernet:
192.168.xxx.yy/24
(gateway:192.168.xxx.1
) - main network - VirtualBox Host-Only:
192.168.zzz.1/24
- no gateway - WSL Hyper-V:
172.aa.bb.1/20
- virtualization network - Multiple disconnected WiFi adapters
This multi-adapter setup may contribute to the broadcast address resolution issue, as the hardcoded "<broadcast>"
string may not resolve to the correct network interface on Windows.
Expected Behavior
Discovery should find available ComfoConnect bridges on the network, same as on Linux.
Actual Behavior
Discovery returns empty results on Windows:
Discovered bridges:
Debug Output Comparison
Windows (Failing)
git rev-parse --short HEAD ; python -m aiocomfoconnect -d discover
b5c9570
DEBUG:asyncio:Using proactor: IocpProactor
INFO:asyncio:Datagram endpoint local_addr=('0.0.0.0', 0) remote_addr=None created: (<_ProactorDatagramTransport fd=408>, <aiocomfoconnect.discovery.BridgeDiscoveryProtocol object at 0x000001E908A2E510>)
DEBUG:aiocomfoconnect.discovery:Socket has been created
DEBUG:aiocomfoconnect.discovery:Sending discovery request to broadcast:56747
Discovered bridges:
DEBUG:asyncio:Close <ProactorEventLoop running=False closed=False debug=True>
Linux (Working)
python -m aiocomfoconnect -d discover
DEBUG:asyncio:Using selector: EpollSelector
INFO:asyncio:Datagram endpoint local_addr=('0.0.0.0', 0) remote_addr=None created: (<_SelectorDatagramTransport fd=6 read=idle write=<idle, bufsize=0>>, <aiocomfoconnect.discovery.BridgeDiscoveryProtocol object at 0x74c6e94a4710>)
DEBUG:aiocomfoconnect.discovery:Socket has been created
DEBUG:aiocomfoconnect.discovery:Sending discovery request to broadcast:56747
DEBUG:aiocomfoconnect.discovery:Data received from ('192.168.xxx.yy', 56747): b'\x12$\n\x0e192.168.xxx.yy\x12\x10\x00\x00\x00\x00\x00"\x10\x17\x80\x01\x14O\xd7\x1d\xe3\xb8\x18\x01'
Discovered bridges:
<Bridge 192.168.xxx.yy, UID=000000000022xxxxxxxxxxxxxxxxxxxx>
DEBUG:asyncio:Close <_UnixSelectorEventLoop running=False closed=False debug=True>
Root Cause Analysis
The issue is in aiocomfoconnect/discovery.py
line 39:
self.transport.sendto(b"\x0a\x00", ("<broadcast>", Bridge.PORT))
Key differences observed:
- Windows: Uses
ProactorEventLoop
- noData received
debug message appears - Linux: Uses
SelectorEventLoop
- receives response successfully - Missing on Windows: UDP broadcast packets don't reach the network interface
This appears to be a platform-specific difference in how "<broadcast>"
is handled between Windows ProactorEventLoop and Linux SelectorEventLoop.
Possible Solution
Replace the hardcoded "<broadcast>"
string with programmatically determined broadcast address using the local network interface configuration.
Workaround
Using a specific IP address works:
python -m aiocomfoconnect discover --host 192.168.xxx.yy
Impact
- Discovery completely broken on Windows systems
- Affects all Windows users trying to discover ComfoConnect bridges
- Silent failure - no error messages to help users diagnose the issue