cdnninja / yoto_ha

Home Assistant Integration for Yoto
MIT License
64 stars 8 forks source link

Unable to Sign In to Yoto Integration After Latest Update #123

Closed arnaudcart closed 1 month ago

arnaudcart commented 1 month ago

Since updating the Yoto integration yesterday, I am unable to sign in. Following the update, all entities associated with the integration became unavailable.

I attempted to resolve the issue by removing and re-adding the integration, but the problem persists, and I am still unable to log in. After reverting back to the previous version of the integration, I am able to sign in without any issues.

Below are the error logs from when I attempted to sign in after the update: Please let me know if any additional information is needed to help resolve the issue.

Thank you for your support!


Traceback (most recent call last):
  File "/config/custom_components/yoto/config_flow.py", line 104, in async_step_user
    await validate_input(self.hass, user_input)
  File "/config/custom_components/yoto/config_flow.py", line 45, in validate_input
    await hass.async_add_executor_job(ym.check_and_refresh_token)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yoto_api/YotoManager.py", line 111, in check_and_refresh_token
    self.initialize()
  File "/usr/local/lib/python3.12/site-packages/yoto_api/YotoManager.py", line 32, in initialize
    self.update_players_status()
  File "/usr/local/lib/python3.12/site-packages/yoto_api/YotoManager.py", line 36, in update_players_status
    self.api.update_players(self.token, self.players)
  File "/usr/local/lib/python3.12/site-packages/yoto_api/YotoAPI.py", line 209, in update_players
    enabled=False if values[6] == "0" else True,
                     ~~~~~~^^^
IndexError: list index out of range
cdnninja commented 1 month ago

Please retry with latest. Some funky alarm API issue, hopefully fixed now.

arnaudcart commented 1 month ago

Thanks a lot for checking. Unfortunately it is the same:


  File "/config/custom_components/yoto/config_flow.py", line 104, in async_step_user
    await validate_input(self.hass, user_input)
  File "/config/custom_components/yoto/config_flow.py", line 45, in validate_input
    await hass.async_add_executor_job(ym.check_and_refresh_token)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yoto_api/YotoManager.py", line 111, in check_and_refresh_token
    self.initialize()
  File "/usr/local/lib/python3.12/site-packages/yoto_api/YotoManager.py", line 32, in initialize
    self.update_players_status()
  File "/usr/local/lib/python3.12/site-packages/yoto_api/YotoManager.py", line 36, in update_players_status
    self.api.update_players(self.token, self.players)
  File "/usr/local/lib/python3.12/site-packages/yoto_api/YotoAPI.py", line 211, in update_players
    enabled=False if values[6] == "0" else True,
                     ~~~~~~^^^
IndexError: list index out of range
harrolf commented 1 month ago

Dear @cdnninja, thanks for the alarm features however after the latest version (1.19.1) I have the same issue as above.

cdnninja commented 1 month ago

Yeah it's a strange data issue. Could you try toggle your alarm off? Save it and back in the native app?

It's essentially a bug in the native api I need to work around. I'll try again today.

harrolf commented 1 month ago

That did the trick, but as mentioned in https://github.com/cdnninja/yoto_ha/discussions/116#discussioncomment-10721318 it's not functional (yet).

I also noted that every couple of seconds the "Yoto Last Updated" is refreshed every other second. I don't think that was the case in the past.

cdnninja commented 1 month ago

Hmmm. I confirmed I can't replicate this error even when the data is broken from the API. To confirm you are on 1.19.1? If anyone still has this issue on a new alarm please provide debug logs.

cdnninja commented 1 month ago

Last updated should be very active when cards are playing as the device is sending real time playing status updates. It is pushed into home assistance. As for making the switch enable disable, correct. I have much of the legwork done on that but a bit further to go.

cdnninja commented 1 month ago

Figured it out. New release will be out shortly.

cdnninja commented 1 month ago

Alarm toggle now functions as well.

arnaudcart commented 1 month ago

I can now sign in. Thanks a lot for all your support. This is great

harrolf commented 1 month ago

Thanks! it works 👍 I still find that even when there's nothing playing, the yoto updates every couple of seconds.

cdnninja commented 1 month ago

It may be sending data via mqtt. It does send updates in certain situations.

Would need debug logs to confirm its mqtt messages vs an api call.