cdnninja/yoto_ha

Exception when setting up the integration

Closed this issue · 5 comments

Amazing work! Thanks for spearheading this integration @cdnninja. For over a year I've been looking for a way to view the status and control my kids' yoto players. I even wrote to Yoto to ask for this and they said it was low on their priority list :(

OK so when setting up 1.3.0 this morning, I got this error which appears to be more with the yoto_api package than the integration. I have 2 yotos and one was in night light mode at the time of setup in case that helps.

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 49, in check_and_refresh_token
    self.initialize()
  File "/usr/local/lib/python3.12/site-packages/yoto_api/YotoManager.py", line 26, in initialize
    self.update_players_status()
  File "/usr/local/lib/python3.12/site-packages/yoto_api/YotoManager.py", line 32, 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 135, in update_players
    players[deviceId].night_light_mode = LIGHT_COLORS[
                                         ^^^^^^^^^^^^^
KeyError: '0x5a6400'

What color was it set to? I am trying to figure out what those values means but struggling to tell.

I have added this value to the list so latest version should load for you. I think more testing is needed to see what these values mean.

The color is "Apple Green". This is a 3rd gen player too (could the values be different across hardware revisions?)

1.3.2 worked! The config flow detected both of my players and correctly assigned versions to them. I'll play with the sensors a bit to see if I can contribute some improvements to this integration in the future. Thanks again!

That would be great! I only own one so good to know two players work. I haven't tested multiple models either, early days for this.