# Spotify - Como integrar e comandar entre dispositivos (Requer Premium)

**URL:** <https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483>\
**Category:** Configuração\
**Tags:** spotify\
**Created:** [26 Maio , 2018 22:40 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483 "2018-05-26T22:40:25Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![j\_assuncao](https://forum.cpha.pt/user_avatar/forum.cpha.pt/j_assuncao/32/3_2.png) [@j\_assuncao](https://forum.cpha.pt/u/j_assuncao)\
**Post date:** [4 Novembro , 2018 10:31 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/21 "2018-11-04T10:31:59Z")

</div>

@fontes31 quando publicares código deves sublinhar o texto que queres transformar em código e clicar no icone `</>`. Deverá existir um espaço antes e outro depois do bloco de código para que funcione correctamente. O código em Yaml é muito sensível aos espaçamentos e sem o código devidamente formatado não te poderemos ajudar.

---

<div class="post-metadata">

**Author:** ![fontes31](https://forum.cpha.pt/user_avatar/forum.cpha.pt/fontes31/32/4798_2.png) [@fontes31](https://forum.cpha.pt/u/fontes31)\
**Post date:** [4 Novembro , 2018 11:11 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/22 "2018-11-04T11:11:39Z")

</div>

eu fiz copy paste do spotify.yaml que foi publicado, penso que o erro esta nesta parte:

```
     source: >
        {% if is_state("input_select.spotify_source", "Sala de

```

Jantar") %} Sala de Jantar  
{% elif is\_state(“input\_select.spotify\_source”, “Sala de  
TV”) %} Sala de TV  
{% endif %}

---

<div class="post-metadata">

**Author:** ![RodolfoVieira](https://forum.cpha.pt/user_avatar/forum.cpha.pt/rodolfovieira/32/14633_2.png) [@RodolfoVieira](https://forum.cpha.pt/u/RodolfoVieira)\
**Post date:** [4 Novembro , 2018 14:14 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/23 "2018-11-04T14:14:19Z")

</div>

@fontes31 edita o teu anterior post com a formatação correcta sff

---

<div class="post-metadata">

**Author:** ![fontes31](https://forum.cpha.pt/user_avatar/forum.cpha.pt/fontes31/32/4798_2.png) [@fontes31](https://forum.cpha.pt/u/fontes31)\
**Post date:** [4 Novembro , 2018 20:36 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/24 "2018-11-04T20:36:44Z")

</div>

ja editei o spotify.yaml so que agora tenho este erro - “extra keys not allowed @ data[‘group’]”

---

<div class="post-metadata">

**Author:** ![RodolfoVieira](https://forum.cpha.pt/user_avatar/forum.cpha.pt/rodolfovieira/32/14633_2.png) [@RodolfoVieira](https://forum.cpha.pt/u/RodolfoVieira)\
**Post date:** [4 Novembro , 2018 22:11 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/25 "2018-11-04T22:11:07Z")

</div>

@fontes31 peço que que edites o post como disse anteriormente, pois assim não conseguimos detectar o que possa estar errado.

---

<div class="post-metadata">

**Author:** ![sslopes](https://forum.cpha.pt/user_avatar/forum.cpha.pt/sslopes/32/9886_2.png) [@sslopes](https://forum.cpha.pt/u/sslopes)\
**Post date:** [17 Novembro , 2018 18:10 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/26 "2018-11-17T18:10:38Z")

</div>

Boa tarde.  
Em relação ao erro “extra keys not allowed @ data[‘group’]”, aconteceu-me exactamente o mesmo. Bastou mudar o S maiúsculo para minúsculo, em vez de Spotify.yaml mudar para spotify.yaml. Não sei se foi a solução. O que é certo é que o erro deixou de dar.  
Agora surge-me outro problema. Na janela de configuração do Spotify, quando tento clicar o link ( [Link Spotify account) dá o seguinte erro: INVALID\_CLIENT: Invalid redirect URI.  
Tenho o Spotify premium e por via das dúvidas faço logout e depois login.

Cumprimentos  
Sebastião

---

<div class="post-metadata">

**Author:** ![j\_assuncao](https://forum.cpha.pt/user_avatar/forum.cpha.pt/j_assuncao/32/3_2.png) [@j\_assuncao](https://forum.cpha.pt/u/j_assuncao)\
**Post date:** [17 Novembro , 2018 18:42 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/27 "2018-11-17T18:42:19Z")

</div>

Isso pode ter a ver com o link que introduziste quando fizeste os passos relativos ao Spotify. O URL de redirect tem de ser um link válido.

---

<div class="post-metadata">

**Author:** ![sslopes](https://forum.cpha.pt/user_avatar/forum.cpha.pt/sslopes/32/9886_2.png) [@sslopes](https://forum.cpha.pt/u/sslopes)\
**Post date:** [21 Novembro , 2018 23:28 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/28 "2018-11-21T23:28:21Z")

</div>

Boa noite.  
Já funciona.  
O problema estava no base\_url do componte HTTP do configuration.yaml. Tinha

`base_url: https://xxxx.duckdns.org`

em vez de

`base_url: https://xxxx.duckdns.org:8123`

Cumprimentos  
Sebastião

---

<div class="post-metadata">

**Author:** ![j\_assuncao](https://forum.cpha.pt/user_avatar/forum.cpha.pt/j_assuncao/32/3_2.png) [@j\_assuncao](https://forum.cpha.pt/u/j_assuncao)\
**Post date:** [6 Dezembro , 2018 17:19 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/29 "2018-12-06T17:19:14Z")

</div>

Dividir este tópico em 6 Dezembro , 2018 17:19 UTC

Uma mensagem foi dividida em um novo tópico: [Spotify e Echo Dot](https://forum.cpha.pt/t/spotify-e-echo-dot/1510)

---

<div class="post-metadata">

**Author:** ![carlosdeazeredo](https://forum.cpha.pt/letter_avatar_proxy/v4/letter/c/dbc845/32.png) [@carlosdeazeredo](https://forum.cpha.pt/u/carlosdeazeredo)\
**Post date:** [4 Junho , 2019 17:53 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/31 "2019-06-04T17:53:11Z")

</div>

tenho um erro e não consigo reproduzir o spotify. Conseguem me ajudar?

Error executing service \<ServiceCall script.spotify\_music (c:f1191e54fbdc4c039242cff9e6f2eecf)\>  
Traceback (most recent call last):  
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1150, in \_safe\_execute  
await self.\_execute\_service(handler, service\_call)  
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1163, in \_execute\_service  
await handler.func(service\_call)  
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/script/ **init**.py”, line 114, in service\_handler  
context=service.context)  
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/script/ **init**.py”, line 172, in async\_turn\_on  
kwargs.get(ATTR\_VARIABLES), context)  
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py”, line 131, in async\_run  
await self.\_handle\_action(action, variables, context)  
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py”, line 210, in \_handle\_action  
action, variables, context)  
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py”, line 299, in \_async\_call\_service  
context=context  
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 89, in async\_call\_from\_config  
domain, service\_name, service\_data, blocking=blocking, context=context)  
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1141, in async\_call  
self.\_execute\_service(handler, service\_call))  
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1163, in \_execute\_service  
await handler.func(service\_call)  
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity\_component.py”, line 194, in handle\_service  
required\_features  
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 316, in entity\_service\_call  
future.result() # pop exception if have  
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 337, in \_handle\_service\_platform\_call  
await getattr(entity, func)(\*\*data)  
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run  
result = self.fn(\*self.args, \*\*self.kwargs)  
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/spotify/media\_player.py”, line 238, in select\_source  
self.\_player.transfer\_playback(self.\_devices[source],  
KeyError: ‘’

---

<div class="post-metadata">

**Author:** ![pmdsaude](https://forum.cpha.pt/user_avatar/forum.cpha.pt/pmdsaude/32/1846_2.png) [@pmdsaude](https://forum.cpha.pt/u/pmdsaude)\
**Post date:** [8 Agosto , 2019 15:25 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/32 "2019-08-08T15:25:53Z")

</div>

Caros Amigos,  
Gostava da vossa ajuda neste ponto.  
Depois de configurar, bem acho eu, esta integração obtive este erro:  
**2019-08-08 16:14:46 ERROR (MainThread) [homeassistant.components.hassio] Integration not found: packages**  
Coloquei este parâmetros no configuration.yaml

```auto
  - platform: spotify
    client_id: !secret spotify_client_id
    client_secret: !secret spotify_client_secret

```

```auto
packages: !include_dir_named packages/

```

E adicionei o ficheiro spotify.yaml na pasta confi/packages com o seguinte código:

```auto
media_player:
  - platform: spotify
    client_id: !secret spotify_client_id
    client_secret: !secret spotify_client_secret

group:
  home_spotify_player:
    name: Spotify Player
    entities:
      - media_player.spotify
  
  home_spotify_controls:
    name: Spotify Controls
    control: hidden
    entities:
      - input_select.spotify_playlist
      - input_select.spotify_source
      - script.spotify_music
      - input_number.spotify_volume
      - input_boolean.spotify_shuffle

homeassistant:
  customize:
    script.spotify_music:
      friendly_name: 'Play'
      icon: mdi:play

sensor:
  - platform: template
    sensors:
      spotify_volume:
        friendly_name: "Spotify Volume"
        value_template: "{{ states.media_player.spotify.attributes.volume_level }}"
  - platform: template
    sensors:
      spotify_shuffle:
        friendly_name: "Spotify Shuffle"
        value_template: "{{ states.media_player.spotify.attributes.shuffle }}"
  - platform: template
    sensors:
      spotify_source:
        friendly_name: "Spotify Source"
        value_template: "{{ states.media_player.spotify.attributes.source }}"

input_number:
  spotify_volume:
    name: Volume
    icon: mdi:volume-high
    initial: 100
    min: 0
    max: 100
    step: 1

input_select:
  spotify_playlist:
    name: 'Playlist:'
    options:
      - Lista1
      - Lista2
      - Lista3
      - Lista4
    icon: mdi:spotify
  spotify_source:
    name: 'Source:'
    options:
      - Web Player (Chrome)
      - Mi Phone
      - DESKTOP-922IFR3
    initial: Web Player (Chrome)
    icon: mdi:speaker-wireless

input_boolean:
  spotify_shuffle:
    name: Shuffle
    icon: mdi:shuffle-variant

script:
  spotify_music:
    alias: "Play selected spotify playlist"
    sequence:
      - service: media_player.select_source
        data_template: 
          entity_id: media_player.spotify
          source: >
            {% if is_state("input_select.spotify_source", "Web Player (Chrome)") %} Web Player (Chrome)
            {% elif is_state("input_select.spotify_source", "Mi Phone") %} Mi Phone
            {% elif is_state("input_select.spotify_source", "DESKTOP-922IFR3") %} DESKTOP-922IFR3
            {% endif %}
      - service: media_player.play_media
        data_template:
          entity_id: media_player.spotify
          media_content_type: playlist
          media_content_id: >
            {% if is_state("input_select.spotify_playlist", "Lista1") %} spotify:user:spotify:playlist:37i9dQZF1DXakWdSZ8mUMO
            {% elif is_state("input_select.spotify_playlist", "Lista2") %} spotify:user:spotify:playlist:5dfbLgeesT8gixq1GTWBoU
            {% elif is_state("input_select.spotify_playlist", "Lista3") %} spotify:user:spotify:playlist:37i9dQZF1DX4WYpdgoIcn6
            {% elif is_state("input_select.spotify_playlist", "Lista4") %} spotify:user:spotify:playlist:6IjDl5eRczFdgZkKYXhuHZ
            {% endif %}

automation:
  - alias: 'Spotify Volume (Set)'
    trigger:
      platform: state
      entity_id: input_number.spotify_volume
    action:
      service: media_player.volume_set
      data_template:
        entity_id: media_player.spotify
        volume_level: '{{ states.input_number.spotify_volume.state | int / 100 }}'
  
  - alias: 'Spotify Volume (Sync)'
    trigger:
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: sensor.spotify_volume
    action:
      - delay:
          seconds: 5
      - service: input_number.set_value
        data_template:
          entity_id: input_number.spotify_volume
          value: '{{ states.sensor.spotify_volume.state | float | round(2) * 100 }}'
  
  - alias: 'Spotify Shuffle (Set)'
    trigger:
      platform: state
      entity_id: input_boolean.spotify_shuffle
    action:
      service: media_player.shuffle_set
      data_template:
        entity_id: media_player.spotify
        shuffle: >
          {% if is_state('input_boolean.spotify_shuffle', 'off') %} 
          false
          {% elif is_state('input_boolean.spotify_shuffle', 'on') %}
          true
          {% endif %}
  
  - alias: 'Spotify Shuffle (Sync)'
    trigger:
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: sensor.spotify_shuffle
    action:
      - delay:
          seconds: 5
      - service_template: >
          {% if states.sensor.spotify_shuffle.state == 'False' %}
            input_boolean.turn_off
          {% else %}
            input_boolean.turn_on
          {% endif %}
        data:
          entity_id: input_boolean.spotify_shuffle

  - alias: 'Spotify Source (Sync)'
    trigger:
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: sensor.spotify_source
    action:
      service: input_select.select_option
      entity_id: input_select.spotify_source
      data_template:
        option: '{{ states.sensor.spotify_source.state }}'

```

Este código que coloquei no spotify.yaml copiei na integra do posto " [Spotify - Como integrar e comandar entre dispositivos (Requer Premium)](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/455)"

Desde já obrigado pela vossa ajuda  
Abraço

---

<div class="post-metadata">

**Author:** ![Encarnacao](https://forum.cpha.pt/user_avatar/forum.cpha.pt/encarnacao/32/2031_2.png) [@Encarnacao](https://forum.cpha.pt/u/Encarnacao)\
**Post date:** [8 Agosto , 2019 17:29 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/33 "2019-08-08T17:29:44Z")

</div>

olhando para o código que tens ai, tas a chamar duas vezes a mesma coisa

```auto
media_player:
  - platform: spotify
    client_id: !secret spotify_client_id
    client_secret: !secret spotify_client_secret

```

tens no `configuration.yaml` e no `spotify.yaml`  
tira do configuration.yaml porque ja tens no spotify.yaml

---

<div class="post-metadata">

**Author:** ![pmdsaude](https://forum.cpha.pt/user_avatar/forum.cpha.pt/pmdsaude/32/1846_2.png) [@pmdsaude](https://forum.cpha.pt/u/pmdsaude)\
**Post date:** [12 Agosto , 2019 15:18 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/34 "2019-08-12T15:18:46Z")

</div>

Olá Hugo,  
Obrigado pela resposta.  
Testei, removendo da `configuration.yaml` ou do `spotify.yaml` mas o erro mantém-se.  
Ab

---

<div class="post-metadata">

**Author:** ![Encarnacao](https://forum.cpha.pt/user_avatar/forum.cpha.pt/encarnacao/32/2031_2.png) [@Encarnacao](https://forum.cpha.pt/u/Encarnacao)\
**Post date:** [13 Agosto , 2019 19:27 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/35 "2019-08-13T19:27:34Z")

</div>

@pmdsaude passa pelo nosso discord para podermos falar sobre isso melhor

---

<div class="post-metadata">

**Author:** ![jpm](https://forum.cpha.pt/letter_avatar_proxy/v4/letter/j/b487fb/32.png) [@jpm](https://forum.cpha.pt/u/jpm)\
**Post date:** [19 Setembro , 2019 09:22 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/36 "2019-09-19T09:22:32Z")

</div>

> [@pmdsaude](#):
>
> packages: !include\_dir\_named packages/

Bom dia,

@pmdsaude Basicamente o erro indica-te que estas com o “link” errado, experimenta algo assim no configuration.yaml:

packages:  
spotify: !include packages/spotify.yaml

---

<div class="post-metadata">

**Author:** ![heldercampos1](https://forum.cpha.pt/letter_avatar_proxy/v4/letter/h/c0e974/32.png) [@heldercampos1](https://forum.cpha.pt/u/heldercampos1)\
**Post date:** [7 Dezembro , 2020 22:54 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/38 "2020-12-07T22:54:52Z")

</div>

Boa Noite,

Penso que fiz tudo direito, contudo quando estou a "Validar a Configuração " está a aparecer este erro.

Invalid config for [group]: [control] is an invalid option for [group]. Check: group-\>group-\>home\_spotify\_controls-\>control. (See ?, line ?).

Meu Codigo:

```auto
media_player:
  - platform: spotify
    client_id: !secret spotify_client_id
    client_secret: !secret spotify_client_secret

group:
  home_spotify_player:
    name: Spotify Player
    entities:
      - media_player.spotify
  
  home_spotify_controls:
    name: Spotify Controls
    control: hidden
    entities:
      - input_select.spotify_playlist
      - input_select.spotify_source
      - script.spotify_music
      - input_number.spotify_volume
      - input_boolean.spotify_shuffle

homeassistant:
  customize:
    script.spotify_music:
      friendly_name: 'Play'
      icon: mdi:play

sensor:
  - platform: template
    sensors:
      spotify_volume:
        friendly_name: "Spotify Volume"
        value_template: "{{ states.media_player.spotify.attributes.volume_level }}"
  - platform: template
    sensors:
      spotify_shuffle:
        friendly_name: "Spotify Shuffle"
        value_template: "{{ states.media_player.spotify.attributes.shuffle }}"
  - platform: template
    sensors:
      spotify_source:
        friendly_name: "Spotify Source"
        value_template: "{{ states.media_player.spotify.attributes.source }}"

input_number:
  spotify_volume:
    name: Volume
    icon: mdi:volume-high
    initial: 100
    min: 0
    max: 100
    step: 1

input_select:
  spotify_playlist:
    name: 'Playlist:'
    options:
      - Lista1
      - Lista2
      - Lista3
      - Lista4
    icon: mdi:spotify
  spotify_source:
    name: 'Source:'
    options:
      - Web Player (Chrome)
      - Mi Phone
      - DESKTOP-922IFR3
    initial: Web Player (Chrome)
    icon: mdi:speaker-wireless

input_boolean:
  spotify_shuffle:
    name: Shuffle
    icon: mdi:shuffle-variant

script:
  spotify_music:
    alias: "Play selected spotify playlist"
    sequence:
      - service: media_player.select_source
        data_template: 
          entity_id: media_player.spotify
          source: >
            {% if is_state("input_select.spotify_source", "Web Player (Chrome)") %} Web Player (Chrome)
            {% elif is_state("input_select.spotify_source", "Mi Phone") %} Mi Phone
            {% elif is_state("input_select.spotify_source", "DESKTOP-922IFR3") %} DESKTOP-922IFR3
            {% endif %}
      - service: media_player.play_media
        data_template:
          entity_id: media_player.spotify
          media_content_type: playlist
          media_content_id: >
            {% if is_state("input_select.spotify_playlist", "Lista1") %} spotify:user:spotify:playlist:37i9dQZF1DXakWdSZ8mUMO
            {% elif is_state("input_select.spotify_playlist", "Lista2") %} spotify:user:spotify:playlist:5dfbLgeesT8gixq1GTWBoU
            {% elif is_state("input_select.spotify_playlist", "Lista3") %} spotify:user:spotify:playlist:37i9dQZF1DX4WYpdgoIcn6
            {% elif is_state("input_select.spotify_playlist", "Lista4") %} spotify:user:spotify:playlist:6IjDl5eRczFdgZkKYXhuHZ
            {% endif %}

automation:
  - alias: 'Spotify Volume (Set)'
    trigger:
      platform: state
      entity_id: input_number.spotify_volume
    action:
      service: media_player.volume_set
      data_template:
        entity_id: media_player.spotify
        volume_level: '{{ states.input_number.spotify_volume.state | int / 100 }}'
  
  - alias: 'Spotify Volume (Sync)'
    trigger:
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: sensor.spotify_volume
    action:
      - delay:
          seconds: 5
      - service: input_number.set_value
        data_template:
          entity_id: input_number.spotify_volume
          value: '{{ states.sensor.spotify_volume.state | float | round(2) * 100 }}'
  
  - alias: 'Spotify Shuffle (Set)'
    trigger:
      platform: state
      entity_id: input_boolean.spotify_shuffle
    action:
      service: media_player.shuffle_set
      data_template:
        entity_id: media_player.spotify
        shuffle: >
          {% if is_state('input_boolean.spotify_shuffle', 'off') %} 
          false
          {% elif is_state('input_boolean.spotify_shuffle', 'on') %}
          true
          {% endif %}
  
  - alias: 'Spotify Shuffle (Sync)'
    trigger:
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: sensor.spotify_shuffle
    action:
      - delay:
          seconds: 5
      - service_template: >
          {% if states.sensor.spotify_shuffle.state == 'False' %}
            input_boolean.turn_off
          {% else %}
            input_boolean.turn_on
          {% endif %}
        data:
          entity_id: input_boolean.spotify_shuffle

  - alias: 'Spotify Source (Sync)'
    trigger:
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: sensor.spotify_source
    action:
      service: input_select.select_option
      entity_id: input_select.spotify_source
      data_template:
        option: '{{ states.sensor.spotify_source.state }}'

```

---

<div class="post-metadata">

**Author:** ![j\_assuncao](https://forum.cpha.pt/user_avatar/forum.cpha.pt/j_assuncao/32/3_2.png) [@j\_assuncao](https://forum.cpha.pt/u/j_assuncao)\
**Post date:** [7 Dezembro , 2020 22:57 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/39 "2020-12-07T22:57:55Z")

</div>

E usas os `group:` para quê?

---

<div class="post-metadata">

**Author:** ![heldercampos1](https://forum.cpha.pt/letter_avatar_proxy/v4/letter/h/c0e974/32.png) [@heldercampos1](https://forum.cpha.pt/u/heldercampos1)\
**Post date:** [7 Dezembro , 2020 23:47 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/40 "2020-12-07T23:47:29Z")

</div>

Boas

Apenas copiei a código.  
Não percebi a sua funcionalidade.

Já agora qual a função deste código

```auto
group:
  home_spotify_player:
    name: Spotify Player
    entities:
      - media_player.spotify
  
  home_spotify_controls:
    name: Spotify Controls
    control: hidden
    entities:
      - input_select.spotify_playlist
      - input_select.spotify_source
      - script.spotify_music
      - input_number.spotify_volume
      - input_boolean.spotify_shuffle

```

Vou remover e testar

---

<div class="post-metadata">

**Author:** ![RodolfoVieira](https://forum.cpha.pt/user_avatar/forum.cpha.pt/rodolfovieira/32/14633_2.png) [@RodolfoVieira](https://forum.cpha.pt/u/RodolfoVieira)\
**Post date:** [7 Dezembro , 2020 23:57 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/41 "2020-12-07T23:57:50Z")

</div>

> [@heldercampos1](#):
>
> Apenas copiei a código.  
> Não percebi a sua funcionalidade.

@heldercampos1 não é boa prática copiar códigos sem perceber a sua funcionalidade…  
Pois isso vai fazer com que não entendas como funciona.  
Os `groups:` neste caso e só neste caso mt particular já não se usa devido ao Lovelace já ter um cartão que suporta directamente as chamadas das entidades.

 ![image](https://forum.cpha.pt/uploads/default/original/2X/d/da753dca141b20d8192736560047ec71147c0ff0.png)

No cartão entidades, podes chamar directamente as entidades.  
PS: Este tutorial foi feito há dois anos , é possível que tenha havido alterações podes obviamente exprimentar, mas tens que primeiro entender a estrutura de todo o código e suas funcionalidades, deixando de parte o conceito de (copiar colar).

---

<div class="post-metadata">

**Author:** ![heldercampos1](https://forum.cpha.pt/letter_avatar_proxy/v4/letter/h/c0e974/32.png) [@heldercampos1](https://forum.cpha.pt/u/heldercampos1)\
**Post date:** [8 Dezembro , 2020 03:19 UTC](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483/42 "2020-12-08T03:19:40Z")

</div>

Estou com algumas dificuldades em perceber todos estes pontos. É muita informação ao mesmo tempo. Espero com o tempo melhorar.

Contudo já consegui integrar o Spotify com o HA. Ainda estou a explorar esta integração, para já parece porreira.

Temos opção de escolher a nossa playlist de forma simples, e carrega as listas automaticamente do Spotify.

Segue uma foto de como ficou.

 ![imagem](https://forum.cpha.pt/uploads/default/original/2X/1/16a862393502198b5d30124e3d4b00501fdc41d2.jpeg)

[Página anterior](https://forum.cpha.pt/t/spotify-como-integrar-e-comandar-entre-dispositivos-requer-premium/483.md?page=1)
