Sorry, I just can’t figure out how to get the dropdowns to show on the dashboard. I’m able to choose media from the media control card and it plays on my defined default media player but i have no idea how to integrate the markdown.yaml to get the dropdowns to show and change the values of the media and players. I’m running this in docker so i don’t have HACS and installed this manually. Is there idiot-proof documentation somewhere that I’m missing? Thanks.
I’ve tried putting that in configuration.yaml, adding the whole package folder to the /config directory and adding the files in custom_components/ytube_music_player. not sure exactly which section of the config to add it to and then after adding it, not sure which card to add to get the view.
Ok sorry… i was a little slow. I figured out i needed to add this to a dashboard using the Edit Dashboard -> Raw Configuration Editor. I kept thinking i had to add it to configuration.yaml. Now I just need to get the dropdown piece working. getting errors for entities not available…
Again, I put the config in the wrong place. I tried putting it in the media player section with the rest of the ytube_music_player config but it needs to be in the completely separate input_select section. Finally got it all working now. Did I mention I’m still learning??? lol. Thanks.
2021-02-07 14:47:14 ERROR (SyncWorker_22) [custom_components.ytube_music_player.const] Running get_library_songs resulted in an exception, no idea why.. honestly
2021-02-07 14:47:14 ERROR (SyncWorker_22) [custom_components.ytube_music_player.const] Please see below
2021-02-07 14:47:14 ERROR (SyncWorker_22) [custom_components.ytube_music_player.const] Traceback (most recent call last):
File "/config/custom_components/ytube_music_player/const.py", line 299, in try_login
api.get_library_songs()
File "/usr/local/lib/python3.8/site-packages/ytmusicapi/mixins/library.py", line 74, in get_library_songs
response = parse_func(request_func(None))
File "/usr/local/lib/python3.8/site-packages/ytmusicapi/mixins/library.py", line 66, in <lambda>
request_func = lambda additionalParams: self._send_request(endpoint, body)
File "/usr/local/lib/python3.8/site-packages/ytmusicapi/ytmusic.py", line 116, in _send_request
raise Exception(message + error)
Exception: Server returned HTTP 403: Forbidden.
The caller does not have permission
Open the development tools (I’ve used google chrome) [Crtl+Shift+I / F12]
Open the Network tab
Open https://music.youtube.com, log out, log in, browse a bit around like clicking on the library in the top menu
Search for “browse” (for me only one item shows up)
Go to “headers” → “request headers”
copy everything starting after the "accept: / " (mark with a mouse and copy to clipboard)
2. Please use the config flow of Home Assistant
Open Configuration → Integrations → “add integration” → “YouTube Music Player”
If the integration didn’t show up in the list please REFRESH the page
Paste the cookie into the indicated field, all other fields are optional or provide default values
It is highly recommended to enter the entity_id of your default output player, otherwise you have to set that after every reboot
The second page shows several entity_ids for dropdown field. You can leave the default values, even if you don’t want to use those field and don’t add them to your configuration… or clear the field … both will work fine (see below)
Although YAML configuration is still possible: Please remove it and configure the player via config_flow or several functions will be missing
hi, the new release will show more detailed error messages.
But your cookie will need to be refreshed from time to time … e.g. when you log out in the browser. … the same happened to me the other day … glad that you were able to fix it yourself.
JKW
I do all my stuff in Node Red, and aren’t too familiar with the HA side of things.
it’s odd that manually changing the playlist thru lovelace will play the correct playlist, but not when set thru NR doing a service call (in which case the lovelace is updating to the new playlist name)
I am no longer able to start the YT player and I get the following error in the notification box:
“Failed to call service media_player/play_media. local variable ‘_remote_player’ referenced before assignment”
HA Version:
Core Version - core-2021.2.3
Supervisor Version - supervisor-2021.02.9
HACS Version - Firmware: 1.11.3
TY Plugin Version: - “ytmusicapi==0.14.2”, “pytube==10.0.0”, “integrationhelper==0.2.2”
The Log shows the following, but I’m not able to find out what is the root cause.
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/ytube_music_player/media_player.py:463
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 6:29:13 PM (9 occurrences)
Last logged: 6:30:29 PM
[1810975304] local variable '_remote_player' referenced before assignment
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 136, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1455, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1490, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 595, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 632, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 630, in async_play_media
await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/ytube_music_player/media_player.py", line 1067, in play_media
self.prepare_play()
File "/config/custom_components/ytube_music_player/media_player.py", line 354, in prepare_play
if not self._update_remote_player():
File "/config/custom_components/ytube_music_player/media_player.py", line 463, in _update_remote_player
if self.hass.states.get(_remote_player) is None:
UnboundLocalError: local variable '_remote_player' referenced before assignment
Any feedback is appreciated!
And again, congratulations for this addon