Open davidpesetsky opened 2 years ago
Having the same issue
It's broken for everybody. Coway changed their authentication response. Logging in via the iOS app asks you to switch to a "new membership scheme."
Trying to sort out what that authentication looks like, but they've foolishly assumed that they can verify an email with a 5m countdown timer, which is fundamentally incompatible with a popular anti-spam technique called greylisting.
Looks like another plugin has already solved the change in authentication methods. Give https://github.com/RobertD502/home-assistant-iocare a try after migrating your account in the IOCare app.
Looks like another plugin has already solved the change in authentication methods. Give https://github.com/RobertD502/home-assistant-iocare a try after migrating your account in the IOCare app.
Thanks — but this looks like it's a plugin for something called Home Assistant. Is there a version for HomeBridge or a way to install a Home Assistant plugin so it works under HomeBridge?
For Homebridge, the updated authentication method will have to be translated from Python to TypeScript.
Well above my paygrade, unfortunately.
I'm looking at it, but I'm not much of a TypeScript developer.
Same issue here. Really a bummer! Hoping someone smarter than me can fix this.
So it appears as said above the auth mechanism has changed as well as the URIs.
Existing URIs: https://github.com/aschzero/homebridge-airmega/blob/master/lib/Config.ts#L10-L18
Changes made for the URIs in the py lib above: https://github.com/RobertD502/cowayaio/commit/05fd749d9de0d09d7d569011d2f9e8e04d9d00a5
Changes to the auth method from the py lib above: https://github.com/RobertD502/cowayaio/commit/1be2cbee43d215d3e85c4af522acf1583f3f46f7
py client: https://github.com/RobertD502/cowayaio/blob/master/cowayaio/coway_client.py#L21
Existing ts client: https://github.com/aschzero/homebridge-airmega/blob/master/lib/Authenticator.ts#L57-L82
Should be somewhat simple to re implement this in typescript, although im a python dev so I might be speaking out of ignorance. Ill see if I can get a rough POC working over the next few days. If someone happens to stumble across this before I get to it at least the python answer is easily found.
I've pushed a pull request here: https://github.com/mroth/homebridge-airmega/pull/2
Matthew's fork has a bunch of clean-up changes that looked like a better place to base this work, but I'm hitting the limits of my experience with these languages/tools. There may be some more changes to how tokens are refreshed, but I've gotten the new authentication working and now it's failing in relatively boring parts of the code. If Matthew doesn't reply, any additional eyes are most welcome.
As none of the prior contributors to this plugin have responded, I've gone ahead and published my changes on npm as @ohmantics/homebridge-airmega at version 3.3.0.
Many thanks to @RobertD502 for his work on the new authentication scheme and @mroth for his work on cleaning up the plugin structure.
As none of the prior contributors to this plugin have responded, I've gone ahead and published my changes on npm as @ohmantics/homebridge-airmega at version 3.3.0.
Many thanks to @RobertD502 for his work on the new authentication scheme and @mroth for his work on cleaning up the plugin structure.
You are a god. Installed and working great over here!
Fantastic — working perfectly here too. Thank you so much!
@ohmantics I'm glad to hear Cowayaio is helping other projects aside from the Home Assistant integration.
Regarding token refreshes:
Your guess is as good as mine as to when a token expires since none of this information is returned in the response. However, I do know for sure that if a token has expired the response header will contain a error_code
key with CWIG0304COWAYLgnE
as the error. There doesn't seem to be a specific token refresh endpoint, so, I handle those situations with a fresh login.
As none of the prior contributors to this plugin have responded, I've gone ahead and published my changes on npm as @ohmantics/homebridge-airmega at version 3.3.0.
Many thanks to @RobertD502 for his work on the new authentication scheme and @mroth for his work on cleaning up the plugin structure.
Just stumbled on this...this was a minor nuisance in my homebridge, but glad to have it cleaned up now. Thanks!
Since updating Homebridge to v1.5.1 on my Raspberry Pi, the homebridge-airmega plugin appears to be triggering a repeated restart:
[29/10/2022, 09:29:31] TypeError: Cannot read properties of null (reading '0') at Authenticator. (/usr/local/lib/node_modules/homebridge-airmega/lib/Authenticator.ts:89:49)
at Generator.next ()
at fulfilled (/usr/local/lib/node_modules/homebridge-airmega/dist/lib/Authenticator.js:4:58)
[29/10/2022, 09:29:31] Got SIGTERM, shutting down Homebridge...
[29/10/2022, 09:29:31] [Harmony Remote] INFO - shutdown
[29/10/2022, 09:29:32] [Homebridge UI] Homebridge restart request received
Disabling the plugin eliminated the problem. (But I would like to start using it again!)