Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. [gelöst] Installationsproblem bei node-sonos-http-api

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    [gelöst] Installationsproblem bei node-sonos-http-api

    This topic has been deleted. Only users with topic management privileges can see it.
    • Thomas Braun
      Thomas Braun Most Active last edited by

      @heinz53

      Recht viel Chaos...
      Und gewöhn dir die Verwendung von sudo ab. Das macht alles kaputt.
      Und auch von npm audit fix lässt man die Finger, insbesondere von --force.

      Was soll das Ziel der Installation sein? Ein Integration in den ioBroker?

      1 Reply Last reply Reply Quote 0
      • H
        Heinz53 last edited by

        Danke für die schnelle Antwort. Ich hatte die Installion bereits vorher ohne sudo mit den gleichen Fehlern versucht. Daher dachte ich sudo könnte helfen...

        Das Ziel ist, die Integration der SONOS in den ioBroker.

        1 Reply Last reply Reply Quote 0
        • Thomas Braun
          Thomas Braun Most Active last edited by

          @heinz53

          Das würde ich anders anfangen.

          Das entsprechende nodemodul würde ich in /usr/local/bin platzieren und das dann per Skript als Service starten lassen. Hier hab mal was sehr ähnliches mit solix2mqtt gemacht:

          https://forum.iobroker.net/topic/69229/anker-adapter/18?_=1700666385246

          1 Reply Last reply Reply Quote 0
          • H
            Heinz53 last edited by

            Dann versuche ich es mal in dem Verzeichnis /usr/local/bin und zwar ohne sudo

            Die Vorlage für die Installation ist auf folgendem link: https://github.com/jishi/node-sonos-http-api/wiki/Step-by-Step---RPi3-Install-of-Sonos-http-api

            pi@iobroker:/usr/local/bin $ git clone https://github.com/jishi/node-sonos-http-api.git
            fatal: could not create work tree dir 'node-sonos-http-api': Permission denied
            

            Was nun???

            Thomas Braun 1 Reply Last reply Reply Quote 0
            • Thomas Braun
              Thomas Braun Most Active @Heinz53 last edited by

              @heinz53 sagte in Installationsproblem bei node-sonos-http-api:

              Was nun???

              🙂 An DER Stelle brauchst du doch sudo, der pi darf da nämlich nicht reinschreiben. Wenn du magst installier ich das heute Abend mal bei mir und schreib es dann hier auf, wie das geht.

              1 Reply Last reply Reply Quote 0
              • H
                Heinz53 last edited by

                Das finde ich super! DANKE erst mal....

                Thomas Braun 1 Reply Last reply Reply Quote 0
                • Thomas Braun
                  Thomas Braun Most Active @Heinz53 last edited by Thomas Braun

                  @heinz53

                  Los geht's.

                  In deinem Heimverzeichnis:
                  Mit

                  mkdir sonoshttp
                  

                  ein Arbeitsverzeichnis anlegen.

                  cd sonoshttp/
                  git clone https://github.com/jishi/node-sonos-http-api.git
                  cd node-sonos-http-api/
                  npm install --omit=dev
                  cd ..
                  sudo mv node-sonos-http-api /usr/local/bin
                  
                  

                  Startskript anlegen:

                  sudo nano /usr/local/bin/node-sonos-http-api/sonoshttp.sh
                  

                  mit dem Inhalt:

                  #!/bin/bash
                  cd /usr/local/bin/node-sonos-http-api/;
                  npm start;
                  

                  Owner ändern:

                  sudo chown -R iobroker:iobroker /usr/local/bin/node-sonos-http-api
                  
                  sudo chmod 744 /usr/local/bin/node-sonos-http-api/sonoshttp.sh
                  

                  Jetzt per

                  sudo nano /usr/lib/systemd/system/sonoshttp.service
                  

                  eine Datei mit diesem Inhalt anlegen:

                  [Unit]
                  Description=Sonos http API
                  Before=iobroker.service
                  
                  [Service]
                  User=iobroker
                  Group=iobroker
                  ExecStart=/usr/local/bin/node-sonos-http-api/sonoshttp.sh
                  Type=simple
                  # Restart=always
                  
                  
                  [Install]
                  WantedBy=multi-user.target
                  #RequiredBy=network.target
                  

                  Mit

                  sudo systemctl daemon-reload
                  

                  die Service-Datei bekannt machen.
                  Ab jetzt dürfte das Ding beim Systemstart automatisch gestartet werden.
                  Mit

                  sudo systemctl start sonoshttp.service
                  systemctl status sonoshttp.service
                  

                  schauen was da los ist. Sollte dann ungefähr so aussehen:

                  ● sonoshttp.service - Sonos http API
                       Loaded: loaded (/lib/systemd/system/sonoshttp.service; enabled; preset: enabled)
                       Active: active (running) since Thu 2023-11-23 18:37:00 CET; 29min ago
                     Main PID: 269613 (sonoshttp.sh)
                        Tasks: 27 (limit: 8752)
                          CPU: 4.519s
                       CGroup: /system.slice/sonoshttp.service
                               ├─269613 /bin/bash /usr/local/bin/node-sonos-http-api/sonoshttp.sh
                               ├─269614 "npm start"
                               ├─269630 sh -c "node server.js"
                               └─269631 node server.js
                  

                  Individuelle Einstellungen müssen dann lt. readme wohl noch angelegt werden. Es sollte aber unter
                  die.IP.des.hosts.:5005/
                  die Startseite zu sehen sein:

                  3cf142c6-d336-495f-8846-b6d21e1ea0d4-image.png

                  1 Reply Last reply Reply Quote 0
                  • H
                    Heinz53 last edited by Heinz53

                    Hallo Thomas, ich bin begeistert!
                    Mit deiner Anleitung konnte ich die api aktivieren.

                    In der Anleitung hat sich an zwei Stellen ein Schreibfehler (...apt statt ...api) eingeschlichen

                    1. in Block Arbeitsverzeichnis anlegen
                      sudo mv node-sonos-http-apt /usr/local/bin
                    2. im Block Owner ändern
                      sudo chown -R iobroker:iobroker /usr/local/bin/node-sonos-http-apt

                    Dann hatte ich noch die Fehlermeldung.

                    pi@iobroker:~/sonoshttp $ sudo systemctl start sonoshttp.service
                    pi@iobroker:~/sonoshttp $ systemctl status sonoshttp.service
                    ● sonoshttp.service - Sonos http API
                         Loaded: loaded (/lib/systemd/system/sonoshttp.service; disabled; vendor preset: enabled)
                         Active: failed (Result: exit-code) since Thu 2023-11-23 23:13:29 CET; 3s ago
                        Process: 3655161 ExecStart=/usr/local/bin/node-sonos-http-api/sonoshttp.sh (code=exited, status=1/FAILURE)
                       Main PID: 3655161 (code=exited, status=1/FAILURE)
                            CPU: 3.965s
                    
                    Nov 23 23:13:28 iobroker sonoshttp.sh[3655369]:     playMode: { shuffle: true, repeat: 'all', crossfade: false },
                    Nov 23 23:13:28 iobroker sonoshttp.sh[3655369]:     pauseOthers: false
                    Nov 23 23:13:28 iobroker sonoshttp.sh[3655369]:   }
                    Nov 23 23:13:28 iobroker sonoshttp.sh[3655369]: }
                    Nov 23 23:13:29 iobroker sonoshttp.sh[3655369]: 2023-11-23T22:13:29.588Z ERROR Port 5005 seems to be in use already. Make sure the sonos->
                    Nov 23 23:13:29 iobroker sonoshttp.sh[3655369]:     already running, or that no other server uses that port. You can specify an alternati>
                    Nov 23 23:13:29 iobroker sonoshttp.sh[3655369]:     with property "port" in settings.json
                    Nov 23 23:13:29 iobroker systemd[1]: sonoshttp.service: Main process exited, code=exited, status=1/FAILURE
                    Nov 23 23:13:29 iobroker systemd[1]: sonoshttp.service: Failed with result 'exit-code'.
                    
                    

                    Nach der Änderung des Ports in der settings.js auf den Port 5015 war der Aufruf erfolgreich.

                    pi@iobroker:/usr/local/bin/node-sonos-http-api $ sudo nano settings.js
                    pi@iobroker:/usr/local/bin/node-sonos-http-api $ sudo systemctl start sonoshttp.service
                    pi@iobroker:/usr/local/bin/node-sonos-http-api $ systemctl status sonoshttp.service
                    ● sonoshttp.service - Sonos http API
                         Loaded: loaded (/lib/systemd/system/sonoshttp.service; disabled; vendor preset: enabled)
                         Active: active (running) since Thu 2023-11-23 23:21:47 CET; 25s ago
                       Main PID: 3671575 (sonoshttp.sh)
                          Tasks: 24 (limit: 3933)
                            CPU: 4.416s
                         CGroup: /system.slice/sonoshttp.service
                                 ├─3671575 /bin/bash /usr/local/bin/node-sonos-http-api/sonoshttp.sh
                                 ├─3671576 npm start
                                 ├─3671610 sh -c node server.js
                                 └─3671611 node server.js
                    
                    Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:       { roomName: 'Kitchen', volume: 10 },
                    Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:       { roomName: 'Office', volume: 10 },
                    Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:       { roomName: 'Bedroom', volume: 10 },
                    Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:       { roomName: 'TV Room', volume: 15 }
                    Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:     ],
                    Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:     playMode: { shuffle: true, repeat: 'all', crossfade: false },
                    Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:     pauseOthers: false
                    Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]:   }
                    Nov 23 23:21:49 iobroker sonoshttp.sh[3671611]: }
                    Nov 23 23:21:51 iobroker sonoshttp.sh[3671611]: 2023-11-23T22:21:51.011Z INFO http server listening on 0.0.0.0 port 5015
                    
                    

                    Hast du vielleicht noch einen Vorschlag wie ich feststellen kann was den Port 5005 belegt? Vielleicht habe ich mit meinen vorherigen Versuchen hier etwas durcheinandergebracht.

                    Nochmals: Herzlichen Dank für deine Unterstützung!

                    Thomas Braun 1 Reply Last reply Reply Quote 0
                    • Thomas Braun
                      Thomas Braun Most Active @Heinz53 last edited by Thomas Braun

                      @heinz53 sagte in Installationsproblem bei node-sonos-http-api:

                      Vielleicht habe ich mit meinen vorherigen Versuchen hier etwas durcheinandergebracht.

                      Vermutlich. Im

                      iob diag
                      

                      sind die Serverdienste und deren Ports aber auch drin.

                      1 Reply Last reply Reply Quote 0
                      • H
                        Heinz53 last edited by

                        Danke!
                        Die simple-api.0 ist zugeordnet.

                        Ich lerne dazu, auch Dank deines Werkzeugkastens 👏 👏 👏

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        Support us

                        ioBroker
                        Community Adapters
                        Donate
                        FAQ Cloud / IOT
                        HowTo: Node.js-Update
                        HowTo: Backup/Restore
                        Downloads
                        BLOG

                        917
                        Online

                        31.9k
                        Users

                        80.1k
                        Topics

                        1.3m
                        Posts

                        sonos http api
                        2
                        11
                        675
                        Loading More Posts
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes
                        Reply
                        • Reply as topic
                        Log in to reply
                        Community
                        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                        The ioBroker Community 2014-2023
                        logo