Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Hardware
    4. Befehle von Neeo nach ioBroker senden

    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

    Befehle von Neeo nach ioBroker senden

    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      Kusi @UncleSam last edited by Kusi

      @UncleSam das habe ich mir eben auch gedacht und beim zweiten Versuch getestet, aber dann kommt folgender Fehler:

      pi@raspberrypi:~ $ node /home/pi/node_modules/neeo_driver-test
      /home/pi/node_modules/neeo_driver-test/index.js:29
      actualDriverObject.addButtonHandler((buttonName, deviceId) => {
                        ^
      
      SyntaxError: Unexpected token '.'
          at wrapSafe (internal/modules/cjs/loader.js:1053:16)
          at Module._compile (internal/modules/cjs/loader.js:1101:27)
          at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
          at Module.load (internal/modules/cjs/loader.js:985:32)
          at Function.Module._load (internal/modules/cjs/loader.js:878:14)
          at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
          at internal/main/run_main_module.js:17:47
      

      So sieht es jetzt komplett aus:

      "use strict";
      const neeoapi = require("neeo-sdk");
      const http = require("http.min");
      
      let actualDriverObject;
      actualDriverObject = neeoapi.buildDevice("ioBroker"); // change "My first driver" to anything you like but keep the "" characters
      actualDriverObject.setType("ACCESSOIRE"); // can be changed to "ACCESSOIRE" or "AVRECEIVER" or "DVB" or "DVD" or "GAMECONSOLE" or "LIGHT" or "MEDIAPLAYER" or "MUSICPLAYER" or "PROJECTOR" or "TV" or "VOD"
      actualDriverObject.addButton({ name: "button-a", label: "Button A" }); // This makes a new button named button-a, on the remote its shown as Button A
      actualDriverObject.addButton({ name: "button-b", label: "Button B" }); // This makes a new button named button-b, on the remote its shown as Button B
      actualDriverObject.addButton({ name: "button-c", label: "Button C" }); // This makes a new button named button-c, on the remote its shown as Button C
      actualDriverObject.addButton({ name: "button-d", label: "Button D" }); // This makes a new button named button-d, on the remote its shown as Button D
      actualDriverObject.addButton({ name: "button-e", label: "Button E" }); // This makes a new button named button-d, on the remote its shown as Button E
      actualDriverObject.addButton({ name: "button-f", label: "Button F" }); // This makes a new button named button-d, on the remote its shown as Button F
      actualDriverObject.addButton({ name: "button-g", label: "Button G" }); // This makes a new button named button-d, on the remote its shown as Button G
      actualDriverObject.addButton({ name: "button-h", label: "Button H" }); // This makes a new button named button-d, on the remote its shown as Button H
      
      actualDriverObject.addSwitch({ name: 'Schalter', label: 'Schalter' },{
        setter: (deviceId, newValue) => {
          switchState = newValue;
          if (newValue) {
            http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Switch?value=wahr")
          } else {
            http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Switch?value=falsch")
          }
        },
      
      
      // Here is the code that gets executed when a button is pressed.
      actualDriverObject.addButtonHandler((buttonName, deviceId) => {
        console.log(`[CONTROLLER] ${buttonName} button pressed`);
        if (buttonName == "button-a") {
          http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Button?value=A"); //Just sneds a http get, use this to controll devices that supports a http get
        }
        if (buttonName == "button-b") {
          http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Button?value=B");
        }
        if (buttonName == "button-c") {
          http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Button?value=C");
        }
        if (buttonName == "button-d") {
          http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Button?value=D");
        }
        if (buttonName == "button-e") {
          http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Button?value=E");
        }
        if (buttonName == "button-f") {
          http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Button?value=F");
        }
        if (buttonName == "button-g") {
          http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Button?value=G");
        }
        if (buttonName == "button-h") {
          http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Button?value=H");
        }
      });
      
      // change this to set your NEEO brain IP. change 10.2.1.64 to the IP address of your NEEO brain.
      const neeoSettings = {
        brain: "192.168.1.80",
        port: 1104,
        name: "eigeneTasten",
        devices: [actualDriverObject]
      };
      
      ///////////////////////////////////////////////////////////////////////////////////////////////////
      // Do not change the code below this point. ///////////////////////////////////////////////////////
      ///////////////////////////////////////////////////////////////////////////////////////////////////
      
      ///////////////////////////////////////////////////////////////////////////////////////////////////
      // Do not change the code below this point. ///////////////////////////////////////////////////////
      ///////////////////////////////////////////////////////////////////////////////////////////////////
      
      ///////////////////////////////////////////////////////////////////////////////////////////////////
      // Do not change the code below this point. ///////////////////////////////////////////////////////
      ///////////////////////////////////////////////////////////////////////////////////////////////////
      
      ///////////////////////////////////////////////////////////////////////////////////////////////////
      // Do not change the code below this point. ///////////////////////////////////////////////////////
      ///////////////////////////////////////////////////////////////////////////////////////////////////
      neeoapi
        .startServer(neeoSettings)
        .then(() => {
          console.log("# READY! use the NEEO app to search for: " + actualDriverObject.devicename);
          if (actualDriverObject.type == "ACCESSOIRE") {
            console.log("\r\n  ACCESOIRE devices do not have their own recipy slides.");
            console.log("  You need to add the buttons as shortcuts to an existing device slide,");
            console.log("  add a dummy device (search for dummy) and add the buttons as shortcut there or");
            console.log("  change the actualDriverObject.setType line to present this driver as a different device type.");
          }
        })
        .catch(err => {
          console.error("ERROR!", err);
          process.exit(1);
        });
      
      
      1 Reply Last reply Reply Quote 0
      • UncleSam
        UncleSam Developer @mickym last edited by

        @mickym sagte in Befehle von Neeo nach ioBroker senden:

        actualDriverObject.addSwitch({ name: 'Schalter', label: 'Schalter' },{
          setter: (deviceId, newValue) => {
            switchState = newValue;
            http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Switch?value=" + newValue);
          },
          getter: (deviceId) => switchState,})
        
        

        Das hier geht, oder? Wenn du etwas änderst, musst du immer schauen, dass die öffnenden und schliessenden Klammern (rund, geschweift, eckig) übereinstimmen.

        Ergo sollte es IMHO heissen:

        actualDriverObject.addSwitch({ name: 'Schalter', label: 'Schalter' },{
          setter: (deviceId, newValue) => {
            switchState = newValue;
            if (newValue) {
              http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Switch?value=wahr"
            } else {
              http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Switch?value=falsch"
            }
          },
          getter: (deviceId) => switchState,})
        
        K UncleSam 2 Replies Last reply Reply Quote 0
        • K
          Kusi @UncleSam last edited by Kusi

          @UncleSam Gemäss Fehler beim vorherigen Laden des Treibers liegt der Fehler vermutlich an einem anderen Ort?

          Zeilen 28 und 29 von index.js

          // Here is the code that gets executed when a button is pressed.
          actualDriverObject.addButtonHandler((buttonName, deviceId) => {
          
          UncleSam 1 Reply Last reply Reply Quote 0
          • UncleSam
            UncleSam Developer @Kusi last edited by

            @Kusi Wenn Zeichen fehlen auf den vorherigen Zeilen, kann es sehr gut sein, dass der Fehler erst auf der nächsten Code-Zeile "zum Vorschein" kommt.

            K 1 Reply Last reply Reply Quote 0
            • K
              Kusi @UncleSam last edited by Kusi

              @UncleSam Aus meiner Sicht fehlt irgendwo eine schliessende Klammer, denn die Öffnende ist bei

              actualDriverObject.addSwitch(
              

              Woher weis die If-Schleife eigentlich, ob der Wert/Schalter true oder false isch?

              UncleSam 1 Reply Last reply Reply Quote 0
              • UncleSam
                UncleSam Developer @UncleSam last edited by

                @UncleSam sagte in Befehle von Neeo nach ioBroker senden:

                Ergo sollte es IMHO heissen:

                actualDriverObject.addSwitch({ name: 'Schalter', label: 'Schalter' },{
                  setter: (deviceId, newValue) => {
                    switchState = newValue;
                    if (newValue) {
                      http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Switch?value=wahr"
                    } else {
                      http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Switch?value=falsch"
                    }
                  },
                  getter: (deviceId) => switchState,})
                

                Genau. Zeile 10.

                K 1 Reply Last reply Reply Quote 0
                • K
                  Kusi @UncleSam last edited by Kusi

                  @UncleSam Das ist jetzt die Antwort beim Treiber-Start:

                  pi@raspberrypi:~ $ node /home/pi/node_modules/neeo_driver-test
                  /home/pi/node_modules/neeo_driver-test/index.js:25
                        http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Switch?value=wahr"
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  
                  SyntaxError: missing ) after argument list
                      at wrapSafe (internal/modules/cjs/loader.js:1053:16)
                      at Module._compile (internal/modules/cjs/loader.js:1101:27)
                      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
                      at Module.load (internal/modules/cjs/loader.js:985:32)
                      at Function.Module._load (internal/modules/cjs/loader.js:878:14)
                      at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
                      at internal/main/run_main_module.js:17:47
                  
                  

                  Klammer fehlten!

                  1 Reply Last reply Reply Quote 0
                  • UncleSam
                    UncleSam Developer @Kusi last edited by

                    @Kusi sagte in Befehle von Neeo nach ioBroker senden:

                    Woher weis die If-Schleife eigentlich, ob der Wert/Schalter true oder false isch?

                    if (newValue) überprüft den übergebenen neuen Wert, wenn der true (oder etwas ähnliches) ist, wird das erste ausgeführt, sonst das zweite.

                    1 Reply Last reply Reply Quote 0
                    • UncleSam
                      UncleSam Developer last edited by

                      Sorry, falsches korrigiert:

                      actualDriverObject.addSwitch({ name: 'Schalter', label: 'Schalter' },{
                        setter: (deviceId, newValue) => {
                          switchState = newValue;
                          if (newValue) {
                            http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Switch?value=wahr");
                          } else {
                            http("http://192.168.1.15:8087/set/javascript.0.Eigene_Datenpunkte.Neeo-Switch?value=falsch");
                          }
                        },
                        getter: (deviceId) => switchState,})
                      
                      K 1 Reply Last reply Reply Quote 0
                      • K
                        Kusi @UncleSam last edited by

                        @UncleSam Wie beende ich denn jetzt den Treiber, ohne dass ich den Raspi neu starten muss??

                        pi@raspberrypi:~ $ node /home/pi/node_modules/neeo_driver-test
                        # READY! use the NEEO app to search for: ioBroker
                        
                          ACCESOIRE devices do not have their own recipy slides.
                          You need to add the buttons as shortcuts to an existing device slide,
                          add a dummy device (search for dummy) and add the buttons as shortcut there or
                          change the actualDriverObject.setType line to present this driver as a different device type.
                        
                        UncleSam 1 Reply Last reply Reply Quote 0
                        • UncleSam
                          UncleSam Developer @Kusi last edited by

                          @Kusi Ctrl-C in dem Putty-Fenster in dem der driver läuft.

                          K 2 Replies Last reply Reply Quote 0
                          • K
                            Kusi @UncleSam last edited by

                            @UncleSam sagte in Befehle von Neeo nach ioBroker senden:

                            @Kusi Ctrl-C in dem Putty-Fenster in dem der driver läuft.

                            Danke.

                            Laden des Treibers funktioniert, jedoch ändert der DP nicht.

                            1 Reply Last reply Reply Quote 0
                            • K
                              Kusi @UncleSam last edited by

                              @UncleSam sagte in Befehle von Neeo nach ioBroker senden:

                              @Kusi Ctrl-C in dem Putty-Fenster in dem der driver läuft.

                              Gibt es auch eine Möglichkeit den Treiber zu stoppen, wenn dieser als Java aus ioBroker gestartet wird?

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

                              Support us

                              ioBroker
                              Community Adapters
                              Donate

                              423
                              Online

                              31.8k
                              Users

                              79.9k
                              Topics

                              1.3m
                              Posts

                              neeo
                              3
                              62
                              3052
                              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