thoukydides / homebridge-aeg-robot

AEG RX9 / Electrolux Pure i9 robot vacuum plugin for Homebridge
https://www.thouky.co.uk
ISC License
5 stars 0 forks source link

Make the AEGAPI a module in NPM #46

Open gslender opened 2 weeks ago

gslender commented 2 weeks ago

Description of Enhancement

Hi, would you consider making the AEGAPI modulised so that it can be used in other projects? My only other alternative is strip out bits and make it such but would rather you take the credit for that and publish it. Thoughts?

HomeKit Mapping

none

AEG/Electrolux Appliance(s)

none

thoukydides commented 2 weeks ago

Each time I start a new Homebridge project I consider implementing the API as a separate module because I can see that it might be useful for others. However, I always decide against it for multiple reasons:

All of those still apply to this plugin. Additionally, I expect to be making significant changes in a few months due to the iOS 18 adding proper HomeKit support for robot vacuum cleaners, and whilst that shouldn't affect the AEG API implementation I cannot rule it out at this stage.

Finally, for a new project I would recommend using the websocket API instead of this one. Search for projects that refer to webSocketRegionalBaseUrl for examples. However, if you prefer to start from this project then I don't have any issue with you deriving and publishing your own module based on it.

gslender commented 2 weeks ago

Hey Thanks Alex, really appreciate the time/effort to respond so thoughtfully.

One question I hope you don't mind asking, are you having success with the token-refresh? Have you tested this and does it work? I've tried to copy other implementations regarding the AEG / Electrolux OCP API and it seems to not work and is refused/denied. So wondering if your approach to the service is fully working/tested?

I do see some differences in how you're using the API, so perhaps that's the key, but wanted to ask before I start reflecting the code into my own library to confirm.

Thanks again. Grant

thoukydides commented 2 weeks ago

Yes, the token refresh works fine.

Checking the logs for the last couple of months, the token refresh was performed twice each day, with only a single failure on 3rd July when there were problems with the API servers. On that occasion there was a fallback to the original username/password authorisation, which also failed multiple times before it started working again 5 minutes later. Every other refresh was successful, with the new tokens used in subsequent requests.