Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. Aqara Cube Skript - Bitte um Hilfe

    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

    Aqara Cube Skript - Bitte um Hilfe

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

      Sorry, wenn ich hier blöd um die Ecke komme, aber ich habe von JavaSkript keine Ahnung. Trotzdem schaffe ich es manchmal aus bestehenden Skripten mir etwas für mich per Copy&Paste zusammen zu striken.

      Aktuell sitze ich aber an einem Problem wo ich nicht weiter komme. Ich habe den Aqara Cube so "programmiert", das ich damit meine gesamte Gartenbeleuchtung steuern kann - so der Plan.

      In dem einen Skript, wo ich gegenüber dem Ursprung nur 2 Zeilen geändert habe, funktioniert das umschalten der States.

      Das ist das hier - es geht hier um das state "Terrasse". Bei diesem Skript schaltet das State Terasse.

      2020-04-27 08_22_41-javascript - ioBroker.png

      /*
      Aqara Cube Skript
      Events: 
      {1}
      90 Grad
      180 Grad
      schieben
      hochwerfen & auffangen
      schütteln
      Taptap
      drehen 
      {1}
      */
       
      var CubeS = "deconz.0.Sensors.23.buttonevent", // Cube Switch
      	CubeR = "deconz.0.Sensors.24.buttonevent", // Cube Rotate
          switchVal,
          degree,
          elements = [],
          elementsInt= [],
          debug;
         
         
      // Sleep Funktion Experimental
      function sleep(milliseconds) {
      	var start = new Date().getTime();
      	for (var i = 0; i < 1e7; i++) {
      		if ((new Date().getTime() - start) > milliseconds){
      			break;
      		}
      	}
      }
       
       debug = 1; // DEBUG MODE: 0 = Aus, 1 = Aktionen anzeigen, 2 = Alles anzeigen
       
       
      on({id: CubeS, change: "any"}, function (obj) { 
       
           
           
          // Objekt in String wandeln, doppel Null entfernen und ergebnisse in Array elements schreiben.
      	switchVal = JSON.stringify(getState(CubeS).val);
      	elements = switchVal.split("00");
      	// Elemente des Arrays in Integerwerte konvertieren
      	for(var i=0; i<elements.length;i++) elementsInt[i] = parseInt(elements[i], 10);
           
          if (debug >= 2) { 
      	console.log("Original: " + getState(CubeS).val + " Element 1: " + elements[0] + " Element 2: " + elements[1]);
          }
      	var total = elementsInt[0] + elementsInt [1];
          if (debug >= 2) { 
      	console.log("Total: " + total);
          }
       
      	if (( elementsInt[0] + elementsInt [1] == 7 ) && ( elementsInt [1] !== 0 )) {
             if (debug ==  1) { 
      		console.log("180 Grad" + " Seite: " + elementsInt[0] + " liegt unten.");
             }
      	setState("sonoff.0.Garten_4CH_No1.POWER1"/*Terrasse*/, true);
              
             // sleep(550);
             
      	} else if ( elementsInt[0] + elementsInt [1] == 14) {
             if (debug ==  1) { 
      		console.log("Geschüttelt");
             }
      		setState("alexa2.0.Echo-Devices.G090U61091855EMG.Player.controlPause"/*Pause*/, true);
      	}
      	else if ( elementsInt[0] + elementsInt [1] == 15) {
      		sleep(0);
              if (debug ==  1) { 
      		console.log("Geworfen");
              }
      	if (getState("alexa2.0.Echo-Devices.G090U61091855EMG.Player.controlPlay"/*Main Zone Power State*/).val === false) {
             
      		setState("alexa2.0.Echo-Devices.G090U61091855EMG.Player.controlPlay"/*Main Zone Power State*/,true);
             
             
      	}
      	else {
                 
      		setState("alexa2.0.Echo-Devices.G090U61091855EMG.online"/*Main Zone Power State*/,false);
      	}
             
      }
      else if ( elementsInt[0] == elementsInt [1] )  {
             if (debug ==  1) { 
      	console.log("TapTap" + " Seite: " + elementsInt[0] + " liegt unten.");
             }
      	setState("alexa2.0.Echo-Devices.G090U61091855EMG.Player.controlPause"/*Play/Pause*/, true);
             
             
      }
      else if (( elementsInt [1] === 0 ) && ( elementsInt [0] <= 6 )) {
             if (debug ==  1) { 
      	console.log("Schieben" + " Seite: " + elementsInt[0] + " liegt unten." );
             }
          setState("sonoff.0.Garten_4CH_No1.POWER1"/*Terrasse*/, false);
              
      }
      else if (( elementsInt [1] === 0 ) && ( elementsInt [0] <= 7 )) {
          if (debug ==  1) { 
          console.log("Cube Wakeup!");
          }
      }
      else if ( elementsInt [0] <= 3 ) {
             if (debug ==  1) { 
      	console.log("90 Grad" + " Seite: " + elementsInt[0] + " liegt unten.");
             }
      	setState("sonoff.0.Garten_4CH_No1.POWER1"/*Terrasse*/, true);
             
      }
         
         
       
           
      });
       
      on({id: CubeR, change: "ne"}, function (obj) { // nur bei änderung Triggern "ne" not equal
              
              
      var rotationVal = JSON.stringify(getState(CubeR).val); // Objekt in String konvertieren
       
         
               
      // Schauen ob rotationVal negativ/positiv ist und nur die ersten beiden bzw. drei ziffern verwenden.
      if ( rotationVal.substr(0,1) == "-" ) {
                  
      	if (rotationVal.length == 6 ) {
      		degree = rotationVal.substr(0,4);
                      
      	}
      	else {
      		degree = rotationVal.substr(0,3);
                  
      	}
                  
      }
      else {
                  
      	if (rotationVal.length == 5 ) {
      		degree = rotationVal.substr(0,3);
                      
      	}
      	else {
      		degree = rotationVal.substr(0,2);
      	}
                  
            
      }
              
              
             if (debug ==  1) {  
      console.log("gedreht: " + degree);
             }
      // Volume auslesen
      var aMainVol = parseInt(getState("alexa2.0.Echo-Devices.G090U61091855EMG.Player.volume"/*Main Volume*/).val);
              
      // Neues Volumen errechnen
      if (debug >= 2) { 
      console.log("Ergebnis: " + parseInt(degree) / 5);
      }
      if (parseInt(degree)  > 60) {
          if (debug >= 2) {
          console.log("Vol unterschied zu hoch, angepasst!");
          }
          degree = 60;
         
          
      }
       
      var newMainVol = (degree / 5) + aMainVol;
      if (debug >= 2) {
      console.log("Vol unterschied: " + (parseInt(degree) / 5));
      console.log("mainvol: " + aMainVol + " newMainVol: " + newMainVol);
      }
      // Neues Volumen an EchoDot senden
      setState("alexa2.0.Echo-Devices.G090U61091855EMG.Player.volume", newMainVol);
              
      });
      

      Weil das so prima funktionierte, habe ich das ganze Skript umgeschrieben und mit meinen Funktionen belegt.

      Das sieht dann so aus - Bitte den unterschiedlichen Aktionen, die für die Ausführung da sind, erstmal keine Bedeutung beimessen. Obwohl das hier genauso aussieht wie das obere, schaltet hier das state Terrasse nicht.

      2020-04-27 08_25_28-javascript - ioBroker.png

      /*
      Aqara Cube Skript
      Events: 
      {1}
      90 Grad
      180 Grad
      schieben
      hochwerfen & auffangen
      schütteln
      Taptap
      drehen 
      {1}
      */
       
      var CubeS = "deconz.0.Sensors.23.buttonevent", // Cube Switch
      	CubeR = "deconz.0.Sensors.24.buttonevent", // Cube Rotate
          switchVal,
          degree,
          elements = [],
          elementsInt= [],
          debug;
         
         
      // Sleep Funktion Experimental
      function sleep(milliseconds) {
      	var start = new Date().getTime();
      	for (var i = 0; i < 1e7; i++) {
      		if ((new Date().getTime() - start) > milliseconds){
      			break;
      		}
      	}
      }
       
       debug = 2; // DEBUG MODE: 0 = Aus, 1 = Aktionen anzeigen, 2 = Alles anzeigen
       
       
      on({id: CubeS, change: "any"}, function (obj) { 
       
           
           
          // Objekt in String wandeln, doppel Null entfernen und ergebnisse in Array elements schreiben.
      	switchVal = JSON.stringify(getState(CubeS).val);
      	elements = switchVal.split("00");
      	// Elemente des Arrays in Integerwerte konvertieren
      	for(var i=0; i<elements.length;i++) elementsInt[i] = parseInt(elements[i], 10);
           
          if (debug >= 2) { 
      	console.log("Original: " + getState(CubeS).val + " Element 1: " + elements[0] + " Element 2: " + elements[1]);
          }
      	var total = elementsInt[0] + elementsInt [1];
          if (debug >= 2) { 
      	console.log("Total: " + total);
          }
          //180Grad
          
      	//if (( elementsInt[0] + elementsInt [1] == 7 ) && ( elementsInt [1] !== 0 )) {
          //if (debug ==  1) { 
      	//console.log("180 Grad" + " Seite: " + elementsInt[0] + " liegt oben.");
          //}
      	//setState("deconz.0.Lights.1.on"/*Schreibtischlampe*/, true);
          //}
      	//sleep(550);
          
          //Geschüttelt
        
          else if ( elementsInt[0] + elementsInt [1] == 14) {
             if (debug ==  1) { 
      		console.log("Geschüttelt");
             }
      	setState("alexa2.0.Smart-Home-Devices.3d19d4d8-8a84-4bbf-bc28-25e56f2a833a.powerState"/*Alles AUS*/, true);
      }    
      
          //Geworfen 
      
      
          else if ( elementsInt[0] + elementsInt [1] == 15) {
      		sleep(0);
              if (debug ==  1) { 
      		console.log("Geworfen");
              }
      	setState("sonoff.0.Garten_S55_3.POWER"/*SteckdoseOST*/, false);
      }
      
      //TapTap       
      
      else if ( elementsInt[0] + elementsInt [1] == 4)  {
             if (debug ==  1) { 
      	console.log("TapTap" + " Seite: " + elementsInt[0] + " liegt oben.");
             }
      	setState("sonoff.0.Garten_4CH_No2.POWER1"/*Wasserfall*/, false);
          setState("sonoff.0.Garten_4CH_No2.POWER2"/*Glassteine*/, false);
      }
      else if ( elementsInt[0] + elementsInt [1] == 6)  {
             if (debug ==  1) { 
      	console.log("TapTap" + " Seite: " + elementsInt[0] + " liegt oben.");
             }
      	setState("sonoff.0.Garten_4CH_No1.POWER2"/*GabionePool*/, false);
          setState("sonoff.0.Garten_S55_1.POWER"/*PoolSteckdose*/, false);
      }
      else if ( elementsInt[0] + elementsInt [1] == 8)  {
             if (debug ==  1) { 
      	console.log("TapTap" + " Seite: " + elementsInt[0] + " liegt oben.");
             }
      	setState("sonoff.0.Garten_4CH_No2.POWER3"/*Pflanzkoerbe*/, false);
          setState("deconz.0.Lights.1.on"/*SteckdosePflanzkoerbe*/, false);
      } 
      else if ( elementsInt[0] + elementsInt [1] == 10)  {
             if (debug ==  1) { 
      	console.log("TapTap" + " Seite: " + elementsInt[0] + " liegt unten.");
             }
      	setState("sonoff.0.Garten_4CH_No1.POWER3"/*50Prozent*/, false);
      }
      else if ( elementsInt[0] + elementsInt [1] == 12)  {
             if (debug ==  1) { 
      	console.log("TapTap" + " Seite: " + elementsInt[0] + " liegt unten.");
             }
      	setState("sonoff.0.Garten_4CH_No1.POWER4"/*100Prozent*/, false);
      }
      else if ( elementsInt[0] + elementsInt [1] == 2)  {
             if (debug ==  1) { 
      	console.log("TapTap" + " Seite: " + elementsInt[0] + " liegt unten.");
             }
          setState("sonoff.0.Garten_4CH_No1.POWER1"/*Terrasse*/, true);
      }
      
      //Schieben      
      
      else if (( elementsInt [1] === 0 ) && ( elementsInt [0] <= 2 )) {
             if (debug ==  1) { 
      	console.log("Schieben" + " Seite: " + elementsInt[0] + " liegt unten." );
             }
          setState("sonoff.0.Garten_4CH_No2.POWER2"/*Glassteine*/, true);
      }
      else if (( elementsInt [1] === 0 ) && ( elementsInt [0] <= 3 )) {
             if (debug ==  1) { 
      	console.log("Schieben" + " Seite: " + elementsInt[0] + " liegt unten." );
             }
          setState("sonoff.0.Garten_S55_1.POWER"/*PoolSteckdose*/, true);
      }
      else if (( elementsInt [1] === 0 ) && ( elementsInt [0] = 4 )) {
             if (debug ==  1) { 
      	console.log("Schieben" + " Seite: " + elementsInt[0] + " liegt unten." );
             }
          setState("deconz.0.Lights.1.on"/*SteckdosePflanzkoerbe*/, true);
      }
      else if (( elementsInt [1] === 0 ) && ( elementsInt [0] <= 6 )) {
             if (debug ==  1) { 
      	console.log("Schieben" + " Seite: " + elementsInt[0] + " liegt unten." );
             }
          setState("sonoff.0.Garten_S55_3.POWER"/*SteckdoseOST*/, true);
      }
      
      //Aufwachen
      
      else if (( elementsInt [1] === 0 ) && ( elementsInt [0] <= 7 )) {
          if (debug ==  1) { 
          console.log("Cube Wakeup!");
          }
      
      //90Grad
      
      
      else if ( elementsInt [0] = 4 ) {
             if (debug ==  1) { 
      	console.log("90 Grad" + " Seite: " + elementsInt[0] + " liegt unten.");
             }
      	setState("sonoff.0.Garten_4CH_No1.POWER2"/*GabionePool*/, true);
             
      }   
      else if ( elementsInt [0] = 5 ) {
             if (debug ==  1) { 
      	console.log("90 Grad" + " Seite: " + elementsInt[0] + " liegt unten.");
             }
      	setState("sonoff.0.Garten_4CH_No2.POWER3"/*Pflanzkoerbe*/, true);
             
      }   
      else if ( elementsInt [0] = 6 ) {
             if (debug ==  1) { 
      	console.log("90 Grad" + " Seite: " + elementsInt[0] + " liegt unten.");
             }
      	setState("sonoff.0.Garten_4CH_No1.POWER3"/*50Prozent*/, true);
             
      } 
      else if ( elementsInt [0] = 11 ) {
             if (debug ==  1) { 
      	console.log("90 Grad" + " Seite: " + elementsInt[0] + " liegt unten.");
             }
      	setState("sonoff.0.Garten_4CH_No1.POWER4"/*100Prozent*/, true);
             
      }
      else if ( elementsInt [0] = 2 ) {
             if (debug ==  1) { 
      	console.log("90 Grad" + " Seite: " + elementsInt[0] + " liegt unten.");
             }
      	setState("sonoff.0.Garten_4CH_No1.POWER1"/*Terrasse*/, true);
             
      }
      else if ( elementsInt [0] = 3 ) {
             if (debug ==  1) { 
      	console.log("90 Grad" + " Seite: " + elementsInt[0] + " liegt unten.");
             }
      	setState("sonoff.0.Garten_4CH_No2.POWER1"/*Wasserfall*/, true);}
             
      }
      
      });
       
      on({id: CubeR, change: "ne"}, function (obj) { // nur bei änderung Triggern "ne" not equal
              
              
      var rotationVal = JSON.stringify(getState(CubeR).val); // Objekt in String konvertieren
       
         
               
      // Schauen ob rotationVal negativ/positiv ist und nur die ersten beiden bzw. drei ziffern verwenden.
      if ( rotationVal.substr(0,1) == "-" ) {
                  
      	if (rotationVal.length == 6 ) {
      		degree = rotationVal.substr(0,4);
                      
      	}
      	else {
      		degree = rotationVal.substr(0,3);
                  
      	}
                  
      }
      else {
                  
      	if (rotationVal.length == 5 ) {
      		degree = rotationVal.substr(0,3);
                      
      	}
      	else {
      		degree = rotationVal.substr(0,2);
      	}
                  
            
      }
              
              
             if (debug ==  1) {  
      console.log("gedreht: " + degree);
             }
      // Volume auslesen
      var aMainVol = parseInt(getState("alexa2.0.Echo-Devices.G090U61091855EMG.Player.volume"/*Main Volume*/).val);
              
      // Neues Volumen errechnen
      if (debug >= 2) { 
      console.log("Ergebnis: " + parseInt(degree) / 5);
      }
      if (parseInt(degree)  > 60) {
          if (debug >= 2) {
          console.log("Vol unterschied zu hoch, angepasst!");
          }
          degree = 60;
         
          
      }
       
      var newMainVol = (degree / 5) + aMainVol;
      if (debug >= 2) {
      console.log("Vol unterschied: " + (parseInt(degree) / 5));
      console.log("mainvol: " + aMainVol + " newMainVol: " + newMainVol);
      }
      // Neues Volumen an EchoDot senden
      setState("alexa2.0.Echo-Devices.G090U61091855EMG.Player.volume", newMainVol);
      });
      

      Das obere Skript schaltet das state "Terrasse", das untere nicht. Ich habe schon alles Zeile für Zeile verglichen, aber ich kann für MICH keinen Fehler sehen - wobei das ja nix heißen muss, weil ich eh keine Ahnung von JavaSkript habe (Haben diese Baumstrukturen auch irgend eine Bewandniss?)

      Wäre echt nett wenn mal jemand mit mehr Ahnung kurz über das untere Skript rüber gucken und mir ggf. einen Hinweis auf meinen Fehler gegen könnte.

      Vielen Dank.

      Asgothian Mic paul53 3 Replies Last reply Reply Quote 0
      • Asgothian
        Asgothian Developer @JB_Sullivan last edited by

        @JB_Sullivan
        Das sieht zwar ähnlich aus, aber nicht gleich.

        Erst einmal ein paar Grundlagen

        der Datenpunkt liefert eine 4stellige Zahl, z.Bsp. 2005. Dieser wird zerlegt, und findet sich in dem Array "elementsInt" wieder (also in diesem Beispiel { 2, 5 }) Über die Indizierung wird darauf zugegriffen. elementsInt[0] ist in dem Beispiel 2, elementsInt[1] wäre 5.

        Nun zu den beiden Abfragen im Detail

        Im ersten Beispiel wird geschaut ob elementsInt[0] kleiner als 3 ist.
        Im zweiten Beispiel wird geschaut ob die Summe aus elementsInt[0] und elementsInt[1] genau 2 ist.

        Die Zahl 1001 im Datenpunkt löst beide Beispiele aus.
        Die Zahl 1006 im Datenpunkt löst nur das erste Beispiel aus.

        A.

        JB_Sullivan 1 Reply Last reply Reply Quote 0
        • JB_Sullivan
          JB_Sullivan @Asgothian last edited by JB_Sullivan

          @Asgothian

          Also ich denke das mit dem zerlegen der Zahlen habe ich soweit verstanden. Darauf basiert ja auch mein unteres Skript.

          Was halt hier ein bisschen unglücklich für die Fragestellung ist, sind die beiden Screenshots.

          Ich weiß das anhand der Werte Tabelle unterschiedliche Zahlen für unterschiedliche Aktionen (schieben, TapTap, 90° usw.) erzeugt und dann durch das Skript auf "einer" Stellen reduziert werden.

          Ich denke, das ist nicht mein Problem, das habe ich gedanklich im Griff und auch den Würfel habe ich entsprechend beschriftet, das ich genau weiß welche Zahlenseite getriggert wird.

          Außerdem habe ich im Skript ja Debug=2 gesetzt, was mir genau zeigt welche Aktion jetzt ausgelöst wird.

          Das passt alles 100%ig - ABER, obwohl es passt, wird das ändern des states von dem Datenpunkt NICHT ausgeführt - im ersten Skript aber schon.

          Das ist das was ich nicht verstehe, denn die Programmzeilen sehen FÜR MICH gleich aus.

          Da kann doch nur eine Klammer, oder ein IF oder eine ELSE nicht richtig gesetzt sein.
          Allerdings bekomme ich das nicht alleine heraus.

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

            @JB_Sullivan
            Ich muss nochmal fragen - die debug ausgaben kommen in beiden Skripten ?

            A.

            JB_Sullivan 1 Reply Last reply Reply Quote 0
            • JB_Sullivan
              JB_Sullivan @Asgothian last edited by JB_Sullivan

              @Asgothian

              Ja, kommen in beiden Skripten, aber das jeweilige State schaltet im unteren nicht.
              2020-04-27 21_17_50-.png

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

                @JB_Sullivan sagte in Aqara Cube Skript - Bitte um Hilfe:

                Aktuell sitze ich aber an einem Problem wo ich nicht weiter komme. Ich habe den Aqara Cube so "programmiert", das ich damit meine gesamte Gartenbeleuchtung steuern kann - so der Plan.

                Also "Gott" spielen im Garten 😎 ☺

                Auf den ersten Blick ist der Quellcode schwer zu lesen, da u.a. die if..else Einrückungen und Formatierungen nicht der Konvention entsprechen, siehe z.B. https://javascript.info/coding-style

                Ich behelfe mir da immer im JS-Adapter mit zusätzlichen log-Ausgaben, gerade vor und nach der Problemstelle, also z.B. log('Bin jetzt innerhalb dem else von XXXX) + zusätzlich ggf. Variableninhalte ausgeben. Dann sehe ich sofort, ob das Script jemals wirklich ins "else" geht, etc.
                Leider gibt es keine Anbindung an VS Code, da wäre es deutlich einfacher...

                1 Reply Last reply Reply Quote 0
                • paul53
                  paul53 @JB_Sullivan last edited by paul53

                  @JB_Sullivan sagte:

                  else if ( elementsInt [0] = 4 ) {

                  Ein einfaches Gleichheitszeichen ist eine Zuweisung und kein Vergleich. Ersetze ab Zeile 163 (und in Zeile 140) die Zuweisungen durch Vergleiche.

                  else if ( elementsInt [0] == 4 ) {
                  
                  JB_Sullivan 1 Reply Last reply Reply Quote 0
                  • JB_Sullivan
                    JB_Sullivan @paul53 last edited by

                    @paul53
                    Habe ich gemacht, funktioniert trotzdem nicht.

                    Ich habe auch wie an andere Stelle <= ausprobiert - geht auch nicht.

                    2020-04-27 21_56_16-.png

                    1 Reply Last reply Reply Quote 0
                    • JB_Sullivan
                      JB_Sullivan last edited by

                      Also ich glaube ich habe den Hauptfehler gefunden. Kann es sein, das so eine Java Skript verknüpfung immer mit IF beginnen und alle weiteren mit ELSE IF weitergeführt werden muss?

                      Nachdem ich das geändert habe, reagieren zumindest einige Aktoren (noch nicht alle) auf die Bewegung des Würfel.

                      2020-05-01 09_14_28-javascript - ioBroker.png

                      1 Reply Last reply Reply Quote 0
                      • JB_Sullivan
                        JB_Sullivan last edited by JB_Sullivan

                        Da ich mir nach wie vor einen Wolf gesucht habe, habe ich JavaSkript verworfen und alles in Blockly gemacht. Hat die Halbe Zeit von dem gedauert, was ich in JavaSkript am Fehler suchen war.

                        Jetzt bin ich der "Gott über meine Garten Elektrik" - und alles mit einem Würfel 😇 😇 😂 😂 😂 😂

                        2020-05-01 15_12_57-Microsoft Excel - Mappe2.png

                        IMG_20200502_081708.jpg

                        C 2 Replies Last reply Reply Quote 0
                        • C
                          claus1993 @JB_Sullivan last edited by

                          @JB_Sullivan
                          Habe auch noch drei Aquara Cubes hier rumliegen und bin noch am überlegen was ich damit mache und vor allem wie ich das mache. Habe die Cubes mit dem Conbee Stick eingebunden und blicke noch nicht so ganz welcher Datenpunkt was bedeutet. Könntest du deinen Blockly hier teilen damit ich mal sehen kann wie du die einzelnen Werte auswertest?

                          Danke und Grüße 🙂

                          JB_Sullivan 1 Reply Last reply Reply Quote 0
                          • JB_Sullivan
                            JB_Sullivan @claus1993 last edited by JB_Sullivan

                            @claus1993
                            Die Codes für die einzelnen Aktionen die ich verwende, stehen ja schon alle oben in dem Excel Dokument (Spalte Code).

                            Was mir persönlich aber sehr den Einstieg in das Thema Cube erleichtert hat, war der Link von dem User @Jey-Cee. Ich betreibe meine Zigbee Geräte auch an einem deconz2 Stick mit dem entsprechenden ioB Adapter

                            https://github.com/dresden-elektronik/deconz-rest-plugin/issues/138#issuecomment-325101635

                            Hier trotzdem nochmal der Code vom Blockly

                            <xml xmlns="http://www.w3.org/1999/xhtml">
                              <block type="comment" id="Wy:oLcl*P`WS:kVY~)cZ" x="-462" y="-137">
                                <field name="COMMENT">Fläche 2 - Wasserfall &amp; Glassteine</field>
                                <next>
                                  <block type="on_ext" id="/Ez#y}@Y(Lrvhg{J.]p$">
                                    <mutation items="1"></mutation>
                                    <field name="CONDITION">ne</field>
                                    <field name="ACK_CONDITION"></field>
                                    <value name="OID0">
                                      <shadow type="field_oid" id="6rQQOEHCsT~%IU3];vv4">
                                        <field name="oid">deconz.0.Sensors.23.buttonpressed</field>
                                      </shadow>
                                    </value>
                                    <statement name="STATEMENT">
                                      <block type="controls_if" id="`x}?:|oVPs:t==4xMblt">
                                        <value name="IF0">
                                          <block type="logic_compare" id="5!V4|)OG%/V|c%W[}lkr">
                                            <field name="OP">EQ</field>
                                            <value name="A">
                                              <block type="on_source" id="+(i$:7w%ui+J.vI.V0Je">
                                                <field name="ATTR">state.val</field>
                                              </block>
                                            </value>
                                            <value name="B">
                                              <block type="math_number" id="Kqwzx:BqGPcpRWT]g=3}">
                                                <field name="NUM">2001</field>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <statement name="DO0">
                                          <block type="control" id="^;:b2%i?LHI-.g^Mzv`=">
                                            <mutation delay_input="false"></mutation>
                                            <field name="OID">sonoff.0.Garten_4CH_No2.POWER1</field>
                                            <field name="WITH_DELAY">FALSE</field>
                                            <value name="VALUE">
                                              <block type="logic_boolean" id="/3q-D[mC~GXL|:V6QDBo">
                                                <field name="BOOL">TRUE</field>
                                              </block>
                                            </value>
                                          </block>
                                        </statement>
                                        <next>
                                          <block type="controls_if" id="w:86H-AzS$o4DC!3ZLkv">
                                            <value name="IF0">
                                              <block type="logic_compare" id=")ZIz*=Ads21Lgqvc^AT5">
                                                <field name="OP">EQ</field>
                                                <value name="A">
                                                  <block type="on_source" id="!Co@Yoc+%9o}^8q1Pun;">
                                                    <field name="ATTR">state.val</field>
                                                  </block>
                                                </value>
                                                <value name="B">
                                                  <block type="math_number" id="x8#W2ay]R5{:at^/+Giw">
                                                    <field name="NUM">1002</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <statement name="DO0">
                                              <block type="control" id="U=[O,AL6^Y=af}s_]IUf">
                                                <mutation delay_input="false"></mutation>
                                                <field name="OID">sonoff.0.Garten_4CH_No2.POWER1</field>
                                                <field name="WITH_DELAY">FALSE</field>
                                                <value name="VALUE">
                                                  <block type="logic_boolean" id="bbs,.4`mo+?i@P}Jca+L">
                                                    <field name="BOOL">FALSE</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </statement>
                                            <next>
                                              <block type="controls_if" id="c~MAx0J31QQOwLyu6syU">
                                                <value name="IF0">
                                                  <block type="logic_compare" id="D3O(r{cVOaxqJ/00{dG-">
                                                    <field name="OP">EQ</field>
                                                    <value name="A">
                                                      <block type="on_source" id="[4l!J6m,26R+m[;2Lhk+">
                                                        <field name="ATTR">state.val</field>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <block type="math_number" id="BaDMjFJK2tH;%cIN$A7$">
                                                        <field name="NUM">2000</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                                <statement name="DO0">
                                                  <block type="toggle" id="Td.HNOnW8$)H_.mnWu~.">
                                                    <mutation delay_input="false"></mutation>
                                                    <field name="OID">sonoff.0.Garten_4CH_No2.POWER2</field>
                                                    <field name="WITH_DELAY">FALSE</field>
                                                  </block>
                                                </statement>
                                                <next>
                                                  <block type="controls_if" id="a(M:}$kk8xoV;JGa]_DD">
                                                    <value name="IF0">
                                                      <block type="logic_compare" id="EHA[6~/Vq|t9JktR}TBs">
                                                        <field name="OP">EQ</field>
                                                        <value name="A">
                                                          <block type="on_source" id="RVVqbZoq9wBA*)3M3wRE">
                                                            <field name="ATTR">state.val</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <block type="math_number" id="Ai0[U1Gd!,-N2iv{Ohk8">
                                                            <field name="NUM">2002</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <statement name="DO0">
                                                      <block type="control" id="zX=s`UX#/B/P`?8yJk0?">
                                                        <mutation delay_input="false"></mutation>
                                                        <field name="OID">sonoff.0.Garten_4CH_No2.POWER2</field>
                                                        <field name="WITH_DELAY">FALSE</field>
                                                        <value name="VALUE">
                                                          <block type="logic_boolean" id="LT4+b)/FEZyLuvD/9$k]">
                                                            <field name="BOOL">FALSE</field>
                                                          </block>
                                                        </value>
                                                        <next>
                                                          <block type="control" id="Vm}UEYWIdH[8H5-JYcwi">
                                                            <mutation delay_input="false"></mutation>
                                                            <field name="OID">sonoff.0.Garten_4CH_No2.POWER1</field>
                                                            <field name="WITH_DELAY">FALSE</field>
                                                            <value name="VALUE">
                                                              <block type="logic_boolean" id="XY{FOxudclDhrI`z7l6i">
                                                                <field name="BOOL">FALSE</field>
                                                              </block>
                                                            </value>
                                                          </block>
                                                        </next>
                                                      </block>
                                                    </statement>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </statement>
                                  </block>
                                </next>
                              </block>
                              <block type="comment" id="Q}eFBL[~~z61]8}:l0+N" x="163" y="-162">
                                <field name="COMMENT">Fläche 5 - Gabionen 50% &amp; 100%</field>
                                <next>
                                  <block type="on_ext" id="=Q,v=:B@q,jm(u)s)x{e">
                                    <mutation items="1"></mutation>
                                    <field name="CONDITION">ne</field>
                                    <field name="ACK_CONDITION"></field>
                                    <value name="OID0">
                                      <shadow type="field_oid" id=":xx^I,MF_,)fy7/_EJ1b">
                                        <field name="oid">deconz.0.Sensors.23.buttonpressed</field>
                                      </shadow>
                                    </value>
                                    <statement name="STATEMENT">
                                      <block type="controls_if" id="*gm;+lot[diVl{[{O27,">
                                        <value name="IF0">
                                          <block type="logic_compare" id="y|o]M1/QvT,GjMTs0}10">
                                            <field name="OP">EQ</field>
                                            <value name="A">
                                              <block type="on_source" id="UssHKI6a8BJ3L%%8F}nj">
                                                <field name="ATTR">state.val</field>
                                              </block>
                                            </value>
                                            <value name="B">
                                              <block type="math_number" id=")fjVWSRJZpeNDaTXIRAi">
                                                <field name="NUM">5001</field>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <statement name="DO0">
                                          <block type="control" id="8Hy_Hn|wr=JajZV$5BvU">
                                            <mutation delay_input="false"></mutation>
                                            <field name="OID">sonoff.0.Garten_4CH_No1.POWER3</field>
                                            <field name="WITH_DELAY">FALSE</field>
                                            <value name="VALUE">
                                              <block type="logic_boolean" id="a(9w25CjRP)awU24o(rh">
                                                <field name="BOOL">TRUE</field>
                                              </block>
                                            </value>
                                          </block>
                                        </statement>
                                        <next>
                                          <block type="controls_if" id="q7=2^,L(|h=^`kw/oUg]">
                                            <value name="IF0">
                                              <block type="logic_compare" id="fkIlyI.-I-adMvOkuLxf">
                                                <field name="OP">EQ</field>
                                                <value name="A">
                                                  <block type="on_source" id="hoft6qT%i;[6jbl[}+W!">
                                                    <field name="ATTR">state.val</field>
                                                  </block>
                                                </value>
                                                <value name="B">
                                                  <block type="math_number" id="[Ni=9N@oPn3e%6ZzPGO?">
                                                    <field name="NUM">1005</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <statement name="DO0">
                                              <block type="control" id="x^|`Y7lo;iUiT_`x=BTc">
                                                <mutation delay_input="false"></mutation>
                                                <field name="OID">sonoff.0.Garten_4CH_No1.POWER3</field>
                                                <field name="WITH_DELAY">FALSE</field>
                                                <value name="VALUE">
                                                  <block type="logic_boolean" id="56X2G~x_-`eh4q%J;?]}">
                                                    <field name="BOOL">FALSE</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </statement>
                                            <next>
                                              <block type="controls_if" id="a9$e.vuQqX*UzWQs=G,.">
                                                <value name="IF0">
                                                  <block type="logic_compare" id="Sep6/A_i6J5@q,*e|;`r">
                                                    <field name="OP">EQ</field>
                                                    <value name="A">
                                                      <block type="on_source" id="^X^[j;9H=OM[eatgHX^B">
                                                        <field name="ATTR">state.val</field>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <block type="math_number" id="H5]aSfhty%?^hvIP@~ao">
                                                        <field name="NUM">5000</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                                <statement name="DO0">
                                                  <block type="toggle" id="UWB-T+14;eh$~U$;t!Q^">
                                                    <mutation delay_input="false"></mutation>
                                                    <field name="OID">sonoff.0.Garten_4CH_No1.POWER4</field>
                                                    <field name="WITH_DELAY">FALSE</field>
                                                  </block>
                                                </statement>
                                                <next>
                                                  <block type="controls_if" id="`H:RLvcVwmqZ3lUL,H%v">
                                                    <value name="IF0">
                                                      <block type="logic_compare" id="RGWy]rIT9G3|PQw+(HhH">
                                                        <field name="OP">EQ</field>
                                                        <value name="A">
                                                          <block type="on_source" id="st/a/#OU-r0_|/JW3qO4">
                                                            <field name="ATTR">state.val</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <block type="math_number" id="RwbMOHQ{}GND?xRb{}id">
                                                            <field name="NUM">5005</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <statement name="DO0">
                                                      <block type="control" id="22=I)g2ECJ*Z,Xoi7j|;">
                                                        <mutation delay_input="false"></mutation>
                                                        <field name="OID">sonoff.0.Garten_4CH_No1.POWER3</field>
                                                        <field name="WITH_DELAY">FALSE</field>
                                                        <value name="VALUE">
                                                          <block type="logic_boolean" id="Fe_FQ9Ck#Plq8Ys::%c@">
                                                            <field name="BOOL">FALSE</field>
                                                          </block>
                                                        </value>
                                                        <next>
                                                          <block type="control" id="QZb(G+iqSpr@;X#zVn^o">
                                                            <mutation delay_input="false"></mutation>
                                                            <field name="OID">sonoff.0.Garten_4CH_No1.POWER4</field>
                                                            <field name="WITH_DELAY">FALSE</field>
                                                            <value name="VALUE">
                                                              <block type="logic_boolean" id="(mN+Z:vl5p:J+[z*R~Dd">
                                                                <field name="BOOL">FALSE</field>
                                                              </block>
                                                            </value>
                                                          </block>
                                                        </next>
                                                      </block>
                                                    </statement>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </statement>
                                  </block>
                                </next>
                              </block>
                              <block type="comment" id="TsW7x$;(NJT?eNW+~6H#" x="863" y="-188">
                                <field name="COMMENT">Fläche 6 - Terrasse &amp; Eisregen</field>
                                <next>
                                  <block type="on_ext" id="2HzS(tegC5cPk}FmR,qB">
                                    <mutation items="1"></mutation>
                                    <field name="CONDITION">ne</field>
                                    <field name="ACK_CONDITION"></field>
                                    <value name="OID0">
                                      <shadow type="field_oid" id="62[9S)VzAd0JQ7?=P{ua">
                                        <field name="oid">deconz.0.Sensors.23.buttonpressed</field>
                                      </shadow>
                                    </value>
                                    <statement name="STATEMENT">
                                      <block type="controls_if" id="5eLQt]v$7PZ]-?)mF5,x">
                                        <value name="IF0">
                                          <block type="logic_operation" id="!F)+h:xE`1g|$,{7:jqy" inline="false">
                                            <field name="OP">OR</field>
                                            <value name="A">
                                              <block type="logic_operation" id="V$WRw,:s_tqoy$ZI$KLv" inline="false">
                                                <field name="OP">OR</field>
                                                <value name="A">
                                                  <block type="logic_compare" id="OC7;jMMK)Z,OS3i$nP5f">
                                                    <field name="OP">EQ</field>
                                                    <value name="A">
                                                      <block type="on_source" id="R{5O[Z:6V(*5Ce9E.dKT">
                                                        <field name="ATTR">state.val</field>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <block type="math_number" id="*W:P.syg@?5nkVq?%-TO">
                                                        <field name="NUM">2006</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                                <value name="B">
                                                  <block type="logic_compare" id=".,=%i1sK0ws@)7mNDWNr">
                                                    <field name="OP">EQ</field>
                                                    <value name="A">
                                                      <block type="on_source" id="Q~b#nsFZXX=-%Z(O+]@Z">
                                                        <field name="ATTR">state.val</field>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <block type="math_number" id="Y/FK0Er{SZ/Xt@eTvlLY">
                                                        <field name="NUM">3006</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <value name="B">
                                              <block type="logic_operation" id="lN2/B36+6~qjJ}b+;gqg" inline="false">
                                                <field name="OP">OR</field>
                                                <value name="A">
                                                  <block type="logic_compare" id="_|oWpDSI9~mX}2u8`SZk">
                                                    <field name="OP">EQ</field>
                                                    <value name="A">
                                                      <block type="on_source" id="I,pgoR53gCMSA/tVWOFQ">
                                                        <field name="ATTR">state.val</field>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <block type="math_number" id=".T+a1!KK,n$@:?~ekE$T">
                                                        <field name="NUM">4006</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                                <value name="B">
                                                  <block type="logic_compare" id="u-EZJ^JpOGt]8;r!h0K]">
                                                    <field name="OP">EQ</field>
                                                    <value name="A">
                                                      <block type="on_source" id="[Twexp6s8Y:7GdwrRcLG">
                                                        <field name="ATTR">state.val</field>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <block type="math_number" id="V~%JE!JL?]Z00f@${=43">
                                                        <field name="NUM">5006</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <statement name="DO0">
                                          <block type="control" id="56:Z}{vWf?fg)t65B7E@">
                                            <mutation delay_input="false"></mutation>
                                            <field name="OID">sonoff.0.Garten_4CH_No1.POWER1</field>
                                            <field name="WITH_DELAY">FALSE</field>
                                            <value name="VALUE">
                                              <block type="logic_boolean" id="La1ki}8!.=6t%kKP5rJI">
                                                <field name="BOOL">TRUE</field>
                                              </block>
                                            </value>
                                          </block>
                                        </statement>
                                        <next>
                                          <block type="controls_if" id="*(2:W$S2Nc`]7A[U32tl">
                                            <value name="IF0">
                                              <block type="logic_operation" id=".,JFsqv7|D`au=0;W2QY" inline="false">
                                                <field name="OP">OR</field>
                                                <value name="A">
                                                  <block type="logic_operation" id="NCqG1=#,3@{8klkBrDR3" inline="false">
                                                    <field name="OP">OR</field>
                                                    <value name="A">
                                                      <block type="logic_compare" id="HQ1EyH0nRF+k0(lDjd7,">
                                                        <field name="OP">EQ</field>
                                                        <value name="A">
                                                          <block type="on_source" id="Ot~TkIcgN|co+=e`FJ;|">
                                                            <field name="ATTR">state.val</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <block type="math_number" id="c#HFV]0]x~w=aFfbEK%t">
                                                            <field name="NUM">6002</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <block type="logic_compare" id="yxh4v^fGO|}]qbUyFi5M">
                                                        <field name="OP">EQ</field>
                                                        <value name="A">
                                                          <block type="on_source" id="D{xlT`W|,_:N3UdJ1d2Y">
                                                            <field name="ATTR">state.val</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <block type="math_number" id="tvC6D.`OQL%6JeZqp*!Q">
                                                            <field name="NUM">6003</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                                <value name="B">
                                                  <block type="logic_operation" id="0S3r?vh(TbvVv*|:=GDX" inline="false">
                                                    <field name="OP">OR</field>
                                                    <value name="A">
                                                      <block type="logic_compare" id="x#?#g9nRfWwp=dR6RKU%">
                                                        <field name="OP">EQ</field>
                                                        <value name="A">
                                                          <block type="on_source" id="l}eQv,4Cm=w}|+8!S`Pu">
                                                            <field name="ATTR">state.val</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <block type="math_number" id="wG/.Z+H:5#N_iV9xL%/c">
                                                            <field name="NUM">6004</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <block type="logic_compare" id="P^*)RH_-GOxvw7V[4idO">
                                                        <field name="OP">EQ</field>
                                                        <value name="A">
                                                          <block type="on_source" id="?^gI}:MnRUa[-0fl!(g?">
                                                            <field name="ATTR">state.val</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <block type="math_number" id="]!3Mke1oW^/_+[v/W[%;">
                                                            <field name="NUM">6005</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <statement name="DO0">
                                              <block type="control" id=":9|eB`S5sAY6?v,JkjnY">
                                                <mutation delay_input="false"></mutation>
                                                <field name="OID">sonoff.0.Garten_4CH_No1.POWER1</field>
                                                <field name="WITH_DELAY">FALSE</field>
                                                <value name="VALUE">
                                                  <block type="logic_boolean" id="pl,QV$E3!_Yy~~8t[Ke$">
                                                    <field name="BOOL">FALSE</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </statement>
                                            <next>
                                              <block type="controls_if" id="|?enoyThfKYDC5X99V.J">
                                                <value name="IF0">
                                                  <block type="logic_compare" id="K.nJ{w4[,aF7VQ]Hf#m3">
                                                    <field name="OP">EQ</field>
                                                    <value name="A">
                                                      <block type="on_source" id="1a[xIbt`}939z{ItV]@D">
                                                        <field name="ATTR">state.val</field>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <block type="math_number" id="-uvxNhjSv1;,ozijLr8k">
                                                        <field name="NUM">6000</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                                <statement name="DO0">
                                                  <block type="toggle" id="+i~1HjHw+~%sexgiaIZ2">
                                                    <mutation delay_input="false"></mutation>
                                                    <field name="OID">sonoff.0.DEKO_2.POWER1</field>
                                                    <field name="WITH_DELAY">FALSE</field>
                                                  </block>
                                                </statement>
                                                <next>
                                                  <block type="controls_if" id="tX/7Ob59nqb?*auw9VLf">
                                                    <value name="IF0">
                                                      <block type="logic_compare" id="tpRSka9%pc*LPE;!6;8E">
                                                        <field name="OP">EQ</field>
                                                        <value name="A">
                                                          <block type="on_source" id="QXZPGk4^.,]-0@lq!e1t">
                                                            <field name="ATTR">state.val</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <block type="math_number" id="UU{C7InP^SZ_Wg10Wi,}">
                                                            <field name="NUM">6006</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <statement name="DO0">
                                                      <block type="control" id="z|,Tdd:WFe:@O7ya|?a$">
                                                        <mutation delay_input="false"></mutation>
                                                        <field name="OID">sonoff.0.Garten_4CH_No1.POWER1</field>
                                                        <field name="WITH_DELAY">FALSE</field>
                                                        <value name="VALUE">
                                                          <block type="logic_boolean" id="iXD5d+Bq?AM2NFvH0t1J">
                                                            <field name="BOOL">FALSE</field>
                                                          </block>
                                                        </value>
                                                        <next>
                                                          <block type="control" id="2UP+|q98NbVXu`z!a*oO">
                                                            <mutation delay_input="false"></mutation>
                                                            <field name="OID">sonoff.0.DEKO_2.POWER1</field>
                                                            <field name="WITH_DELAY">FALSE</field>
                                                            <value name="VALUE">
                                                              <block type="logic_boolean" id=":gMgWJZ|o5-x9Uf[PBXW">
                                                                <field name="BOOL">FALSE</field>
                                                              </block>
                                                            </value>
                                                          </block>
                                                        </next>
                                                      </block>
                                                    </statement>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </statement>
                                  </block>
                                </next>
                              </block>
                              <block type="comment" id="#^MulK1|7nQPpI[w[g/:" x="-462" y="388">
                                <field name="COMMENT">Fläche 3 - Pool Gabione &amp; Steckdose</field>
                                <next>
                                  <block type="on_ext" id="2tAkG`,qPAJev4iMfG6L">
                                    <mutation items="1"></mutation>
                                    <field name="CONDITION">ne</field>
                                    <field name="ACK_CONDITION"></field>
                                    <value name="OID0">
                                      <shadow type="field_oid" id="AeD,(vx!ta]wgo$~bOlZ">
                                        <field name="oid">deconz.0.Sensors.23.buttonpressed</field>
                                      </shadow>
                                    </value>
                                    <statement name="STATEMENT">
                                      <block type="controls_if" id="DaXHbPc=y=}b^M,!76(,">
                                        <value name="IF0">
                                          <block type="logic_compare" id="yXXt0eG:$Dz8e.T}Wp.b">
                                            <field name="OP">EQ</field>
                                            <value name="A">
                                              <block type="on_source" id="?g?sLdJz%`dXI;[[aMiR">
                                                <field name="ATTR">state.val</field>
                                              </block>
                                            </value>
                                            <value name="B">
                                              <block type="math_number" id="@WkXp7{7XvbQL1o0m651">
                                                <field name="NUM">3001</field>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <statement name="DO0">
                                          <block type="control" id="tD,(yS|B6D%xXdlcD+.I">
                                            <mutation delay_input="false"></mutation>
                                            <field name="OID">sonoff.0.Garten_4CH_No1.POWER2</field>
                                            <field name="WITH_DELAY">FALSE</field>
                                            <value name="VALUE">
                                              <block type="logic_boolean" id="D~yG2XHn~md6kU.[vd@^">
                                                <field name="BOOL">TRUE</field>
                                              </block>
                                            </value>
                                          </block>
                                        </statement>
                                        <next>
                                          <block type="controls_if" id="GZv-tu%0uzTR}k-aN0,E">
                                            <value name="IF0">
                                              <block type="logic_compare" id="9]Ti.W14S$NUJMs1QWK7">
                                                <field name="OP">EQ</field>
                                                <value name="A">
                                                  <block type="on_source" id="3jQEF#k{%abt9eX/pAQ?">
                                                    <field name="ATTR">state.val</field>
                                                  </block>
                                                </value>
                                                <value name="B">
                                                  <block type="math_number" id="^96Ex=E_v=nXEfh3R{eu">
                                                    <field name="NUM">1003</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <statement name="DO0">
                                              <block type="control" id="|tV;mDy5,cquY$xc9_0s">
                                                <mutation delay_input="false"></mutation>
                                                <field name="OID">sonoff.0.Garten_4CH_No1.POWER2</field>
                                                <field name="WITH_DELAY">FALSE</field>
                                                <value name="VALUE">
                                                  <block type="logic_boolean" id="%b067b(T:YjL0X.g`a67">
                                                    <field name="BOOL">FALSE</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </statement>
                                            <next>
                                              <block type="controls_if" id="81~o6.|,gnJ|/JRDd(QN">
                                                <value name="IF0">
                                                  <block type="logic_compare" id="!TqWw*{8B)|.U=*eCe{W">
                                                    <field name="OP">EQ</field>
                                                    <value name="A">
                                                      <block type="on_source" id="49#Yj,ryXV9lr`~ZzeMA">
                                                        <field name="ATTR">state.val</field>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <block type="math_number" id="FMmqdV[O@J`6EslG.p^#">
                                                        <field name="NUM">3000</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                                <statement name="DO0">
                                                  <block type="toggle" id="87r=RGvQTG7D^R(.nv@d">
                                                    <mutation delay_input="false"></mutation>
                                                    <field name="OID">sonoff.0.Garten_S55_1.POWER</field>
                                                    <field name="WITH_DELAY">FALSE</field>
                                                  </block>
                                                </statement>
                                                <next>
                                                  <block type="controls_if" id="A.a.hY5Et31[c%gbM3_y">
                                                    <value name="IF0">
                                                      <block type="logic_compare" id="M^}Q=3BaShSU$gT]mbG1">
                                                        <field name="OP">EQ</field>
                                                        <value name="A">
                                                          <block type="on_source" id="N^/I8Tp$8]ZMA+YbYKU]">
                                                            <field name="ATTR">state.val</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <block type="math_number" id="XBq`..[q/wmLD^/(]NB9">
                                                            <field name="NUM">3003</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <statement name="DO0">
                                                      <block type="control" id="4ZEe./xSQK`#6:dt#tYa">
                                                        <mutation delay_input="false"></mutation>
                                                        <field name="OID">sonoff.0.Garten_4CH_No1.POWER2</field>
                                                        <field name="WITH_DELAY">FALSE</field>
                                                        <value name="VALUE">
                                                          <block type="logic_boolean" id="#J4#=(n:Yoh1TM;f,XN{">
                                                            <field name="BOOL">FALSE</field>
                                                          </block>
                                                        </value>
                                                        <next>
                                                          <block type="control" id="a([vn17Nf5:$5NHhQ{cY">
                                                            <mutation delay_input="false"></mutation>
                                                            <field name="OID">sonoff.0.Garten_S55_1.POWER</field>
                                                            <field name="WITH_DELAY">FALSE</field>
                                                            <value name="VALUE">
                                                              <block type="logic_boolean" id="wfPLiRxA0;09zq=x45l%">
                                                                <field name="BOOL">FALSE</field>
                                                              </block>
                                                            </value>
                                                          </block>
                                                        </next>
                                                      </block>
                                                    </statement>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </statement>
                                  </block>
                                </next>
                              </block>
                              <block type="comment" id=")?lZj0EFts-*pJ-d]zmw" x="188" y="388">
                                <field name="COMMENT">Fläche 4 - Pflanzkörbe &amp; Steckdose</field>
                                <next>
                                  <block type="on_ext" id="yzyU7i2n%Duf207iIW5/">
                                    <mutation items="1"></mutation>
                                    <field name="CONDITION">ne</field>
                                    <field name="ACK_CONDITION"></field>
                                    <value name="OID0">
                                      <shadow type="field_oid" id="{T^Q4ApIfS^p*-wSMk6Z">
                                        <field name="oid">deconz.0.Sensors.23.buttonpressed</field>
                                      </shadow>
                                    </value>
                                    <statement name="STATEMENT">
                                      <block type="controls_if" id="Yj?i?E5l_QmE`HWgI/.F">
                                        <value name="IF0">
                                          <block type="logic_compare" id="D]gH)-wv7D[-5sbMBq!,">
                                            <field name="OP">EQ</field>
                                            <value name="A">
                                              <block type="on_source" id="5(DX9^[JLzQ?0B7ezKaf">
                                                <field name="ATTR">state.val</field>
                                              </block>
                                            </value>
                                            <value name="B">
                                              <block type="math_number" id="-!3*YrsxOdczu,aAc%4u">
                                                <field name="NUM">4001</field>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <statement name="DO0">
                                          <block type="control" id="/*T[~zn#R@=~x=OpU,sl">
                                            <mutation delay_input="false"></mutation>
                                            <field name="OID">sonoff.0.Garten_4CH_No2.POWER3</field>
                                            <field name="WITH_DELAY">FALSE</field>
                                            <value name="VALUE">
                                              <block type="logic_boolean" id="s|#h6iTqWN!eSB5%@dw8">
                                                <field name="BOOL">TRUE</field>
                                              </block>
                                            </value>
                                          </block>
                                        </statement>
                                        <next>
                                          <block type="controls_if" id="nn9Y$_%?H.t%=}VS#3[p">
                                            <value name="IF0">
                                              <block type="logic_compare" id="/-p41C(5v/$rp|^YHrO;">
                                                <field name="OP">EQ</field>
                                                <value name="A">
                                                  <block type="on_source" id="ZZ_EpfEMDApVY1c#/vJ)">
                                                    <field name="ATTR">state.val</field>
                                                  </block>
                                                </value>
                                                <value name="B">
                                                  <block type="math_number" id="ETuNF{ax99=7{7PI/DJp">
                                                    <field name="NUM">1004</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <statement name="DO0">
                                              <block type="control" id="?_XWwDaB!i$n35e#`zDt">
                                                <mutation delay_input="false"></mutation>
                                                <field name="OID">sonoff.0.Garten_4CH_No2.POWER3</field>
                                                <field name="WITH_DELAY">FALSE</field>
                                                <value name="VALUE">
                                                  <block type="logic_boolean" id="xHqbcAX96GZen+drU,E^">
                                                    <field name="BOOL">FALSE</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </statement>
                                            <next>
                                              <block type="controls_if" id="$9GvQ6/gNx:eo[9r!|~r">
                                                <value name="IF0">
                                                  <block type="logic_compare" id="NHvTZ;Uzo)k}$.W7-Q3N">
                                                    <field name="OP">EQ</field>
                                                    <value name="A">
                                                      <block type="on_source" id="$ROl+4D^{SAeu5*^+7K^">
                                                        <field name="ATTR">state.val</field>
                                                      </block>
                                                    </value>
                                                    <value name="B">
                                                      <block type="math_number" id="[9J.[*_Tz|iY]0)%_r_y">
                                                        <field name="NUM">4000</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </value>
                                                <statement name="DO0">
                                                  <block type="toggle" id="0@QRMo-c[W[2EjICKYgB">
                                                    <mutation delay_input="false"></mutation>
                                                    <field name="OID">deconz.0.Lights.1.on</field>
                                                    <field name="WITH_DELAY">FALSE</field>
                                                  </block>
                                                </statement>
                                                <next>
                                                  <block type="controls_if" id="WM1T;T1Iw![?_V}0{Y]6">
                                                    <value name="IF0">
                                                      <block type="logic_compare" id="_KBUc6_kCu$DaFFzRd7E">
                                                        <field name="OP">EQ</field>
                                                        <value name="A">
                                                          <block type="on_source" id="JuuCu5H]O0Z9OP@:;]Yy">
                                                            <field name="ATTR">state.val</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <block type="math_number" id="fCOJt3B}#H{#ldP`#?#y">
                                                            <field name="NUM">4004</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <statement name="DO0">
                                                      <block type="control" id="A1^qztw+h7=6,W2nK3G:">
                                                        <mutation delay_input="false"></mutation>
                                                        <field name="OID">deconz.0.Lights.1.on</field>
                                                        <field name="WITH_DELAY">FALSE</field>
                                                        <value name="VALUE">
                                                          <block type="logic_boolean" id="pSC.D8)O$1EUml_mscj0">
                                                            <field name="BOOL">FALSE</field>
                                                          </block>
                                                        </value>
                                                        <next>
                                                          <block type="control" id="`sf|TR8vXOm/QGjDM?G.">
                                                            <mutation delay_input="false"></mutation>
                                                            <field name="OID">sonoff.0.Garten_4CH_No2.POWER3</field>
                                                            <field name="WITH_DELAY">FALSE</field>
                                                            <value name="VALUE">
                                                              <block type="logic_boolean" id="OkKX$?u`1RH?!Xjx|_[U">
                                                                <field name="BOOL">FALSE</field>
                                                              </block>
                                                            </value>
                                                          </block>
                                                        </next>
                                                      </block>
                                                    </statement>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </statement>
                                  </block>
                                </next>
                              </block>
                              <block type="comment" id="A-8%u/mX1JEc,Sl5;xi)" x="863" y="612">
                                <field name="COMMENT">Fläche 1 - Alles AUS &amp; Steckdose OST</field>
                                <next>
                                  <block type="on_ext" id="(YxEZn8naRVlJgO5W;qx">
                                    <mutation items="1"></mutation>
                                    <field name="CONDITION">ne</field>
                                    <field name="ACK_CONDITION"></field>
                                    <value name="OID0">
                                      <shadow type="field_oid" id="%!@.neYp^w+TRQ5EDi[P">
                                        <field name="oid">deconz.0.Sensors.23.buttonpressed</field>
                                      </shadow>
                                    </value>
                                    <statement name="STATEMENT">
                                      <block type="comment" id="@79%~D2VR+)g,(,Wcuc~">
                                        <field name="COMMENT">Schütteln Alexa Gruppe Garten</field>
                                        <next>
                                          <block type="controls_if" id="(jDry+Z_8RRJRac2:WUe">
                                            <value name="IF0">
                                              <block type="logic_compare" id="drk{NMKLQl*L)t(]dE@]">
                                                <field name="OP">EQ</field>
                                                <value name="A">
                                                  <block type="on_source" id="U?E[$7B0DTCjZQy_h+hY">
                                                    <field name="ATTR">state.val</field>
                                                  </block>
                                                </value>
                                                <value name="B">
                                                  <block type="math_number" id="7E9uC2w.[~0D]]6fp;dC">
                                                    <field name="NUM">7007</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <statement name="DO0">
                                              <block type="control" id="`iKB!t*Akp/Le=o~bnT0">
                                                <mutation delay_input="false"></mutation>
                                                <field name="OID">alexa2.0.Smart-Home-Devices.3d19d4d8-8a84-4bbf-bc28-25e56f2a833a.powerState</field>
                                                <field name="WITH_DELAY">FALSE</field>
                                                <value name="VALUE">
                                                  <block type="logic_boolean" id="YDr.u@6uAkwsuObKO~^`">
                                                    <field name="BOOL">FALSE</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </statement>
                                            <next>
                                              <block type="comment" id="x]9J7p5eiZT-GEMJiWP3">
                                                <field name="COMMENT">Schieben Steckdose Freisitz</field>
                                                <next>
                                                  <block type="controls_if" id="co`8)W+32^P)TjfbqpL)">
                                                    <value name="IF0">
                                                      <block type="logic_compare" id="@O+|$.X%s:}]x#ukA%0_">
                                                        <field name="OP">EQ</field>
                                                        <value name="A">
                                                          <block type="on_source" id="j}pt4#Y%v^4f{K2Kj-Ke">
                                                            <field name="ATTR">state.val</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <block type="math_number" id="S7Y*W[05w+}X#b|dL5zm">
                                                            <field name="NUM">1000</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <statement name="DO0">
                                                      <block type="toggle" id="hm~E3LiaBe1Kcvt+aG-b">
                                                        <mutation delay_input="false"></mutation>
                                                        <field name="OID">sonoff.0.Garten_S55_3.POWER</field>
                                                        <field name="WITH_DELAY">FALSE</field>
                                                      </block>
                                                    </statement>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </statement>
                                  </block>
                                </next>
                              </block>
                            </xml>
                            

                            und hier nochmal ein Flächen "Schnippsel" Im Grunde ist jede Würfel Fläche genau so aufgebaut - nur halt mit unterschiedlichen Codes und Aktoren.

                            2020-05-02 07_26_13-javascript - ioBroker.png

                            Richtig kompliziert wird es wenn du aus jeder Position heraus die Funktionen ausführen willst. Das geht dann mitunter nur, wenn du über andee Flächen hinweg drehst, was dann aber wieder zu ungewollten Schalthandlungen führt.

                            Darum muss man in meinem Blockly den Würfel immer auf eine definierte Fläche stellen und von da aus mit dem kippen uns schieben starten.

                            Man kann das allerdings auch so machen, dann ist es nämlich egal in welche Richtung man von der definierten Fläche kippt - es wird immer die gleiche Schalthandlung ausgeführt.

                            2020-05-02 07_31_41-javascript - ioBroker.png

                            ebaauw created this issue in dresden-elektronik/deconz-rest-plugin

                            closed Xiaomi Mi Smart Cube #138

                            flkontakt 1 Reply Last reply Reply Quote 0
                            • flkontakt
                              flkontakt @JB_Sullivan last edited by

                              @JB_Sullivan hallo, habe meine schaltungen ähnlich gelöst. mir fehlt aber die Drehbewegung des cube, hast du diese werte in iobroker verfügbar? In deconz werden die angezeigt, siehe bildIMG_20200502_083659.jpg

                              JB_Sullivan 1 Reply Last reply Reply Quote 0
                              • JB_Sullivan
                                JB_Sullivan @flkontakt last edited by JB_Sullivan

                                @flkontakt
                                In ioB gibt es zwei Datenpunkte die dem Würfel zugeordnet sind.

                                Einer ist für die Flächen als Schalter zuständig und der andere (der untere) für die Drehbewegungen.

                                Und da werden als Button Event die Werte für die Drehbewegung ausgegeben (hier 6693)

                                Wie man die allerdings in Blockly verarbeitet weiß ich noch nicht. Ich will nämlich auch noch die Drehung für das durchschalten der unterschiedlichen LED-RGB Farben parametrieren.

                                7ebdb28b-de3b-4915-bf0d-e46b4eca4d9c-image.png

                                flkontakt 1 Reply Last reply Reply Quote 0
                                • flkontakt
                                  flkontakt @JB_Sullivan last edited by

                                  @JB_Sullivan danke für die Info, bei mir erscheint der cube aber nur 1x im iobroker. Habe ich beim anlernen etwas falsch gemacht? Das mit dem drehen hat hier einer gelöst https://forum.iobroker.net/topic/19161/xiaomi-cube-blockly-skripte-für-dimmer/8 , will ich dann auch testen.

                                  JB_Sullivan 1 Reply Last reply Reply Quote 0
                                  • JB_Sullivan
                                    JB_Sullivan @flkontakt last edited by JB_Sullivan

                                    @flkontakt
                                    Welche deconz Adapter Version hast du? Im latest ist 1.3.5 verfügbar. Die habe ich drauf.

                                    Der das bei deinem Link "gelöst" hat, scheint aber den Xiaomi Gateway Adapter zu verwenden und nicht den deconz Adapter, denn bei deconz gibt keinen rotate Datenpunkt.

                                    flkontakt 1 Reply Last reply Reply Quote 0
                                    • flkontakt
                                      flkontakt @JB_Sullivan last edited by

                                      @JB_Sullivan habe von 1.3.4 auf 1.3.5 upgedatet, aber noch immer nur 1 Cube unter den Objekten. Werde mal löschen und neu anlernen. Gibt es eine Übersicht der Zahlenwerte bei Drehbewegung? Die könnte man ggf. für ein blockly zum dimmen verwenden

                                      1 Reply Last reply Reply Quote 0
                                      • JB_Sullivan
                                        JB_Sullivan last edited by

                                        Nein, wie gesagt mit dem Drehen habe ich mich noch nicht so beschäfftigt. Da aber 1000er Werte angezeigt werden, ist schätzungsweise ein Multiplikator drin.

                                        In JavaSkript sieht das Ganze so aus - ist aber nicht von mir - kann ich auch nix zu sagen weil ich JavaSkript nicht verstehe.

                                        Bzgl. deiner Datenpunkte - vielleicht liegt es ja auch an der deconz Firmware Version vom Gatway/Stick

                                        Ich habe den deconz-2 Stick

                                        2020-05-02 11_58_13-Phoscon App.png

                                        on({id: CubeR, change: "ne"}, function (obj) { // nur bei änderung Triggern "ne" not equal
                                                
                                                
                                        var rotationVal = JSON.stringify(getState(CubeR).val); // Objekt in String konvertieren
                                         
                                           
                                                 
                                        // Schauen ob rotationVal negativ/positiv ist und nur die ersten beiden bzw. drei ziffern verwenden.
                                        if ( rotationVal.substr(0,1) == "-" ) {
                                                    
                                        	if (rotationVal.length == 6 ) {
                                        		degree = rotationVal.substr(0,4);
                                                        
                                        	}
                                        	else {
                                        		degree = rotationVal.substr(0,3);
                                                    
                                        	}
                                                    
                                        }
                                        else {
                                                    
                                        	if (rotationVal.length == 5 ) {
                                        		degree = rotationVal.substr(0,3);
                                                        
                                        	}
                                        	else {
                                        		degree = rotationVal.substr(0,2);
                                        	}
                                                    
                                              
                                        }
                                                
                                                
                                               if (debug ==  1) {  
                                        console.log("gedreht: " + degree);
                                               }
                                        // Volume auslesen
                                        var aMainVol = parseInt(getState("alexa2.0.Echo-Devices.G090U61091855EMG.Player.volume"/*Main Volume*/).val);
                                                
                                        // Neues Volumen errechnen
                                        if (debug >= 2) { 
                                        console.log("Ergebnis: " + parseInt(degree) / 5);
                                        }
                                        if (parseInt(degree)  > 60) {
                                            if (debug >= 2) {
                                            console.log("Vol unterschied zu hoch, angepasst!");
                                            }
                                            degree = 60;
                                           
                                            
                                        }
                                         
                                        var newMainVol = (degree / 5) + aMainVol;
                                        if (debug >= 2) {
                                        console.log("Vol unterschied: " + (parseInt(degree) / 5));
                                        console.log("mainvol: " + aMainVol + " newMainVol: " + newMainVol);
                                        }
                                        // Neues Volumen an EchoDot senden
                                        setState("alexa2.0.Echo-Devices.G090U61091855EMG.Player.volume", newMainVol);
                                                
                                        });
                                        
                                        
                                        flkontakt 1 Reply Last reply Reply Quote 0
                                        • C
                                          claus1993 last edited by claus1993

                                          Habe bei mir keinen Datenpunkt mit 4-Stellen, bei mir schaut das so aus;

                                          cube.PNG

                                          Habe bei mir noch nicht herausgefunden was welcher Datenpunkt bedeutet aber es wird wohl nur false und true gesetzt.

                                          Bei mir wird die Drehbewegung im Datenpunkt "buttonevent" angezeigt.

                                          Habe den Deconz Adapter 1.3.5 bei mir installiert.

                                          M 1 Reply Last reply Reply Quote 0
                                          • flkontakt
                                            flkontakt @JB_Sullivan last edited by

                                            @JB_Sullivan jetzt ist scheinbar alles da, keine Ahnung was ich gemacht habe 😏

                                            Habe mich mit dem dimmen beschäftigt, erste Lösung funktioniert auch soweit. Gefühlt aber keine schöne Lösung, vielleicht gibt es bessere Ansätze IMG_20200502_190200.jpg

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            645
                                            Online

                                            31.8k
                                            Users

                                            80.0k
                                            Topics

                                            1.3m
                                            Posts

                                            javascript
                                            8
                                            25
                                            2164
                                            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