homebridge-ewelink
homebridge-ewelink copied to clipboard
A big one - Refactoring & WebSocket Client Improvements
This is a much bigger set of changes than I was intending to include in a single PR, but here it goes. I think it is time to start getting these changes looked at by a wider group. Ideally we can get these tested & merged in.
This has done a pile of refactoring to remove duplication in the plugin for how it was reading the status for devices. As part of this, and adding experimental support for getting the device status with WebSockets (#74), the approach to loading data has been separated out. In lib, there is now an api.js
file which handles all the API operations which the plugin was performing. This then internally deals with working out what needs to go to the REST, WebSockets and Lan mode APIs depending on the feature flags enabled.
These feature flags are now documented in the README file, which is worth reading to get a feel for the changes being introduced.
There is also an additional fakeFan
setting which I have been using to allow testing of Fan type devices. This refactoring has removed a lot of duplication in how the fan Active and Light statuses were being loaded, as these were just switches.
This has introduced for the LAN and WebSocket clients caching of device status information (albeit for a short period for the latter), which should help with issues where the websocket is closed due to too many quick requests being made for the same device.
The main area I have been unable to test changes in is for Blinds, so hoping someone is able to try some pre-release code to check if my branch functions.
Wow thank you @dhutchison ! That's a lot of hard work! It would take some time for me to review this before merging.
Any tentative date for merging this?
Hi @prasad-edlabadka please try https://github.com/bwp91/homebridge-ewelink which is more active and better.