Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Entwicklung
    4. [Major Update] UniFi Adapter v0.5.0

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    [Major Update] UniFi Adapter v0.5.0

    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      maniac @liv-in-sky last edited by

      @liv-in-sky sagte in [Major Update] UniFi Adapter v0.5.0:

      @maniac habe dir eine chatnachricht gesendet

      das ganze sollte funktionieren, wenn du eine console auf iobroker öffnest und dort in die console

      ./cam_aus_an <IP-SWITCH> on 20 oder ./cam_aus_an <IP-SWITCH> off 20
      

      einen der beiden befehle ausführen kannst - wenn das funktioniert, sollte der exec befehl im blockly funktionieren

      Ich bin einen Schritt weiter.
      Im Terminal Adapter kann ich das Script nun starten und der Port wird geschaltet.

      Der entscheidende Hinweis kommt von hier

      Im speziellen habe ich das Script temporär angepasst, indem ich den Aufruf mit diesem Code erweitert habe.

      ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no adminuser@xxx.xxx.xxx.xxx
      

      Die ganze Zeile sah dann so aus.

      ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no admin@$1 '(echo "enable" ; echo "configure" ; echo "interface 0/'$3'" ; echo "poe opmode auto" ; echo "exit" ; echo "exit"; echo "exit"  ) |
      

      Danach wurde auch die KnownHosts Datei im /home/iobroker/.ssh angelegt.
      Dann habe ich das Script wieder in den Ursprungszustand zurück gesetzt und nun funktioniert es im Terminal Adapter.

      Wenn ich allerdings das Blockly triggere, bekomme ich im Log einen Fehler.
      Im Javascript Adapter habe ich das "exec" erlaubt.

      28.9.2020, 10:25:00.126	[error]: javascript.0 (1090) script.js.Kameras.Bewegung: exec: sudo bash /opt/iobroker/cam.sh 192.168.222.2 off 20
      

      Passt hier der Aufruf im Blockly noch nicht?

      sudo bash /opt/iobroker/cam.sh 192.168.222.2 off 20
      

      cd954e31-db1d-49dd-9041-22936bfd0d11-grafik.png

      liv-in-sky 2 Replies Last reply Reply Quote 0
      • liv-in-sky
        liv-in-sky @maniac last edited by liv-in-sky

        @maniac - klasse, dass du schon weiter bist

        WICHTIGER HINWEIS https://forum.iobroker.net/post/496428 - bessere Lösung - nicht "bash" frei geben sondern pfad zum script selbst

        spontan : kontrolliere mal das sudoers file

        nano /etc/sudoers.d/iobroker

        da steht kein bash drin - daher ein eigenes file anlegen - bei mir

        Image 5.png

        Image 6.png

        vielleicht ist damit was zu machen

        du kannst auch versuchen das log im exec-blockly zu aktivieren - vielleicht steht da mehr

        Image 7.png

        und der klassiker - im setting des javascriptadapters muss exec ausführen erlaubt sein

        WICHTIGER HINWEIS https://forum.iobroker.net/post/496428 - bessere Lösung

        M 1 Reply Last reply Reply Quote 0
        • liv-in-sky
          liv-in-sky @maniac last edited by

          @maniac
          ach ja
          hatte gestern erst etwas gemacht - da brauchte ich bash garnicht - siehe post darüber - das blockly

          M 1 Reply Last reply Reply Quote 0
          • M
            maniac @liv-in-sky last edited by

            @liv-in-sky sagte in [Major Update] UniFi Adapter v0.5.0:

            spontan : kontrolliere mal das sudoers file

            nano /etc/sudoers.d/iobroker

            Hab auch ein eigenes angelegt.
            e8206f9a-d4f4-4c59-9850-066abf5d6740-grafik.png

            Auch nach komplettem Reboot geht es leider noch nicht.

            du kannst auch versuchen das log im exec-blockly zu aktivieren - vielleicht steht da mehr

            Image 7.png

            Wo kommt das "result" her? Das finde ich nicht 😞

            und der klassiker - im setting des javascriptadapters muss exec ausführen erlaubt sein

            Ist aktiv 🙂
            2bf021b2-c249-4602-b3b6-6751c5380be9-grafik.png

            liv-in-sky 2 Replies Last reply Reply Quote 0
            • liv-in-sky
              liv-in-sky @maniac last edited by

              @maniac das result einfach als variable anlegen

              M 1 Reply Last reply Reply Quote 0
              • liv-in-sky
                liv-in-sky @maniac last edited by

                @maniac

                hast du im blockly mal ohne "sudo bash" vor befehl getestet

                AlCalzone 1 Reply Last reply Reply Quote 0
                • M
                  maniac @liv-in-sky last edited by

                  @liv-in-sky sagte in [Major Update] UniFi Adapter v0.5.0:

                  @maniac
                  ach ja
                  hatte gestern erst etwas gemacht - da brauchte ich bash garnicht - siehe post darüber - das blockly

                  leider auch so nicht

                  07ad0090-5938-4008-928b-1fb7e9245334-grafik.png

                  1 Reply Last reply Reply Quote 0
                  • M
                    maniac @liv-in-sky last edited by

                    @liv-in-sky sagte in [Major Update] UniFi Adapter v0.5.0:

                    @maniac das result einfach als variable anlegen

                    ok.

                    Kommt nix besonderes bei raus
                    aa27cf72-c19f-4cfc-a28d-c1d0bccbf45c-grafik.png

                    liv-in-sky 1 Reply Last reply Reply Quote 0
                    • liv-in-sky
                      liv-in-sky @maniac last edited by liv-in-sky

                      @maniac
                      result anlegen
                      Image 8.png

                      was kommt den zurück, wenn du einfach nur ls -la als befehl im exec blockly angibst - da sollte etwas im log stehen

                      Image 9.png

                      M 1 Reply Last reply Reply Quote 1
                      • M
                        maniac @liv-in-sky last edited by

                        @liv-in-sky sagte in [Major Update] UniFi Adapter v0.5.0:

                        @maniac
                        result anlegen

                        Ja, das funktioniert. Bekomme den Inhalt von / aufgelistet.

                        liv-in-sky 1 Reply Last reply Reply Quote 0
                        • liv-in-sky
                          liv-in-sky @maniac last edited by

                          @maniac

                          hast du ml alle vrianten durchgespielt - bei mir funktioniert sudo bash...... nicht
                          aber bash...... funktioniert
                          und nur /opt/iobroker/cam.sh funktioniert auch

                          M 1 Reply Last reply Reply Quote 1
                          • liv-in-sky
                            liv-in-sky @maniac last edited by

                            @maniac

                            aus lauter verzweiflung:

                            Image 10.png

                            und hast du überprüft - wegen sudoers:

                            Image 11.png

                            1 Reply Last reply Reply Quote 0
                            • M
                              maniac @liv-in-sky last edited by

                              @liv-in-sky sagte in [Major Update] UniFi Adapter v0.5.0:

                              @maniac

                              hast du ml alle vrianten durchgespielt - bei mir funktioniert sudo bash...... nicht
                              aber bash...... funktioniert
                              und nur /opt/iobroker/cam.sh funktioniert auch

                              5ebe1037-8ffe-4d77-a3fa-a393fe4c9391-grafik.png

                              Alle mal auf einmal. Jetzt geht es plötzlich...
                              Habe die exec danach mal nach und nach deaktiviert.

                              Es funktioniert jetzt mit:

                              bash /opt/iobroker/cam.sh 192.168.222.2 off 20
                              

                              Ist mir unbegreiflich.

                              liv-in-sky 1 Reply Last reply Reply Quote 0
                              • liv-in-sky
                                liv-in-sky @maniac last edited by liv-in-sky

                                @maniac das sehen wir mal locker - begreifen ist nicht so wichtig - hauptssache es läuft 🙂

                                M 1 Reply Last reply Reply Quote 0
                                • M
                                  maniac @liv-in-sky last edited by

                                  @liv-in-sky
                                  Ja, aber warum wäre dennoch die Frage. Ich werde auf jeden Fall jetzt erstmal einen Snapshot anlegen. 😁
                                  Danach habe ich einen zweiten Switch. Da bekomme ich noch Host verification Error. Also noch mal von vorne 🙂

                                  Wenn es endgültig läuft, werde ich das mal zusammenschreiben und irgendwo hier posten. Damit man das mal nachlesen kann.

                                  Vielen, Vielen Dank für Deine Hilfe und Geduld...

                                  1 Reply Last reply Reply Quote 1
                                  • AlCalzone
                                    AlCalzone Developer @liv-in-sky last edited by

                                    @liv-in-sky Global bash per sudo ausführbar zu machen ist ein Rezept für Desaster. So kann jeder, der Kontrolle über den Admin hat, jedes x-beliebige Skript als root ausführen! Das hebelt das non-root-Konzept von ioBroker komplett aus!

                                    Besser:

                                    1. Skript ausführbar machen: sudo chmod +x /opt/iobroker/scripte/backupscript.sh
                                    2. Sicherstellen, dass das Skript mit #!/bin/bash beginnt
                                    3. In der sudoers genau das Skript /opt/iobroker/scripte/backupscript.sh erlauben.
                                    liv-in-sky 2 Replies Last reply Reply Quote 0
                                    • liv-in-sky
                                      liv-in-sky @AlCalzone last edited by

                                      @AlCalzone guter tipp - muss ich mir merken

                                      1 Reply Last reply Reply Quote 0
                                      • liv-in-sky
                                        liv-in-sky @AlCalzone last edited by

                                        @AlCalzone habe im orginal post zu deiner lösung gepostet

                                        AlCalzone 1 Reply Last reply Reply Quote 0
                                        • AlCalzone
                                          AlCalzone Developer @liv-in-sky last edited by

                                          @liv-in-sky Solltest du ggf. noch testen, nicht dass ich was vergessen habe 🙂

                                          liv-in-sky 1 Reply Last reply Reply Quote 0
                                          • liv-in-sky
                                            liv-in-sky @AlCalzone last edited by liv-in-sky

                                            @AlCalzone müßte funktionieren - eigentlich steht deine lösung in meinem beispiel 😞

                                            das ist ein eigenes script

                                            Image 7.png

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            789
                                            Online

                                            31.7k
                                            Users

                                            79.8k
                                            Topics

                                            1.3m
                                            Posts

                                            unifi
                                            54
                                            510
                                            84707
                                            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