pizzalorddex / homebridge-unifi-ap-light

Control the light rings on your UniFi Wireless Access Point(s) with HomeKit
Apache License 2.0
0 stars 0 forks source link

Refactored code, added API session manager, and added support for new API Endpoint URL #1

Closed pizzalorddex closed 3 months ago

pizzalorddex commented 3 months ago

Overview: This pull request introduces significant improvements to the homebridge-unifi-wap-light plugin. The updates include a comprehensive refactor of the codebase, the integration of a session manager to handle API sessions more robustly, and extended support for both legacy and new UniFi Controller APIs.

Changes:

  1. Code Refactoring: Enhanced error handling mechanisms to provide clearer error messages and to handle API connectivity issues more gracefully.
  2. API Session Management: Introduced a new SessionManager class responsible for managing API sessions. This includes handling authentication, session renewal, and request retries after session expirations.
  3. Enhanced API Support: Added functionality to communicate with both the previous and the "new" versions of the UniFi Controller API. Implemented logic to dynamically select API endpoints based on the availability and response of the UniFi Controller.

Testing: