music-assistant / hass-music-assistant

Turn your Home Assistant instance into a jukebox, hassle free streaming of your favorite media to Home Assistant media players.
Apache License 2.0
1.34k stars 49 forks source link

youtube music not connecting #1173

Closed nifokken closed 1 year ago

nifokken commented 1 year ago

What version of Music Assistant has the issue?

2.0.0b22

The problem

I got this issue where youtube music won't let me connect with MA. I put in the credentials (yes correctly) and then i get a notification from chrome saying "provider yt music did not load within 30 sec". i've tried rolling back HA, i tried MA v1 and v2 with no results. I tought this issue would get fixed with a new beta release. But at this point i've been trying more than a month and still have no idea what the issue would be. The only thing i can think of is i share a family acount where i am not the "main acount". Thanks in advance !

How to reproduce

""

Relevant log output

No response

Additional information

No response

What version of Home Assistant Core are your running

2023.03.3

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Windows

OzGav commented 1 year ago

@MarvinSchenkel One for you?

MarvinSchenkel commented 1 year ago

What hardware are you running HA and MA on? As in, CPU, memory etc. Do you also have any other music providers registered? (Spotify etc)

nifokken commented 1 year ago

What hardware are you running HA and MA on? As in, CPU, memory etc. Do you also have any other music providers registered? (Spotify etc)

I am running it on a virtual machine on a macbook air (2017) (VM SPECS: 3gb ram,CPUs set to 2). I have tried connecting spotify wich seems to work but it isn't currently connected.

edit: I am running windows.

MarvinSchenkel commented 1 year ago

What do you mean by "It isn't currently connected" ?

Also, let's try to get this straight. You are running it on a:

  1. Macbook air (actual hardware)
  2. A Windows virtual machine (question: via which virtualizer?)
  3. Home Assistant OS within this VM (ie. https://www.home-assistant.io/installation/windows), which is another virtual machine inside your Windows virtual machine?

Did I get this correct?

nifokken commented 1 year ago

What do you mean by "It isn't currently connected" ?

Also, let's try to get this straight. You are running it on a:

  1. Macbook air (actual hardware)
  2. A Windows virtual machine (question: via which virtualizer?)
  3. Home Assistant OS within this VM (ie. https://www.home-assistant.io/installation/windows), which is another virtual machine inside your Windows virtual machine?

Did I get this correct?

I connected spotify to test it by putting in my credentials , then deleted the connection. And yes you are correct ! (I use virtualbox as virtualizer).

MarvinSchenkel commented 1 year ago

Are you actually able to playback something with Spotify though? I feel this might be a network related thing because of the many layers of virtualization

nifokken commented 1 year ago

Are you actually able to playback something with Spotify though? I feel this might be a network related thing because of the many layers of virtualization

yes V1 with spotify worked on my bose soundtouch as well as chromecast. Also i control my smart home with it works perfectly.

MarvinSchenkel commented 1 year ago

And v2 works as well?

nifokken commented 1 year ago

And v2 works as well?

I don't have premium anymore(spotify) i bought it back then just for testing and that was before v2 was a thing (could be wrong) but i feel as tough 1 time was enough since the common denominator seems to be youtube music not working on V1 and v2(could be wrong)

MarvinSchenkel commented 1 year ago

Could you please have a look at the logs of the addon right after you enter the Youtube Music credentials and report what the logs say after you get that 'provider yt music did not load within 30 sec' message?

MarvinSchenkel commented 1 year ago

Two comments:

  1. Please delete your cookie from your message, it is basically your login ;-).
  2. I can see there is a timeout when setting up the connection, so this is probably network related. @marcelveldt do we support this fancy 'virtual machine inside a virtual machine' setup?
nifokken commented 1 year ago

Two comments:

  1. Please delete your cookie from your message, it is basically your login ;-).
  2. I can see there is a timeout when setting up the connection, so this is probably network related. @marcelveldt do we support this fancy 'virtual machine inside a virtual machine' setup?

2023-03-31 15:27:23 INFO music_assistant -- Starting Music Assistant Server (a427a763f05443f7846200d112d431fa) - autodetected IP-address: **** 2023-03-31 15:27:23 INFO music_assistant.web -- Starting webserver on port 2023-03-31 15:27:23 INFO music_assistant.streams -- Started stream controller (using ffmpeg version 4.3.5 with libsoxr support) 2023-03-31 15:27:24 INFO music_assistant.providers.lms_cli -- Registering jsonrpc endpoints on the webserver 2023-03-31 15:27:24 INFO music_assistant -- Loaded music provider URL 2023-03-31 15:27:24 INFO music_assistant -- Loaded plugin provider Websocket API 2023-03-31 15:27:24 INFO music_assistant -- Loaded metadata provider MusicBrainz Metadata provider 2023-03-31 15:27:24 INFO music_assistant -- Loaded player provider SONOS 2023-03-31 15:27:24 INFO music_assistant -- Loaded metadata provider TheAudioDB Metadata provider 2023-03-31 15:27:24 INFO music_assistant.providers.lms_cli -- Starting (telnet) CLI on port 2023-03-31 15:27:24 INFO music_assistant -- Loaded player provider Chromecast 2023-03-31 15:27:24 INFO music_assistant -- Loaded player provider UPnP/DLNA Player provider 2023-03-31 15:27:24 INFO music_assistant -- Loaded metadata provider fanart.tv Metadata provider 2023-03-31 15:27:24 INFO music_assistant -- Loaded plugin provider LMS CLI 2023-03-31 15:27:25 INFO music_assistant.providers.slimproto -- Starting SLIMProto server on port 2023-03-31 15:27:25 INFO music_assistant -- Loaded player provider Slimproto 2023-03-31 15:27:26 INFO music_assistant -- Loaded player provider Airplay 2023-03-31 15:28:10 INFO music_assistant.players -- Player registered: uuid:BO5EBO5E-F00D-F00D-FEED-EC24B8E9D22D/Boxken 2023-03-31 15:29:42 ERROR music_assistant.websocket_api -- [139975140413968] Error handling message: CommandMessage(message_id=12, command='config/providers/add', args={'provider_domain': 'ytmusic', 'config': {'values': {'log_level': {'key': 'log_level', 'type': 'string', 'label': 'Log level', 'default_value': 'GLOBAL', 'required': True, 'options': [{'title': 'global', 'value': 'GLOBAL'}, {'title': 'info', 'value': 'INFO'}, {'title': 'warning', 'value': 'WARNING'}, {'title': 'error', 'value': 'ERROR'}, {'title': 'debug', 'value': 'DEBUG'}], 'range': None, 'description': 'Set the log verbosity for this provider', 'help_link': None, 'multi_value': False, 'depends_on': None, 'hidden': False, 'advanced': True, 'encrypt': False, 'value': 'GLOBAL'}, 'username': {'key': 'username', 'type': 'string', 'label': 'Username', 'default_value': None, 'required': True, 'options': None, 'range': None, 'description': None, 'help_link': None, 'multi_value': False, 'depends_on': None, 'hidden': False, 'advanced': False, 'encrypt': False, 'value': '"****'}, Traceback (most recent call last): File "/usr/local/lib/python3.11/asyncio/tasks.py", line 490, in wait_for return fut.result() ^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/ytmusic/init.py", line 90, in setup await prov.handle_setup() File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/ytmusic/init.py", line 129, in handle_setup self._signature_timestamp = await self._get_signature_timestamp() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/ytmusic/init.py", line 646, in _get_signature_timestamp response = await self._get_data(url=YTM_DOMAIN) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/ytmusic/init.py", line 463, in _get_data async with self.mass.http_session.get( File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1141, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection return await self._loop.create_connection(args, kwargs) # type: ignore[return-value] # noqa ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection sock = await self._connect_sock( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock await self.sock_connect(sock, address) File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 634, in sock_connect return await fut ^^^^^^^^^ asyncio.exceptions.CancelledError The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/music_assistant/server/server.py", line 313, in load_provider provider = await asyncio.wait_for(prov_mod.setup(self, prov_manifest, conf), 30) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/tasks.py", line 492, in wait_for raise exceptions.TimeoutError() from exc TimeoutError The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/websocket_api/init.py", line 234, in _run_handler result = await result ^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/music_assistant/server/controllers/config.py", line 210, in add_provider_config await self.mass.load_provider(config) File "/usr/local/lib/python3.11/site-packages/music_assistant/server/server.py", line 315, in load_provider raise SetupFailedError(f"Provider {domain} did not load within 30 seconds") from err music_assistant.common.models.errors.SetupFailedError: Provider ytmusic did not load within 30 seconds

like this ?

marcelveldt commented 1 year ago

This is a clear indication of either a superslow network or other network issues as it could not connect within 30 (!!) seconds. We all know that the Youtube api's are slow but not this bad.

Also, I may hope we have misunderstood your setup and you are running HAOS directly in VirtualBox on your Mac ? Note that running in a VM is already considered an advanced (unrecommended) scenario, let alone a VM within a VM.

My advice: grab a raspberry pi 4 somewhere or any other device that runs HAOS natively and save yourself the trouble of running in a VM, you are going to run into troubles if not properly configured, most important network troubles if you do not bridge the adapter correctly

nifokken commented 1 year ago

This is a clear indication of either a superslow network or other network issues as it could not connect within 30 (!!) seconds. We all know that the Youtube api's are slow but not this bad.

Also, I may hope we have misunderstood your setup and you are running HAOS directly in VirtualBox on your Mac ? Note that running in a VM is already considered an advanced (unrecommended) scenario, let alone a VM within a VM.

My advice: grab a raspberry pi 4 somewhere or any other device that runs HAOS natively and save yourself the trouble of running in a VM, you are going to run into troubles if not properly configured, most important network troubles if you do not bridge the adapter correctly

My apologies ! I misread @MarvinSchenkel 's question. i run windows with bootcamp not in a vm !

edit: download speed (87.45Mbps) , also spotify seems to work fine so i doubt its due to a slow connection

MarvinSchenkel commented 1 year ago

This is a clear indication of either a superslow network or other network issues as it could not connect within 30 (!!) seconds. We all know that the Youtube api's are slow but not this bad. Also, I may hope we have misunderstood your setup and you are running HAOS directly in VirtualBox on your Mac ? Note that running in a VM is already considered an advanced (unrecommended) scenario, let alone a VM within a VM. My advice: grab a raspberry pi 4 somewhere or any other device that runs HAOS natively and save yourself the trouble of running in a VM, you are going to run into troubles if not properly configured, most important network troubles if you do not bridge the adapter correctly

My apologies ! I misread @MarvinSchenkel 's question. i run windows with bootcamp not in a vm !

edit: download speed (87.45Mbps) , also spotify seems to work fine so i doubt its due to a slow connection

Ok, so you run Windows inside bootcamp. What did you use to install Home Assistant OS inside Windows? (ie which approach from the options on provided here: https://www.home-assistant.io/installation/windows)

OzGav commented 1 year ago

If there is no further followup to this issue soon we will close it.