NEWS
Aqara Cube Skript - Bitte um Hilfe
-
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. -
@JB_Sullivan
Ich muss nochmal fragen - die debug ausgaben kommen in beiden Skripten ?A.
-
Ja, kommen in beiden Skripten, aber das jeweilige State schaltet im unteren nicht.
-
@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... -
@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 ) {
-
@paul53
Habe ich gemacht, funktioniert trotzdem nicht.Ich habe auch wie an andere Stelle <= ausprobiert - geht auch nicht.
-
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.
-
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
-
@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
-
@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 & 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% & 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 & 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 & 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 & 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 & 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.
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.
-
@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 bild
-
@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.
-
@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.
-
@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.
-
@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
-
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
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); });
-
Habe bei mir keinen Datenpunkt mit 4-Stellen, bei mir schaut das so aus;
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.
-
@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
-
@claus1993
du müsstest da noch einen zweiten Ortner haben -
@Michi68
habe mal eine zweiten Cube angelernt und sieh da dort habe ich auch den 4-stelligen Schaltzustand