Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. Unifi Steuern ohne Adapter (Script,SSH)

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Unifi Steuern ohne Adapter (Script,SSH)

    This topic has been deleted. Only users with topic management privileges can see it.
    • Neuschwansteini
      Neuschwansteini @draexler last edited by

      @draexler

      zwei Sachen fallen mir auf:

      1. wenn du ne UDM Pro hast, mach aus dem Port 8443 nur 443
      2. in dem Script heisst der iobroker Host "iobroker59" - musste ich bei mir auf iobroker aendern, meiner heisst halt einfach nur iobroker..

      Probiers mal aus!
      🙂

      draexler 1 Reply Last reply Reply Quote 0
      • draexler
        draexler @Neuschwansteini last edited by

        @ilovegym Merce 🙂 Es war nur das Problem mit iobroker59. Das Basisscript läuft.
        Frage an alle: Gibts irgendeine Möglichkeit das PW nicht im Klartext anzuzeigen?

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

          @draexler sagte in Adapter: ioBroker.unifi:

          log(getObject('system.host.iobroker59').native.os.platform)

          diese zeile (letzte) bitte löschen - war ein test für ganz was anderes und gehört nicht ins script - sorry

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

            @liv-in-sky Jetzt bin ich mir gerade unsicher ob das schon war oder nicht... Jetzt ist das node-unifi rot unterstrichen. In der Javascript Instanz ist es aber angegeben. Instanz wurde auch schon neu gestartet.
            64bb85f2-c853-45be-94e8-3595c5acec44-image.png
            85583475-31db-4d71-969e-60ef96f07cac-image.png

            Woran kann das liegen? Wo kann ich was prüfen?

            Jetzt kommt auch diese Fehlermeldung im Log...
            Bin mir sicher das es meiner Erfolgsmeldung vorher nicht drinstand....

            javascript.0	10:12:58.289	info	script.js.common.Netzwerk.Voucher_erstellen: ERROR: AxiosError: Request failed with status code 400
            
            liv-in-sky 1 Reply Last reply Reply Quote 0
            • liv-in-sky
              liv-in-sky @draexler last edited by liv-in-sky

              @draexler das ist kein problem - ist bei mir immer so - du kannst mit rechter maustaste darauf gehen und fehler unterdrücken

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

                @liv-in-sky

                Jetzt ist diese Fehlermeldung im Log. Bin mir aber ziemlich sicher das es bei meiner Erfolgsmeldung vorher nicht so war....

                javascript.0 10:12:58.289 info script.js.common.Netzwerk.Voucher_erstellen: ERROR: AxiosError: Request failed with status code 400
                
                liv-in-sky 1 Reply Last reply Reply Quote 0
                • liv-in-sky
                  liv-in-sky @draexler last edited by liv-in-sky

                  @draexler

                  probier es nochmal - das bedeutet, der server ist nicht erreichbar - evtl traffic im netz

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

                    @liv-in-sky Keine Änderung. Kann es ja später nochmal probieren... Sehr komisch.

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

                      @draexler hast du am script was geändert ?

                      poste mal das script- mach das kennwort unkenntlich

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

                        @liv-in-sky Denke nicht... Meines Erachtens nur das Basisscript:

                        const Unifi = require('node-unifi');
                        
                        const unifi = new Unifi.Controller({hostname:"192.168.168.5",port:'8443', sslverify: false});
                        
                        (async () => {
                         try {
                           // LOGIN
                           const loginData = await unifi.login('unifi-iobroker', '34523452345');
                           console.log('login: ' + loginData);
                        
                        //   const clientVoucher = await unifi.createVouchers(123,1,0,"testthis");
                          //const clientVoucher = await unifi.createVouchers(1,1,0,"testthis");
                        
                           // LOGOUT
                           const logoutData = await unifi.logout();
                           console.log('logout: ' + JSON.stringify(logoutData));
                         } catch (error) {
                           console.log('ERROR: ' + error);
                         }
                        })();
                        
                        
                        liv-in-sky 2 Replies Last reply Reply Quote 0
                        • liv-in-sky
                          liv-in-sky @draexler last edited by

                          @draexler

                          mit meinen daten kommt da kein axios fehler

                          mach mal die klammer auf und zu weg

                          Image 062.png

                          du kannst evtl noch unter den alarms im controller nachsehen, ob da was steht

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

                            @draexler und restarte mal die javascript instanz

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

                              @liv-in-sky Instanz ist neugestartet und die Klammern entfernt. Keine Fehlermeldung mehr, aber es scheint als würde gar nichts mehr ausgeführt. Vorher konnte ich im Controller Anmeldeversuche sehen:

                              const Unifi = require('node-unifi');
                              
                              const unifi = new Unifi.Controller({hostname:"192.168.168.5",port:'8443', sslverify: false});
                              
                              (async () => {
                               try {
                                 // LOGIN
                                 const loginData = await unifi.login('unifi-iobroker', '34523452345!');
                                 console.log('login: ' + loginData);
                              
                                const clientVoucher = await unifi.createVouchers(800,1,5,"testthis");
                              
                                 // LOGOUT
                                 const logoutData = await unifi.logout();
                                 console.log('logout: ' + JSON.stringify(logoutData));
                               } catch (error) {
                                 console.log('ERROR: ' + error);
                               }
                              });
                              
                              31.5.2024, 11:26:58.954	[info ]: javascript.0 (3780) Stopping script script.js.common.Netzwerk.Voucher_erstellen
                              31.5.2024, 11:26:59.646	[info ]: javascript.0 (3780) Start JavaScript script.js.common.Netzwerk.Voucher_erstellen (Javascript/js)
                              31.5.2024, 11:26:59.649	[info ]: javascript.0 (3780) script.js.common.Netzwerk.Voucher_erstellen: registered 0 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
                              
                              liv-in-sky 2 Replies Last reply Reply Quote 0
                              • liv-in-sky
                                liv-in-sky @draexler last edited by liv-in-sky

                                @draexler

                                nimm mal das:

                                const Unifi = require('node-unifi');
                                 
                                const unifi = new Unifi.Controller({hostname:"192.168.168.5",port:'8443', sslverify: false});
                                 
                                async function main() {
                                 try {
                                   // LOGIN
                                   const loginData = await unifi.login('unifi-iobroker', '34523452345!');
                                   console.log('login: ' + loginData);
                                 
                                const clientVoucher = await unifi.createVouchers(800,1,5,"testthis");
                                
                                
                                   // LOGOUT
                                   const logoutData = await unifi.logout();
                                   console.log('logout: ' + JSON.stringify(logoutData));
                                 } catch (error) {
                                   console.log('ERROR: ' + error);
                                 }
                                }
                                
                                main();
                                
                                1 Reply Last reply Reply Quote 0
                                • liv-in-sky
                                  liv-in-sky @draexler last edited by

                                  @draexler

                                  ohne das klammer auf/zu konnte es nicht funktionieren 😞 - habe die funktion benannt als main und diese wird dann aufgerufen - letzte zeile main();

                                  draexler 1 Reply Last reply Reply Quote 0
                                  • A
                                    andr3 @draexler last edited by

                                    @draexler nur damit ich hier nicht ganz falsch bin: ich möchte mit dem Unifi PROTECT-Adapter Kameras steuern. Das funktioniert bei mir aktuell nur über den Login mit der Emailadresse (in den Adapter-Einstellungen). Wenn ich dort den neu angelegten Local-User eintrage, kann ich keine Zustände mehr steuern 😞

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

                                      @liv-in-sky Hat zwar auf das erste mal nicht funktioniert. Aber wie ich jetzt alles Runtergefahren habe (Proxmox) geht es jetzt auf einmal. Vorher hatte ich zwar auch einmal den iobroker gestoppt, aber das hat anscheinend nicht ausgereicht...

                                      DANKE DIR. Jetzt kann ich mal weiterbasteln.

                                      1 Reply Last reply Reply Quote 0
                                      • Samson71
                                        Samson71 Global Moderator @andr3 last edited by

                                        @andr3 sagte in Adapter: ioBroker.unifi:

                                        mit dem Unifi PROTECT-Adapter Kameras steuern.

                                        Hier geht es nicht um den PROTECT-Adapter. Der hat einen eigenen Thread.

                                        A 1 Reply Last reply Reply Quote 0
                                        • A
                                          andr3 @Samson71 last edited by

                                          @samson71 oh sorry - DANKE! 🙂

                                          draexler 1 Reply Last reply Reply Quote 0
                                          • draexler
                                            draexler @andr3 last edited by

                                            @liv-in-sky Vielleicht kannst du mir hier auch nochmal kurz helfen. Der Voucher wird in den Datenpunkt:

                                            0_userdata.0.Netzwerk.UNIFI.Vouchersteuerung.Vouchercode
                                            

                                            geschrieben.

                                            Wenn ich jetzt die Funktion des löschen verwenden möchte:

                                              revokeVoucher(voucher_id) {
                                                const payload = {cmd: 'delete-voucher',
                                                  _id: voucher_id};
                                            
                                                return this._request('/api/s/<SITE>/cmd/hotspot', payload);
                                              }
                                            

                                            Wie müsste der Code dann aussehen? Also das Gegenstück zu:

                                            const clientVoucher = await unifi.createVouchers(800,1,5,"testthis");
                                            

                                            Wäre super wenn du mir da helfen könntest 🙂

                                            liv-in-sky 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

                                            829
                                            Online

                                            31.7k
                                            Users

                                            79.8k
                                            Topics

                                            1.3m
                                            Posts

                                            16
                                            152
                                            10927
                                            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