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

ValueError: too many values to unpack (expected 3) #157

Open
kieranhogg opened this issue Jan 21, 2025 · 5 comments
Open

ValueError: too many values to unpack (expected 3) #157

kieranhogg opened this issue Jan 21, 2025 · 5 comments

Comments

@kieranhogg
Copy link

I was trying to discover the media ID of the BBC Radio station in order to add it to an automation. It is setup with each station being a chapter. When starting to play manually, it skips the first chapter, then trying to change chapters/stations results in the following error:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
    )
    ^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
        hass, entity, func, data, call.context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/yoto/media_player.py", line 82, in async_media_next_track
    cardid, chapterid, trackid = split_media_id(self.media_content_id)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 3)
@cdnninja
Copy link
Owner

cdnninja commented Jan 21, 2025

What was your yaml call? As well what version are you running?

@kieranhogg
Copy link
Author

Oddly, I think think the underlying cause of this might well be that the URLs that some of the stations point to are returning a 410: Gone, so I'll add the details, but I guess it's not likely to be a common issue.

v1.22.5 and 2024.12.5

First play request (which works)

event_type: state_changed
data:
  entity_id: media_player.yoto_player
  old_state:
    entity_id: media_player.yoto_player
    state: paused
    attributes:
      volume_level: 0.25
      media_content_id: 62bEO-02-@001
      media_title: Radio 2 - BBC Radio 2
      media_artist: BBC
      media_album_name: BBC Radio
      entity_picture_local: >-
        /api/media_player_proxy/media_player.yoto_player?token=adbafc64420ed4aca794c7559db212b32366b778a2738ca0e593b750fe79d5ca&cache=3733c2419a1c1dfc
      media_chapter_icon: >-
        https://card-content.yotoplay.com/yoto/sNHnfRf2RCHcWfrt4xYbhMoAr9JLO167IKBL-oY0lhY
      device_class: speaker
      entity_picture: >-
        https://card-content.yotoplay.com/yoto/pub/Zt_rpw4jea8W_IrSh5uU3KIPA20KmEUEwfGYjrj07wk?width=250
      friendly_name: Yoto Player
      supported_features: 152119
    last_changed: "2025-01-21T20:05:48.251648+00:00"
    last_reported: "2025-01-21T20:05:48.251648+00:00"
    last_updated: "2025-01-21T20:05:48.251648+00:00"
    context:
      id: 01JJ57H75X54J2N1362MBJ92SQ
      parent_id: null
      user_id: 5a4cbde1fc9545c39ff75d3824f59101
  new_state:
    entity_id: media_player.yoto_player
    state: playing
    attributes:
      volume_level: 0.25
      media_content_id: 62bEO-02-@001
      media_title: Radio 2 - BBC Radio 2
      media_artist: BBC
      media_album_name: BBC Radio
      entity_picture_local: >-
        /api/media_player_proxy/media_player.yoto_player?token=adbafc64420ed4aca794c7559db212b32366b778a2738ca0e593b750fe79d5ca&cache=3733c2419a1c1dfc
      media_chapter_icon: >-
        https://card-content.yotoplay.com/yoto/sNHnfRf2RCHcWfrt4xYbhMoAr9JLO167IKBL-oY0lhY
      device_class: speaker
      entity_picture: >-
        https://card-content.yotoplay.com/yoto/pub/Zt_rpw4jea8W_IrSh5uU3KIPA20KmEUEwfGYjrj07wk?width=250
      friendly_name: Yoto Player
      supported_features: 152119
    last_changed: "2025-01-21T20:09:38.481396+00:00"
    last_reported: "2025-01-21T20:09:38.481396+00:00"
    last_updated: "2025-01-21T20:09:38.481396+00:00"
    context:
      id: 01JJ57R842KEQ8ASM513A3ZWW5
      parent_id: null
      user_id: 5a4cbde1fc9545c39ff75d3824f59101
origin: LOCAL
time_fired: "2025-01-21T20:09:38.481396+00:00"
context:
  id: 01JJ57R842KEQ8ASM513A3ZWW5
  parent_id: null
  user_id: 5a4cbde1fc9545c39ff75d3824f59101

Changing stations (which causes the error):

event_type: call_service
data:
  domain: media_player
  service: media_next_track
  service_data:
    entity_id: media_player.yoto_player
origin: LOCAL
time_fired: "2025-01-21T20:09:41.900564+00:00"
context:
  id: 01JJ57RBRCAM230AJRDPM4GV8W
  parent_id: null
  user_id: 5a4cbde1fc9545c39ff75d3824f59101

@cdnninja
Copy link
Owner

I think adding seconds as a feature for scrubbing broke next.

I'll take a look, hopefully tonight.

@cdnninja
Copy link
Owner

I just released a bug fix. Please update and try again.

@cdnninja
Copy link
Owner

Could have sworn you replied but it isn't here. Odd.

Could you check what the media content id is for this chapter and the next? I noticed it has a special character in it above. We are adding 1 to that value which may not go well.

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

2 participants