h4de5 / home-assistant-toshiba_ac

Toshiba AC integration into home-assistant.io
GNU General Public License v3.0
113 stars 17 forks source link

Unexpected error at login screen. "Attempt to decode JSON with unexpected mimetype: text/html" #181

Closed savimaki closed 1 month ago

savimaki commented 1 month ago

I had the integration working but it suddenly went unavailable. My toshiba app still works. I tried reinstalling the integration but no dice. I only get "Unexpected error" when trying to download the integration and login with my credentials.


Source: custom_components/toshiba_ac/config_flow.py:77
integration: Toshiba AC ([documentation](https://github.com/h4de5/home-assistant-toshiba_ac), [issues](https://github.com/h4de5/home-assistant-toshiba_ac/issues))
First occurred: 14:49:37 (1 occurrences)
Last logged: 14:49:37

Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/toshiba_ac/config_flow.py", line 77, in async_step_user
    data = await validate_input(self.hass, user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/toshiba_ac/config_flow.py", line 41, in validate_input
    sas_token = await device_manager.connect()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/.local/lib/python3.12/site-packages/toshiba_ac/device_manager.py", line 58, in connect
    await self.http_api.connect()
  File "/config/.local/lib/python3.12/site-packages/toshiba_ac/utils/http_api.py", line 116, in connect
    res = await self.request_api(self.LOGIN_PATH, post=post, headers=headers)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/.local/lib/python3.12/site-packages/toshiba_ac/utils/http_api.py", line 98, in request_api
    json = await response.json()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1176, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://mobileapi.toshibahomeaccontrols.com/api/Consumer/Login')
felixmueller commented 1 month ago

@savimaki, @h4de5

Same problem here! Looks like we have a serious issue, caused by a change to the API response or something.

savimaki commented 1 month ago

Oops, accidentally closed, will reopen. I too think this isn't in my end. @h4de5

felixmueller commented 1 month ago

@savimaki Having a closer look to your log shows that the issue seems to lie in the the underlying toshiba_ac lib hosted here: https://github.com/KaSroka/Toshiba-AC-control Maybe you should test the lib and open the issue there, too. Thanks!

P.S.: I tried to logout and re-login using the iOS-App and it worked. So it does not seem to be an outage on Toshiba's side but a change on the API behavior...

felixmueller commented 1 month ago

@savimaki I just tried to reload the HA integration and it started working again! Can you confirm?

savimaki commented 1 month ago

Yes! Seems like there was an outage or something 🤔 Great!