Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin causing repeated restart of Homebridge #21

Open
davidpesetsky opened this issue Oct 29, 2022 · 16 comments
Open

plugin causing repeated restart of Homebridge #21

davidpesetsky opened this issue Oct 29, 2022 · 16 comments

Comments

@davidpesetsky
Copy link

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!)

@captainalvarez
Copy link

Having the same issue

@ohmantics
Copy link

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.

@ohmantics
Copy link

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.

@davidpesetsky
Copy link
Author

davidpesetsky commented Nov 3, 2022

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?

@ohmantics
Copy link

ohmantics commented Nov 3, 2022

For Homebridge, the updated authentication method will have to be translated from Python to TypeScript.

@davidpesetsky
Copy link
Author

Well above my paygrade, unfortunately.

@ohmantics
Copy link

I'm looking at it, but I'm not much of a TypeScript developer.

@chrisvanhorn
Copy link

Same issue here. Really a bummer! Hoping someone smarter than me can fix this.

@dzeleski
Copy link

dzeleski commented Nov 16, 2022

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:
RobertD502/cowayaio@05fd749

Changes to the auth method from the py lib above:
RobertD502/cowayaio@1be2cbe

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.

@ohmantics
Copy link

I've pushed a pull request here: mroth#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.

@ohmantics
Copy link

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.

@chrisvanhorn
Copy link

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!

@davidpesetsky
Copy link
Author

Fantastic — working perfectly here too. Thank you so much!

@RobertD502
Copy link

@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.

@vponnusamy
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants