RobertD502 / home-assistant-iocare

Home Assistant custom component for monitoring and controlling Coway Airmega Purifiers
MIT License
50 stars 8 forks source link

Failed setup - All devices offline last night #36

Closed angrycatmeowmeow closed 5 months ago

angrycatmeowmeow commented 7 months ago

Last night all four of my purifiers stopped reporting to HA. They are accessible in the iocare app and none of the wifi lights are blinking on the units, so they have a cloud connection. I tried reloading the integration but it is failing to set up. My password has not changed and skip password change is checked in integration config.

2024.3.1 Version 0.3.3 home-assistant_coway_2024-03-18T14-52-36.779Z.log

RobertD502 commented 7 months ago

On vacation so I won't be able to do anything until I'm back. Looks like they have made some changes to the API as indicated by the forced requirement to update the mobile app to continue using:

image

angrycatmeowmeow commented 7 months ago

Ah, thanks to the integration I don't keep the app on my phone, I downloaded it this morning to check if I could login and see my devices, and obviously it downloaded the latest version so I didn't see that.

Enjoy your vacation!

RobertD502 commented 7 months ago

Did a quick test to see what is going on and the worst-case scenario is true......brand new API which will require a complete rewrite of the backend.

angrycatmeowmeow commented 7 months ago

I'm not sure why or how, but about 5 hours ago all four of my purifiers came back online in HA. Guess we'll see how long it lasts?

ampersandru commented 7 months ago

I'm not sure why or how, but about 5 hours ago all four of my purifiers came back online in HA. Guess we'll see how long it lasts?

yep, same here. maybe it was unintentional on coway's end and they fixed it, hopefully.

RobertD502 commented 7 months ago

Same here. More than likely they had complaints from users that are running older mobile OSs that don't support the most recent mobile app and as a result were unable to control their purifiers with an older version of IoCare. They must have enabled the old endpoints to appease those users.

How long they'll continue to support it for I'm not sure, so, it would be a good idea to plan for a rewrite to use the new API.

dd143999 commented 6 months ago

Just to provide another data point: Unfortunately, that whole walking back of the API endpoints and the resultant restoration of functionality thing doesn't seem to be true for all cases/accounts/devices/[insert other unknown variable here, like which random Coway server I end up hitting behind their load balancers or something].

I've been keeping an eye on this issue and on my installation's status in HA, and I haven't seen any evidence of reversion to an integration-compatible working state. Just the same symptoms as others have reported: "Coway server failed to return air purifier quality status" errors in Needs Attention in the integration in HA, and the "Finished fetching coway data in X.XXX seconds (success: False)" messages in the logs.

Not sure why I'm not seeing improvement while others are. I have two integration-compatible Coway purifiers, a 400S and an AP-1512HHS. The only weirdness I can think of with my installation is that the 1512HHS was newly purchased, and I only noticed the problem after I set it up, which involved me having to download a new version of the iOS IoCare app. The integration was never able to pull data for the 1512HHS, and during the registration process for it, my existing 400S's integration connection began to fail, too. (Oddly, the 400S still worked with the integration after others had reported the issue here. I suspect the old API was still honoring my existing connection and that me going through the registration song and dance for the 1512HHS caused connections tied to my account to be reset, but that's speculation.)

Tl;dr: Not all connections have been restored. Expect inconsistencies. Looking forward to rewrite, but I don't envy you doing it.

RobertD502 commented 6 months ago

Just to provide another data point: Unfortunately, that whole walking back of the API endpoints and the resultant restoration of functionality thing doesn't seem to be true for all cases/accounts/devices/[insert other unknown variable here, like which random Coway server I end up hitting behind their load balancers or something].

I've been keeping an eye on this issue and on my installation's status in HA, and I haven't seen any evidence of reversion to an integration-compatible working state. Just the same symptoms as others have reported: "Coway server failed to return air purifier quality status" errors in Needs Attention in the integration in HA, and the "Finished fetching coway data in X.XXX seconds (success: False)" messages in the logs.

Not sure why I'm not seeing improvement while others are. I have two integration-compatible Coway purifiers, a 400S and an AP-1512HHS. The only weirdness I can think of with my installation is that the 1512HHS was newly purchased, and I only noticed the problem after I set it up, which involved me having to download a new version of the iOS IoCare app. The integration was never able to pull data for the 1512HHS, and during the registration process for it, my existing 400S's integration connection began to fail, too. (Oddly, the 400S still worked with the integration after others had reported the issue here. I suspect the old API was still honoring my existing connection and that me going through the registration song and dance for the 1512HHS caused connections tied to my account to be reset, but that's speculation.)

Tl;dr: Not all connections have been restored. Expect inconsistencies. Looking forward to rewrite, but I don't envy you doing it.

Can you perhaps try deleting the new purifier from your account (using the mobile app) and then restarting home assistant?

dd143999 commented 6 months ago

Can you perhaps try deleting the new purifier from your account (using the mobile app) and then restarting home assistant?

I didn't even need to restart HA. Deleting the HHS from my account and reloading the integration gave me a successful connection to the 400S.

DocJelly commented 6 months ago

I have two AP-1512HHS devices, both relatively new and had the same issue as everyone else. This afternoon, I went into the iOS app and deleted the nearest one to me from the app (family room). I then clicked reload in HA and it worked, found 1 device (bedroom) and 10 entities. I then re-added the (family room) AP-1512HHS to the app and clicked reload in HA and it's back to "Failed Setup, will retry" I'm fairly new to HA, but if I can grab some logs or something, I'll figure it out.

Update/edit: I deleted the other Ap-1512HHS (bedroom) from the app, reloaded integration in HA, still failed. Restarted HA, still failed. Removed the (family room) device again (so no devices in the app) reloaded integration, failed. Re-added the (bedroom) device, clicked reload and the integration is working again... so it may be something to do with multiple units, or this slightly newer (family room) device?

RobertD502 commented 6 months ago

I expect it has to do with newer devices functioning differently (on the API side, not physical functionality).

If you're open to it, send me a PM on discord (@RobertD502). With temporary access to your account, I can try to figure out if this is something that can be fixed by modifying the way the current API works or if there is something about the firmware in newer models that locks them down to only working with the new API - they introduced a new API in a recent mobile app update and shut down the old endpoint. However, they later reverted that decision and turned the old API endpoints back on probably due to users that can't run the newest app complaining.

RobertD502 commented 5 months ago

0.4.0 has been released which should take care of the issue caused by newer purifiers not using the old quality status endpoint.

dd143999 commented 5 months ago

Looks like updating to 0.4.0 with one working device (the 400S mentioned here) causes the integration to fail to set itself up again after HA restart. The only relevant logs I see are a couple of events to the effect of:

2024-04-29 11:48:56.210 DEBUG (MainThread) [custom_components.coway] Finished fetching coway data in 3.265 seconds (success: False)

Deleting the integration and starting over from scratch does not help.

Does 0.4.0 require a minimum HA version?

EDIT: Found another error, Coway API Error: Coway server failed to return purifier MCU version.

ANOTHER EDIT: Looks like Coway implemented another "upgrade" on their end that required app updates. Fun!