[Réglé] Spotify, enceinte connectée, playlist, hey google

Bonjour

J’ai des soucis avec l’integration de spotify et spotcast. Hier, l’intégration fonctionnait normalement et aujourd’hui, j’ai des problèmes avec les tokens de façon aléatoire.

Après avoir cliqué plusieurs fois sur les playlists en défaut, spotify a fonctionné normalement. Délai, de 1 ou 2 minutes pour activer quelque chose ?

J’éteins le lecteur pendant 10 minutes, je le rallume et de nouveau le problème de token.


`http status: 403, code:-1 - https://api.spotify.com/v1/me/player/play?device_id=xxxxxx: Player command failed: Restriction violated, reason: UNKNOWN`
Could not get spotify token.
08:25:47 – (ERREUR) Home Assistant WebSocket API - message survenu pour la première fois à 08:13:36 et apparu 14 fois.

Ma configuration

System Information

version core-2023.10.5
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.5
os_name Linux
os_version 6.1.59
arch x86_64
timezone Europe/Brussels
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 5000
Installed Version 1.33.0
Stage running
Available Repositories 1316
Downloaded Repositories 10
Home Assistant Cloud
logged_in true
subscription_expiration 18 novembre 2023 à 01:00
relayer_connected true
relayer_region eu-central-1
remote_enabled true
remote_connected true
alexa_enabled true
google_enabled true
remote_server eu-central-1-14.ui.nabu.casa
certificate_status ready
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 11.1
update_channel stable
supervisor_version supervisor-2023.10.1
agent_version 1.6.0
docker_version 24.0.6
disk_total 439.4 GB
disk_used 9.3 GB
healthy true
supported true
board generic-x86-64
supervisor_api ok
version_api ok
installed_addons ESPHome (2023.10.3), File editor (5.6.0), Terminal & SSH (9.7.1), Home Assistant Google Drive Backup (0.111.1), Mosquitto broker (6.3.1), Zigbee2MQTT (1.33.1-1)
Dashboards
dashboards 3
resources 4
views 13
mode storage
Recorder
oldest_recorder_run 17 octobre 2023 à 05:07
current_recorder_run 27 octobre 2023 à 06:53
estimated_db_size 474.88 MiB
database_engine sqlite
database_version 3.41.2
Spotify
api_endpoint_reachable ok

Une série d’erreur dans le journal du « core »

2023-10-27 08:57:29.297 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140441194485824] Could not get spotify token.
Traceback (most recent call last):
File « /config/custom_components/spotcast/spotcast_controller.py », line 177, in get_spotify_token
).result()
^^^^^^^^
File « /usr/local/lib/python3.11/concurrent/futures/_base.py », line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File « /usr/local/lib/python3.11/concurrent/futures/_base.py », line 401, in __get_result
raise self._exception
File « /config/custom_components/spotcast/spotcast_controller.py », line 216, in start_session
raise TokenError()
custom_components.spotcast.spotcast_controller.TokenError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File « /usr/src/homeassistant/homeassistant/components/websocket_api/commands.py », line 226, in handle_call_service
await hass.services.async_call(
File « /usr/src/homeassistant/homeassistant/core.py », line 2012, in async_call
response_data = await coro
^^^^^^^^^^
File « /usr/src/homeassistant/homeassistant/core.py », line 2056, in _execute_service
return await self._hass.async_add_executor_job(target, service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File « /usr/local/lib/python3.11/concurrent/futures/thread.py », line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File « /config/custom_components/spotcast/init.py », line 221, in start_casting
spotify_device_id = spotcast_controller.get_spotify_device_id(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File « /config/custom_components/spotcast/spotcast_controller.py », line 283, in get_spotify_device_id
account).get_spotify_token()
^^^^^^^^^^^^^^^^^^^
File « /config/custom_components/spotcast/spotcast_controller.py », line 187, in get_spotify_token
raise HomeAssistantError(« Could not get spotify token. »)
homeassistant.exceptions.HomeAssistantError: Could not get spotify token.
2023-10-27 08:57:30.299 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140441194485824] Could not get spotify token.
Traceback (most recent call last):
File « /config/custom_components/spotcast/spotcast_controller.py », line 177, in get_spotify_token
).result()
^^^^^^^^
File « /usr/local/lib/python3.11/concurrent/futures/_base.py », line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File « /usr/local/lib/python3.11/concurrent/futures/_base.py », line 401, in __get_result
raise self._exception
File « /config/custom_components/spotcast/spotcast_controller.py », line 216, in start_session
raise TokenError()
custom_components.spotcast.spotcast_controller.TokenError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File « /usr/src/homeassistant/homeassistant/components/websocket_api/commands.py », line 226, in handle_call_service
await hass.services.async_call(
File « /usr/src/homeassistant/homeassistant/core.py », line 2012, in async_call
response_data = await coro
^^^^^^^^^^
File « /usr/src/homeassistant/homeassistant/core.py », line 2056, in _execute_service
return await self._hass.async_add_executor_job(target, service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File « /usr/local/lib/python3.11/concurrent/futures/thread.py », line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File « /config/custom_components/spotcast/init.py », line 221, in start_casting
spotify_device_id = spotcast_controller.get_spotify_device_id(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File « /config/custom_components/spotcast/spotcast_controller.py », line 283, in get_spotify_device_id
account).get_spotify_token()
^^^^^^^^^^^^^^^^^^^
File « /config/custom_components/spotcast/spotcast_controller.py », line 187, in get_spotify_token
raise HomeAssistantError(« Could not get spotify token. »)
homeassistant.exceptions.HomeAssistantError: Could not get spotify token.

Autre question. Lorsque je veux utiliser la fonction hey google, l’enceinte me reclame google home sur mon téléphone. Je l’avais installé pour configurer le wifi de l’enceinte mais après je l’ai désinstallé.

Etait-ce une bonne idée ? Peut-on s’en passer sur le téléphone et passer par une intégration dans home assistant ?

Merci

Les problèmes semblent réglés. J’avais mélangé « entity_id » et « device_name » dans certaines parties du code.


square: false
type: grid
columns: 1
cards:
  - type: custom:mini-media-player
    entity: media_player.bureau
    artwork: full-cover
    source: full
    name: Bureau
    group: true
    volume_stateless: true
    volume_step: '1'
    toggle_power: true
    info: scroll
    sound_mode: full
    hide:
      mute: true
    shortcuts:
      buttons:
        - name: Bureau
          type: service
          id: spotcast.start
          data:
            limit: 20
            force_playback: true
            random_song: false
            shuffle: false
            ignore_fully_played: false
            entity_id: media_player.bureau
            device_name: Bureau
        - name: Parents
          type: service
          id: spotcast.start
          data:
            limit: 20
            force_playback: true
            random_song: false
            shuffle: false
            ignore_fully_played: false
            entity_id: media_player.bureau
            device_name: Bureau
        - name: favoris
          type: service
          id: spotcast.start
          data:
            limit: 20
            force_playback: false
            random_song: false
            repeat: 'off'
            shuffle: false
            offset: 0
            ignore_fully_played: false
            device_name: Bureau
            uri: spotify:playlist:xxxxxx
      label: Liste de lecture
      list:
        - name: Daily Mix 1
          type: service
          id: spotcast.start
          data:
            limit: 20
            force_playback: false
            random_song: false
            shuffle: false
            ignore_fully_played: false
            device_name: Bureau
            uri: spotify:playlist:xxxx
        - name: Daily Mix 2
          type: service
          id: spotcast.start
          data:
            limit: 20
            force_playback: false
            random_song: false
            shuffle: false
            ignore_fully_played: false
            device_name: Bureau
            uri: spotify:playlist:xxxx
        - name: Daily Mix 3
          type: service
          id: spotcast.start
          data:
            limit: 20
            force_playback: false
            random_song: false
            shuffle: false
            ignore_fully_played: false
            device_name: Bureau
            uri: spotify:playlist:xxxx
        - name: Daily Mix 4
          type: service
          id: spotcast.start
          data:
            limit: 20
            force_playback: false
            random_song: false
            shuffle: false
            ignore_fully_played: false
            device_name: Bureau
            uri: spotify:playlist:xxxx
        - name: Daily Mix 5
          type: service
          id: spotcast.start
          data:
            limit: 20
            force_playback: false
            random_song: false
            shuffle: false
            ignore_fully_played: false
            device_name: Bureau
            uri: spotify:playlist:xxxxxx
        - name: Hits français 80
          type: service
          id: spotcast.start
          data:
            limit: 20
            force_playback: false
            random_song: false
            shuffle: false
            ignore_fully_played: false
            device_name: Bureau
            uri: spotify:playlist:xxxx
        - name: Hits français 70
          type: service
          id: spotcast.start
          data:
            limit: 20
            force_playback: false
            random_song: false
            shuffle: false
            ignore_fully_played: false
            device_name: Bureau
            uri: spotify:playlist:xxxx
        - name: Mike Oldfield
          type: service
          id: spotcast.start
          data:
            limit: 20
            force_playback: false
            random_song: false
            shuffle: false
            ignore_fully_played: false
            device_name: Bureau
            uri: spotify:playlist:xxxx
        - name: Hits français 90
          type: service
          id: spotcast.start
          data:
            limit: 20
            force_playback: false
            random_song: false
            shuffle: false
            ignore_fully_played: false
            device_name: Bureau
            uri: spotify:playlist:xxx
        - name: Années 80-90 anglophones
          type: service
          id: spotcast.start
          data:
            limit: 20
            force_playback: false
            random_song: false
            shuffle: false
            ignore_fully_played: false
            device_name: Bureau
            uri: spotify:playlist:xxxx
    max_volume: '100'
    min_volume: '0'