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.
    • liv-in-sky
      liv-in-sky @Adnim last edited by

      @adnim

      kannst du mal dieses kleine script testen

      const Unifi = require('node-unifi');
       
      const unifi22 = new Unifi.Controller({hostname:"192.168.168.xxx",port:'8443', sslverify: false});
       
      async function main() {
       try {
         // LOGIN
         const loginData = await unifi22 .login('x', 'xxxxxx');
         console.log('login: ' + loginData);
       
      const myVouchers = await unifi22 .getVouchers();
         console.log("vouchers: "+ JSON.stringify(myVouchers))
      
         // LOGOUT
         const logoutData = await unifi22 .logout();
         console.log('logout: ' + JSON.stringify(logoutData));
       } catch (error) {
         console.log('ERROR: ' + error);
       }
      }
      
      main();
      

      zeile 3 und 8 anpassen

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

        @liv-in-sky sagte in Adapter: ioBroker.unifi:

        hast du node-unifi im setting der javascript instanz drin ?

        @Adnim ich frage, da es irgenein thema gab mit älteren javascript adaptern - ich habe die neuste latest (8.4.2) installiert, ansonsten konnte ich es nicht eingeben in der instanz

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

          @liv-in-sky sagte in Adapter: ioBroker.unifi:

          @adnim habe ich auch 5.0.19 und auch node 20

          ja genauso ist es hier auch

          irgendwie kann ich bei diesen fehlern nicht richtig nachvollziehen, an welcher stelle das script aussteigt - wenn getriggert wird, ist ja erstmal ein log - das kommt garnicht ?

          nee mehr kommt nicht

          dann müßte es ja schon vorher was passieren - hast du node-unifi im setting der javascript instanz drin ?

          ja , mache es mal raus und wieder rein

          mit dem kleinen skript sieht das so aus im log

          
          javascript.0
          2024-06-02 08:54:51.441	info	Stopping script script.js.common.unifitest
          
          javascript.0
          2024-06-02 08:54:45.918	info	script.js.common.unifitest: ERROR: Error: getaddrinfo ENOTFOUND unifi
          
          javascript.0
          2024-06-02 08:54:45.915	info	script.js.common.unifitest: registered 0 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
          
          javascript.0
          2024-06-02 08:54:45.897	info	Start JavaScript script.js.common.unifitest (Javascript/js)
          

          edit: nee auch node-unifi raus und Instanz speichern Neu starten und wieder rein machen ändert bei beiden Skripten nichts

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

            @liv-in-sky sagte in Adapter: ioBroker.unifi:

            @Adnim ich frage, da es irgenein thema gab mit älteren javascript adaptern - ich habe die neuste latest (8.4.2) installiert, ansonsten konnte ich es nicht eingeben in der instanz

            Version 8.4.2 node: v20.14.0, js-controller: 5.0.19

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

              @adnim schaut echt nach einem problem mit der node-unifi aus - kannst du sie im filesystem finden bzw mal iob stop, iob fix aufrufen

              scheint vom adapter zu kommen /opt/iobroker/node-modules/node-unifi
              müßte zusatzmodul sein : /opt/iobroker/node-modules/iobroker.javascript/node-unifi

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

                @haus-automatisierung

                könntest du uns evtl helfen - wir versuchen einer verbindung zum unifi-controller herzustellen - bei mir gibt das kein problem - 2 user haben aber eines
                node-unifi ist als zusätzliches module drin (obwohl auch der unifi adapter das modul installiert hat

                dieses script soll laufen: https://forum.iobroker.net/post/1165996

                const Unifi = require('node-unifi');
                 
                const unifi22 = new Unifi.Controller({hostname:"192.168.168.xxx",port:'8443', sslverify: false});
                 
                async function main() {
                 try {
                   // LOGIN
                   const loginData = await unifi22 .login('x', 'xxxxxx');
                   console.log('login: ' + loginData);
                 
                const myVouchers = await unifi22 .getVouchers();
                   console.log("vouchers: "+ JSON.stringify(myVouchers))
                 
                   // LOGOUT
                   const logoutData = await unifi22 .logout();
                   console.log('logout: ' + JSON.stringify(logoutData));
                 } catch (error) {
                   console.log('ERROR: ' + error);
                 }
                }
                 
                main();
                
                

                hier der fehler - mit dem ich einfach nix anfangen kann https://forum.iobroker.net/post/1166000

                javascript.0
                2024-06-02 08:54:51.441	info	Stopping script script.js.common.unifitest
                 
                javascript.0
                2024-06-02 08:54:45.918	info	script.js.common.unifitest: ERROR: Error: getaddrinfo ENOTFOUND unifi
                 
                javascript.0
                2024-06-02 08:54:45.915	info	script.js.common.unifitest: registered 0 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
                 
                javascript.0
                2024-06-02 08:54:45.897	info	Start JavaScript script.js.common.unifitest (Javascript/js)
                

                der fehler kommt, wenn man den trigger setzt - aber das erste log im trigger kommt schon nicht - irgendeine idee ?

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

                  @liv-in-sky
                  ja das Modul ist im File System zu sehen. Den fixer hab ich mal laufen lassen ändert aber nichts an den Fehlermeldungen.

                  liv-in-sky 1 Reply Last reply Reply Quote 0
                  • haus-automatisierung
                    haus-automatisierung Developer Most Active @liv-in-sky last edited by

                    @liv-in-sky Kann ich mir frühestens morgen Vormittag ansehen

                    1 Reply Last reply Reply Quote 2
                    • kmxak
                      kmxak Most Active last edited by kmxak

                      ich hatte das script die log meldungen auf debug gestellt. wenn die kommen sollen den js adapter auf debug stellen. Man könnte ja die letzte nehmen wenn es mit i.O durchgelaufen ist als info aber mir waren es so zu viele.

                      Wifi Operator ist die Admin Rolle im Unifi User Managment.
                      Dazu habe ich mal die Readme angepasst.

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        Adnim @kmxak last edited by

                        @kmxak sagte in Adapter: ioBroker.unifi:

                        ch hatte das script die log meldungen auf debug gestellt. wenn die kommen sollen den js adapter auf debug stellen.

                        javascript.0
                        2024-06-02 09:47:45.323	error	script.js.common.unifivoucher: ERROR: TypeError: Cannot read properties of undefined (reading '0')
                        
                        javascript.0
                        2024-06-02 09:47:45.323	debug	script.js.common.unifivoucher: Voucher erstellt: undefined
                        
                        javascript.0
                        2024-06-02 09:47:45.323	error	script.js.common.unifivoucher: Fehler beim Logout: Error: getaddrinfo ENOTFOUND unifi
                        
                        javascript.0
                        2024-06-02 09:47:45.316	debug	script.js.common.unifivoucher: Logout bei UniFi...
                        
                        javascript.0
                        2024-06-02 09:47:45.316	debug	script.js.common.unifivoucher: Fehler beim Anlegen: Error: getaddrinfo ENOTFOUND unifi
                        
                        javascript.0
                        2024-06-02 09:47:45.303	debug	script.js.common.unifivoucher: Trigger aktiviert, erstelle neuen Voucher...
                        
                        javascript.0
                        2024-06-02 09:47:45.303	error	script.js.common.unifivoucher: ERROR: Error: getaddrinfo ENOTFOUND unifi
                        
                        javascript.0
                        2024-06-02 09:47:45.234	debug	script.js.common.unifivoucher: Versuche, mich bei UniFi anzumelden...
                        
                        javascript.0
                        2024-06-02 09:47:45.234	debug	script.js.common.unifivoucher: Trigger-Datenpunkt geändert: true
                        
                        1 Reply Last reply Reply Quote 0
                        • kmxak
                          kmxak Most Active last edited by

                          für mich deutet das

                          javascript.0
                          2024-06-02 08:54:45.918	info	script.js.common.unifitest: ERROR: Error: getaddrinfo ENOTFOUND unifi
                          

                          auf ein verbindungsproblem hin.

                          IP und Passwort sowie port richtig eingegeben? Bzw kann der Unifi Adapter falls installiert drauf zugreifen?

                          A 1 Reply Last reply Reply Quote 0
                          • A
                            Adnim @kmxak last edited by Adnim

                            @kmxak sagte in Adapter: ioBroker.unifi:

                            IP und Passwort sowie port richtig eingegeben?

                            nochmal geprüft , definitiv richtig

                            Bzw kann der Unifi Adapter falls installiert drauf zugreifen?

                            Der läuft und ich sehe die vouchers mit ihm, kann halt keine neuen erstellen.

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

                              @adnim

                              bei deinem neuen log fehlt der login - hast du besondere zeichen im password ?

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

                                @liv-in-sky sagte in Adapter: ioBroker.unifi:

                                bei deinem neuen log fehlt der login - hast du besondere zeichen im password ?

                                Nee habe mit meinem Admin Acount und dem extra angelegten hotspot Acount versucht PW ist nur eine normale Zahl

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

                                  @adnim hast du https beim controller ?

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

                                    @liv-in-sky sagte in Adapter: ioBroker.unifi:

                                    hast du https beim controller ?

                                    Hmm bei der Frage komm ich ins schwimmen 🙂

                                    würde sagen ja. Die Controller UI rufe ich jedenfalls mit HTTPS auf ja.

                                    Wo könnte ich das checken bzw. ändern?

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

                                      @adnim das müsste bedeuten, dass du auch die node-unifi mit https nutzen müßtest - im setting des controllers müßte das sichtbar sein

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

                                        @adnim

                                        versuche mal im setting das auf true zu setzen

                                           sslverify: false
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • A
                                          Adnim @liv-in-sky last edited by

                                          @liv-in-sky sagte in Adapter: ioBroker.unifi:

                                          • im setting des controllers müßte das sichtbar sein

                                          ja aber wo, die einstellungen sind ja schon etwas umfangreicher 🙂

                                          ihr habt das ohne https? dann wäre das ja schon mal ein unterschied.

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

                                            @adnim

                                            du kannst aber auch mal mit port 433 und kombinationen mit sslverify "rumspielen"

                                            const config = {
                                                hostname: "192.168.178.xxx",
                                                port: '8443', // 443 UDM Pro, 8443 für andere Controller
                                                username: 'xx',
                                                password: 'xxxxx!',
                                               sslverify: true
                                            
                                            A 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

                                            736
                                            Online

                                            31.7k
                                            Users

                                            79.8k
                                            Topics

                                            1.3m
                                            Posts

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