Kane610 / aiounifi

Asynchronous library to communicate with Unifi Controller
MIT License
57 stars 49 forks source link

Only use HTTPS if ssl_context exists #618

Closed mindphluxnet closed 3 months ago

mindphluxnet commented 3 months ago

Despite being able to set a SSL context the URI used to connect to the controller is hardcoded to use HTTPS. Not every controller runs on HTTPS so connecting will always fail with the error

2024-03-15 21:17:48.964 ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi Network at uinet: Error requesting data from https://host:8443: Cannot connect to host host:8443 ssl:False [Name has no usable address]

This feels like an oversight so my PR fixes this.

Kane610 commented 3 months ago

Thanks for contributing but I don't see the need for this.

People have been running it in all types of setups the last ~6 years and never have anyone complained. Why I ever passed in the context was if I would ever handle proper certificates which no-one also never complained on. My current plan is to remove the context and clean that part up.

mindphluxnet commented 3 months ago

Alright.