Skip to content
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Logo
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. [Vorlage] Spotify Skript

NEWS

  • Wartung am 15.11. – Forum ab 22:00 Uhr nicht erreichbar
    BluefoxB
    Bluefox
    12
    2
    257

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.0k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    1.7k

[Vorlage] Spotify Skript

[Vorlage] Spotify Skript

Scheduled Pinned Locked Moved Skripten / Logik
javascript
745 Posts 95 Posters 264.4k Views 41 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tempestas
    wrote on last edited by
    #52

    Hmmm ich bekomme beim Versuch es zu starten folgendes Log:

    javascript.0	2018-01-03 18:09:56.804	error	at Object. (script.js.common.Spotify.Spotify_Skript:437:36)
    javascript.0	2018-01-03 18:09:56.803	error	Error in callback: TypeError: Cannot read property 'parse' of undefined
    javascript.0	2018-01-03 18:09:55.625	info	script.js.common.Spotify.Spotify_Skript: Error: ENOENT: no such file or directory, open 'SpotifyAccessToken.txt'
    javascript.0	2018-01-03 18:09:55.620	info	script.js.common.Spotify.Spotify_Skript: registered 20 subscriptions and 0 schedules
    javascript.0	2018-01-03 18:09:55.616	error	at ContextifyScript.Script.runInContext (vm.js:35:29)
    javascript.0	2018-01-03 18:09:55.616	error	at script.js.common.Spotify.Spotify_Skript:49:19
    javascript.0	2018-01-03 18:09:55.615	error	script.js.common.Spotify.Spotify_Skript: Error: Cannot find module '/opt/iobroker/node_modules/iobroker.javascript/node_modules/querystring'
    
    

    muss ich das querystring noch irgendwo im Adapter eintragen?

    Edit: gemacht, nun ging es. Allerdings reagiert Chrome gar nicht auf die generierte URL und FF sagt, dass es invalid ist?

    <size="85">ioBroker | 21 Adapter | Ubuntu Server | intel NUC | Homematic CCU2 | Hue | Osram Lightify| Sonos | 2x Instar Cam | Samsung Tab A 2016 im Holzrahmen| 3x Echo dot | 1x Echo | Neato Botvac D5</size>

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Lucky
      wrote on last edited by
      #53

      ich habe in der letzten Version oben ein paar Änderungen vorgenommen

      Allerdings ist die Warnung nicht ganz weg zu bekommen, Sie kommt allerdings nur wenn ein Playlist abgerufen wird die vorher noch nicht angelegt war.

      Grund ist, das getObject die Warnung ausgibt wenn nach einem nicht vorhandenen State gesucht wird, das hat aber sonst keine nachteile und für nicht zu Störungen.

      Sonstige Änderungen:

      • Anzahl der Tracks in einer Playlist wird jetzt angezeigt

      • Shuffle hinzugefügt

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Lucky
        wrote on last edited by
        #54

        @tempestas:

        Edit: gemacht, nun ging es. Allerdings reagiert Chrome gar nicht auf die generierte URL und FF sagt, dass es invalid ist? `

        es ist korrekt das im Browser keine Webseite angezeigt wird weil es unter 'example' keine gibt, da ist eine Dummy, es wird aber trotzdem in der Adresszeile eine URL zurück gegeben, diese mußt du kopieren

        https://example.com/callback/?code=xxxxxxxxxxxxxxxxxxxxxxxxxx&state=xxxxxxxxxxxxxxxxxxxxx
        
        1 Reply Last reply
        0
        • T Offline
          T Offline
          tempestas
          wrote on last edited by
          #55

          Er sagt bei mir allerdings:

          
          https://accounts.spotify.com/de/authorize/?client_id=XXXXXXXXXXXXXXXXXXXXXXX&response_type=code&redirect_uri=https%3A%2F%2Fexample.com%2Fcallback%2F&state=xxxxxxxxxxxxxxxxxxxxxxx&scope=user-modify-playback-state%20user-read-playback-state%20user-read-currently-playing%20playlist-read-private
          
          

          und dann steht da eben INVALID_CLIENT: Invalid redirect URI

          Ich habe auch nichts zulassen müssen bzw können in Spotify. Daher meine frage

          <size="85">ioBroker | 21 Adapter | Ubuntu Server | intel NUC | Homematic CCU2 | Hue | Osram Lightify| Sonos | 2x Instar Cam | Samsung Tab A 2016 im Holzrahmen| 3x Echo dot | 1x Echo | Neato Botvac D5</size>

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Lucky
            wrote on last edited by
            #56

            der Ablauf sollte sich so gestalten:

            1.Spotify Premium notwendig

            2. bei Spotify eine Application registrieren

            3. der erhaltenen Client ID und Client Secret im Script an die angegeben Stelle kopieren

            4. State 'Get_Authorization drücken, es wird eine URL generiert

            5. diese URL kopieren und im Browser einfügen, beim ersten mal wird Spotify Fragen ob man den Client zulassen möchte, dies bestätigen ! Nun wird man auf die nicht vorhanden Webseite 'example.com' (manche Browser zeigen möglicherweise einen Fehler)

            Achtung: ist die der Client bereits zugelassen, fragt Spotify nicht erneut ! es wird direkt weitergeleitet !

            6. die Adresse die jetzt in der Adresszeile des Browsers steht kopieren ( https://example.com/callback/?code=xxx&state=xxx ) und in das State 'Authorization_Return_URI' einfügen

            7. Fertig

            wichtig ist auch das exakt die gleiche Redirect URI im Skript wie auch bei der Registrierten Application angegeben ist !

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tempestas
              wrote on last edited by
              #57
              1. habe ich

              2. gemacht

              3. gemacht, 800x geprüft beides. Kopiert, manuell, via notepad++…

              4. gemacht

              5. gemacht --> spotify fragt mich gar nichts. Wo genau sollte diese Frage kommen? in meinem Spotify client? oder auf der homepage wo ich eingeloggt bin?

              6. gemacht --> authorized geht auf true

              7. irgendwie passiert jetzt aber nichts weiter?

              <size="85">ioBroker | 21 Adapter | Ubuntu Server | intel NUC | Homematic CCU2 | Hue | Osram Lightify| Sonos | 2x Instar Cam | Samsung Tab A 2016 im Holzrahmen| 3x Echo dot | 1x Echo | Neato Botvac D5</size>

              1 Reply Last reply
              0
              • L Offline
                L Offline
                Lucky
                wrote on last edited by
                #58

                Wenn authorized auf true geht hat alles geklappt!

                Jetzt solltest du deine Geräte und playlisten einlesen können

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  tempestas
                  wrote on last edited by
                  #59

                  hmm dann hängts woanders… ich klicke und klicke, aber nichts passiert.

                  noch etwas zu tun?

                  <size="85">ioBroker | 21 Adapter | Ubuntu Server | intel NUC | Homematic CCU2 | Hue | Osram Lightify| Sonos | 2x Instar Cam | Samsung Tab A 2016 im Holzrahmen| 3x Echo dot | 1x Echo | Neato Botvac D5</size>

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    Lucky
                    wrote on last edited by
                    #60

                    Wird denn dein Benutzer Name im state username angezeigt?

                    Wo hast du das Skript gespeichert, direkt unter Javascript. 0. spotify ?

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      manne_r
                      wrote on last edited by
                      #61

                      Nimm mal im Script bei der URL ganz am Ende das / weg.

                      Hatte ich weiter oben im Thread irgendwo gelesen. Das hat bei mir geholfen.

                      Gesendet von iPhone mit Tapatalk

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        tempestas
                        wrote on last edited by
                        #62

                        @Lucky:

                        Wird denn dein Benutzer Name im state username angezeigt?

                        Wo hast du das Skript gespeichert, direkt unter Javascript. 0. spotify ? `

                        User ist leer.

                        Ja, liegt direkt unter javascript.0 Instanz.

                        Bzw. in einem Ordner "Spotify" unter den "Common" Skripten

                        Werde mal manne_r's Tipp ausprobieren

                        Edit: habe im Spotify Dashboard nochmal die example.com/callback Adresse eingegeben und gespeichert (war mir nicht klar, dass man das wohl muss).

                        Nun kam immerhin einmalig diese Frage, ob ich es zulassen will von Spotify. Allerdings ändert sich danach nichts, die generierte Adresse schiebe ich in die auth_redirect_uri und es geht auf true, bleibt aber alles leer ansonsten

                        <size="85">ioBroker | 21 Adapter | Ubuntu Server | intel NUC | Homematic CCU2 | Hue | Osram Lightify| Sonos | 2x Instar Cam | Samsung Tab A 2016 im Holzrahmen| 3x Echo dot | 1x Echo | Neato Botvac D5</size>

                        1 Reply Last reply
                        0
                        • T Offline
                          T Offline
                          tempestas
                          wrote on last edited by
                          #63

                          Melde Vollzug:

                          8x exakt das gleiche tun hat irgendwann funktioniert. Danke, nun werde ich mal reichlich testen. Vielen Dank, geile Sache!

                          Edit: die Devices bleiben leer. Auch nach Klick auf get_devices.

                          Dachte, dort würde ich meine Sonos Boxen sehen? Ich glaube, so ganz verstehe ich es noch nicht :roll: :oops:

                          <size="85">ioBroker | 21 Adapter | Ubuntu Server | intel NUC | Homematic CCU2 | Hue | Osram Lightify| Sonos | 2x Instar Cam | Samsung Tab A 2016 im Holzrahmen| 3x Echo dot | 1x Echo | Neato Botvac D5</size>

                          1 Reply Last reply
                          0
                          • L Offline
                            L Offline
                            Lucky
                            wrote on last edited by
                            #64

                            also steht in User ID jetzt was drin ? gut 😄

                            es könnte sein das es evtl eine Blacklist bei Spotify gibt auf die man kommt wenn zuviel Anmeldungen schief gehen

                            Aktualisiere mal bitte deine States nachdem du die Geräte und Playlist abgerufen hast, States die zur Laufzeit angelegt wurden, werden in Iobroker nicht immer gleich sichtbar

                            dann solltest du auch deine Sonos Boxen sehen wenn diese Spotify Connect unterstützen 😉

                            1 Reply Last reply
                            0
                            • T Offline
                              T Offline
                              tempestas
                              wrote on last edited by
                              #65

                              ähm.. was meinst du mit states aktualisieren?

                              Reload der Page? Die Playlists sind alle eingelesen

                              <size="85">ioBroker | 21 Adapter | Ubuntu Server | intel NUC | Homematic CCU2 | Hue | Osram Lightify| Sonos | 2x Instar Cam | Samsung Tab A 2016 im Holzrahmen| 3x Echo dot | 1x Echo | Neato Botvac D5</size>

                              1 Reply Last reply
                              0
                              • L Offline
                                L Offline
                                Lucky
                                wrote on last edited by
                                #66

                                auf der Objekte Seite oben links das Aktualisieren Symbol

                                die Geräte müssen beim einlesen erreichbar und mit dem Account verbunden sein, also zb. die Android App auf dem Telefon wird erst aufgelistet wenn diese zum Zeitpunkt des einlesen Aktiv war

                                1 Reply Last reply
                                0
                                • T Offline
                                  T Offline
                                  tempestas
                                  wrote on last edited by
                                  #67

                                  ahhh.. am aktiv sein kann es hängen. Das werde ich dann später zu Hause ausprobieren. danke!

                                  Edit: ok, Handy ging sofort. Danke!

                                  <size="85">ioBroker | 21 Adapter | Ubuntu Server | intel NUC | Homematic CCU2 | Hue | Osram Lightify| Sonos | 2x Instar Cam | Samsung Tab A 2016 im Holzrahmen| 3x Echo dot | 1x Echo | Neato Botvac D5</size>

                                  1 Reply Last reply
                                  0
                                  • W Offline
                                    W Offline
                                    Worn
                                    wrote on last edited by
                                    #68

                                    Hi zusammen,

                                    frohes neues Jahr! Ich habe nochmal eine Frage. Bin aus dem Urlaub gekommen und das Skript funktioniert nicht mehr. Log zeigt beim Neuladen:

                                    Error: ENOENT: no such file or directory, open 'SpotifyAccessToken.txt'

                                    Was ist in diesem Fall zu unternehmen? Noch mal neu registrieren?

                                    Danke und Grüße

                                    Ben

                                    1 Reply Last reply
                                    0
                                    • L Offline
                                      L Offline
                                      Lucky
                                      wrote on last edited by
                                      #69

                                      > no such file or directory, open 'SpotifyAccessToken.txt'
                                      bedeutet das die Datei mit den Token nicht vorhanden/gelöscht ist, diese wird automatisch beim erfolgreichen anmelden angelegt.

                                      klick nochmal Get_Authorization und geh so vor wie bei der ersten Anmeldung

                                      1 Reply Last reply
                                      0
                                      • T Offline
                                        T Offline
                                        tempestas
                                        wrote on last edited by
                                        #70

                                        Meine Sonos Boxen wollen sich leider nicht finden lassen. Wie muss ich sie aktiv haben, damit sie gefunden werden?

                                        Habe sie sowohl über Sonos (und dann natürlich mit Spotify) angesteuert als auch über Spotify direkt. Lassen sich nicht finden. Nur der PC, auf dem die Spotify App läuft

                                        Dafür läuft mein Log voll mit Warnungen:

                                        ! javascript.0 2018-01-05 19:30:30.969 warn at process._tickCallback (internal/process/next_tick.js:104:9) javascript.0 2018-01-05 19:30:30.969 warn at _combinedTickCallback (internal/process/next_tick.js:80:11) javascript.0 2018-01-05 19:30:30.969 warn at endReadableNT (_stream_readable.js:974:12) javascript.0 2018-01-05 19:30:30.969 warn at IncomingMessage.emit (events.js:185:7) javascript.0 2018-01-05 19:30:30.969 warn at emitNone (events.js:91:20) javascript.0 2018-01-05 19:30:30.969 warn at IncomingMessage.g (events.js:292:16) javascript.0 2018-01-05 19:30:30.969 warn at IncomingMessage. (/opt/iobroker/node_modules/request/request.js:1085:12) javascript.0 2018-01-05 19:30:30.969 warn at Request.emit (events.js:188:7) javascript.0 2018-01-05 19:30:30.968 warn at emitOne (events.js:96:13) javascript.0 2018-01-05 19:30:30.968 warn at Request. (/opt/iobroker/node_modules/request/request.js:1163:10) javascript.0 2018-01-05 19:30:30.968 warn at Request.emit (events.js:191:7) javascript.0 2018-01-05 19:30:30.968 warn at emitTwo (events.js:106:13) javascript.0 2018-01-05 19:30:30.968 warn at Request.self.callback (/opt/iobroker/node_modules/request/request.js:186:22) javascript.0 2018-01-05 19:30:30.968 warn at Request._callback (script.js.common.Spotify.Spotify_Skript:150:24) javascript.0 2018-01-05 19:30:30.968 warn at script.js.common.Spotify.Spotify_Skript:592:31 javascript.0 2018-01-05 19:30:30.968 warn at CreatePlaybackInfo (script.js.common.Spotify.Spotify_Skript:204:6) javascript.0 2018-01-05 19:30:30.968 warn Wrong type of javascript.0.Spotify.PlaybackInfo.Device.id: "object". Please fix, while deprecated and will not work in next versions. javascript.0 2018-01-05 19:30:20.962 warn at process._tickCallback (internal/process/next_tick.js:104:9) javascript.0 2018-01-05 19:30:20.961 warn at _combinedTickCallback (internal/process/next_tick.js:80:11) javascript.0 2018-01-05 19:30:20.961 warn at endReadableNT (_stream_readable.js:974:12) javascript.0 2018-01-05 19:30:20.961 warn at IncomingMessage.emit (events.js:185:7) javascript.0 2018-01-05 19:30:20.961 warn at emitNone (events.js:91:20) javascript.0 2018-01-05 19:30:20.961 warn at IncomingMessage.g (events.js:292:16) javascript.0 2018-01-05 19:30:20.961 warn at IncomingMessage. (/opt/iobroker/node_modules/request/request.js:1085:12) javascript.0 2018-01-05 19:30:20.961 warn at Request.emit (events.js:188:7) javascript.0 2018-01-05 19:30:20.961 warn at emitOne (events.js:96:13) javascript.0 2018-01-05 19:30:20.961 warn at Request. (/opt/iobroker/node_modules/request/request.js:1163:10) javascript.0 2018-01-05 19:30:20.961 warn at Request.emit (events.js:191:7) javascript.0 2018-01-05 19:30:20.961 warn at emitTwo (events.js:106:13) javascript.0 2018-01-05 19:30:20.961 warn at Request.self.callback (/opt/iobroker/node_modules/request/request.js:186:22) javascript.0 2018-01-05 19:30:20.961 warn at Request._callback (script.js.common.Spotify.Spotify_Skript:150:24) javascript.0 2018-01-05 19:30:20.961 warn at script.js.common.Spotify.Spotify_Skript:592:31 javascript.0 2018-01-05 19:30:20.961 warn at CreatePlaybackInfo (script.js.common.Spotify.Spotify_Skript:204:6) javascript.0 2018-01-05 19:30:20.960 warn Wrong type of javascript.0.Spotify.PlaybackInfo.Device.id: "object". Please fix, while deprecated and will not work in next versions. javascript.0 2018-01-05 19:30:15.962 warn at process._tickCallback (internal/process/next_tick.js:104:9) javascript.0 2018-01-05 19:30:15.962 warn at _combinedTickCallback (internal/process/next_tick.js:80:11) javascript.0 2018-01-05 19:30:15.962 warn at endReadableNT (_stream_readable.js:974:12) javascript.0 2018-01-05 19:30:15.962 warn at IncomingMessage.emit (events.js:185:7) javascript.0 2018-01-05 19:30:15.962 warn at emitNone (events.js:91:20) javascript.0 2018-01-05 19:30:15.962 warn at IncomingMessage.g (events.js:292:16) javascript.0 2018-01-05 19:30:15.962 warn at IncomingMessage. (/opt/iobroker/node_modules/request/request.js:1085:12) javascript.0 2018-01-05 19:30:15.962 warn at Request.emit (events.js:188:7) javascript.0 2018-01-05 19:30:15.962 warn at emitOne (events.js:96:13) javascript.0 2018-01-05 19:30:15.962 warn at Request. (/opt/iobroker/node_modules/request/request.js:1163:10) javascript.0 2018-01-05 19:30:15.962 warn at Request.emit (events.js:191:7) javascript.0 2018-01-05 19:30:15.962 warn at emitTwo (events.js:106:13) javascript.0 2018-01-05 19:30:15.962 warn at Request.self.callback (/opt/iobroker/node_modules/request/request.js:186:22) javascript.0 2018-01-05 19:30:15.961 warn at Request._callback (script.js.common.Spotify.Spotify_Skript:150:24) javascript.0 2018-01-05 19:30:15.961 warn at script.js.common.Spotify.Spotify_Skript:592:31 javascript.0 2018-01-05 19:30:15.961 warn at CreatePlaybackInfo (script.js.common.Spotify.Spotify_Skript:204:6) javascript.0 2018-01-05 19:30:15.961 warn Wrong type of javascript.0.Spotify.PlaybackInfo.Device.id: "object". Please fix, while deprecated and will not work in next versions. javascript.0 2018-01-05 19:30:10.972 warn at process._tickCallback (internal/process/next_tick.js:104:9) javascript.0 2018-01-05 19:30:10.972 warn at _combinedTickCallback (internal/process/next_tick.js:80:11) javascript.0 2018-01-05 19:30:10.972 warn at endReadableNT (_stream_readable.js:974:12) javascript.0 2018-01-05 19:30:10.972 warn at IncomingMessage.emit (events.js:185:7) javascript.0 2018-01-05 19:30:10.972 warn at emitNone (events.js:91:20) javascript.0 2018-01-05 19:30:10.972 warn at IncomingMessage.g (events.js:292:16) javascript.0 2018-01-05 19:30:10.972 warn at IncomingMessage. (/opt/iobroker/node_modules/request/request.js:1085:12) javascript.0 2018-01-05 19:30:10.972 warn at Request.emit (events.js:188:7) javascript.0 2018-01-05 19:30:10.972 warn at emitOne (events.js:96:13) javascript.0 2018-01-05 19:30:10.972 warn at Request. (/opt/iobroker/node_modules/request/request.js:1163:10) javascript.0 2018-01-05 19:30:10.972 warn at Request.emit (events.js:191:7) javascript.0 2018-01-05 19:30:10.972 warn at emitTwo (events.js:106:13) javascript.0 2018-01-05 19:30:10.972 warn at Request.self.callback (/opt/iobroker/node_modules/request/request.js:186:22) javascript.0 2018-01-05 19:30:10.972 warn at Request._callback (script.js.common.Spotify.Spotify_Skript:150:24) javascript.0 2018-01-05 19:30:10.971 warn at script.js.common.Spotify.Spotify_Skript:592:31 javascript.0 2018-01-05 19:30:10.971 warn at CreatePlaybackInfo (script.js.common.Spotify.Spotify_Skript:204:6) javascript.0 2018-01-05 19:30:10.971 warn Wrong type of javascript.0.Spotify.PlaybackInfo.Device.id: "object". Please fix, while deprecated and will not work in next versions. !

                                        <size="85">ioBroker | 21 Adapter | Ubuntu Server | intel NUC | Homematic CCU2 | Hue | Osram Lightify| Sonos | 2x Instar Cam | Samsung Tab A 2016 im Holzrahmen| 3x Echo dot | 1x Echo | Neato Botvac D5</size>

                                        1 Reply Last reply
                                        0
                                        • wendy2702W Online
                                          wendy2702W Online
                                          wendy2702
                                          wrote on last edited by
                                          #71

                                          Hi,

                                          habe das Skript auch zum laufen bekommen… jetzt fehlt mir nur noch ein hinweis wie ich es z.B. schaffe auf Vis eine meiner Playlist auf einem meiner Ausgabe Geräte wiederzugeben.

                                          Kann mir da wer auf die Sprünge helfen?

                                          Danke und Gruß

                                          Bitte keine Fragen per PN, die gehören ins Forum!

                                          Benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          Support us

                                          ioBroker
                                          Community Adapters
                                          Donate

                                          144

                                          Online

                                          32.4k

                                          Users

                                          81.3k

                                          Topics

                                          1.3m

                                          Posts
                                          Community
                                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                          ioBroker Community 2014-2025
                                          logo
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Recent
                                          • Tags
                                          • Unread 0
                                          • Categories
                                          • Unreplied
                                          • Popular
                                          • GitHub
                                          • Docu
                                          • Hilfe