- Home
- Deutsch
- Skripten / Logik
- Blockly
- Lamellenschräge berechnen (Shelly 2.5)
Lamellenschräge berechnen (Shelly 2.5)
-
Zuerst mal, dies hier soll keine Frage sein, sondern mein erster Versuch die Lamellenschräge der Raffstores zu berechnen und als %-Wert (100% = offen/waagerecht; 0%= geschlossen/senkrecht) in einem Datenpunkt zu speichern. Es ist aber keine Steuerung damit möglich.
Da ich aber nur Grundkenntnisse in Blockly hab könnte man das Skript sicher optimieren. (Freiwillige können gerne Tipps geben, auch für mich um zu lernen).Bei meinen bisherigen Tests funktionierte es wie es soll.
Vielleicht hilft es jemanden, der diese Funktion bei den Shellys 2.5 vermisst.Zum Blockly-Skript:
Pro Raffstore ist ein Blockly notwendig.
Vier Variablen sind zu befüllen:- Den Pfad zu 2 Datenpunkten des Shellys:
.state
und.Position
- Die Dauer in % für die Fahrt zwischen Senkrecht und Waagerecht. (zb 4% wie bei meinen)
- Den Pfad zum Datenpunkt in welchem das Ergebnis geschrieben werden soll (muss zuvor selber im Objektbaum angelegt werden)
Nach dem Starten des Blockly-Skripts ist eine Fahrt nötig, um die Variable
Position_alt
zu befüllen. Mit der zweiten Fahrt sollte der korrekte Wert im Datenpunkt landen.<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="s;J?YHHC4y7nCBL:/.kz">Datapoint_state</variable> <variable id="Xl7C$m/{Y!I?CLq4|v#Q">Datapoint_position</variable> <variable id="_gvJ%jiZuj,`TW~.!EkJ">Kippdauer_in_Prozent</variable> <variable id="P;8?x}BqZ%a$u(De,c+=">Datapoint_Tilt_level</variable> <variable id="Q/S3M`r?;xPFfJS7MeN*">State</variable> <variable id="[WI)a^2Z6Y^Cd2n9QmB,">Richtung</variable> <variable id="*Rgwj9#|oSb`YN/~SttT">Position_neu</variable> <variable id="=/.fldlHcxN4iQZ!6oak">aktuelle_Fahrt</variable> <variable id="_=|52nLA}C#@Rt53Z)-1">Position_alt</variable> <variable id="*.dUJw{n!a)gP+VHvR{+">letzteFahrt_close</variable> <variable id="knS^%O4Urb%r6);=xzwe">Tilt_level</variable> <variable id="Jz;kTATl+nZ/%j4Jr~I$">letzteFahrt_open</variable> </variables> <block type="comment" id="crxWoN-+U6zB_+v8M8@." x="113" y="-38"> <field name="COMMENT">Shelly 2.5 Datapoint: Ordner .state und .position Objekte</field> <next> <block type="variables_set" id="R(l@q|@EqFMUf=Ei~n6q"> <field name="VAR" id="s;J?YHHC4y7nCBL:/.kz">Datapoint_state</field> <value name="VALUE"> <block type="text" id="`9mC9=R$2O4G_%S.|[(@"> <field name="TEXT">alias.0.Raff_Wohnzimmer.state</field> </block> </value> <next> <block type="variables_set" id=":5,I|r4HpkW9db:nl0|0"> <field name="VAR" id="Xl7C$m/{Y!I?CLq4|v#Q">Datapoint_position</field> <value name="VALUE"> <block type="text" id="j1RtjBr-s5k3E.!A)RH3"> <field name="TEXT">alias.0.Raff_Wohnzimmer.Position</field> </block> </value> <next> <block type="comment" id="Zlj;OBM#P[Iz1r#T;.r-"> <field name="COMMENT">Wieviel % wird gefahren zwischen Waagerecht und Senkrecht</field> <next> <block type="variables_set" id="%p.l=?yw2M)-|c_2,Tcg"> <field name="VAR" id="_gvJ%jiZuj,`TW~.!EkJ">Kippdauer_in_Prozent</field> <value name="VALUE"> <block type="math_number" id="0!u3^at?724.6GpzL;i)"> <field name="NUM">4</field> </block> </value> <next> <block type="comment" id="!NDOGvkE,*#xDEdmi{1o"> <field name="COMMENT">Datapoint zum Speichern des Tilt Levels (number)</field> <next> <block type="comment" id=":]L`b_hMlN1O1/MjRx)$"> <field name="COMMENT">100% = geöffnet; 0% = geschlossen</field> <next> <block type="variables_set" id="2KDrDNmb7rBnRj;FiId$"> <field name="VAR" id="P;8?x}BqZ%a$u(De,c+=">Datapoint_Tilt_level</field> <value name="VALUE"> <block type="text" id="}Jn8oC=*G0OUNrxqW_9S"> <field name="TEXT">0_userdata.0.Raffstores.Tilt_Level.Wohnzimmer</field> </block> </value> <next> <block type="on_ext" id="dZD03|%!z(!/Hw$~nWx9"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="=xYN-Nf1$0nTiG/30gd*"> <field name="oid">default</field> </shadow> <block type="variables_get" id="X:wkIw8SddGI8W(+P5oM"> <field name="VAR" id="s;J?YHHC4y7nCBL:/.kz">Datapoint_state</field> </block> </value> <statement name="STATEMENT"> <block type="variables_set" id="p_lF))o5?Sk4Gkwg-i0X"> <field name="VAR" id="Q/S3M`r?;xPFfJS7MeN*">State</field> <value name="VALUE"> <block type="get_value_var" id="Ub`({Fzpsd@GcelFjn6r"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="n0+48b_e9W}(X8Qr^i2R"> <field name="VAR" id="s;J?YHHC4y7nCBL:/.kz">Datapoint_state</field> </block> </value> </block> </value> <next> <block type="controls_if" id="gQcXHY=W/`8CaDcN6O_1"> <mutation elseif="1" else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="m]W~zu@$Q:LO8c:{})!G"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="$h}9R|{K7xfpz4acvHb7"> <field name="VAR" id="Q/S3M`r?;xPFfJS7MeN*">State</field> </block> </value> <value name="B"> <block type="text" id="[h%+wtIh7%FvKDJ4cL+b"> <field name="TEXT">close</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="|1Q_L_@acPAzd=yw:^T/"> <field name="VAR" id="[WI)a^2Z6Y^Cd2n9QmB,">Richtung</field> <value name="VALUE"> <block type="text" id="WTiGe~Y*Qin67sU=_F+V"> <field name="TEXT">close</field> </block> </value> </block> </statement> <value name="IF1"> <block type="logic_compare" id="5Q)IDcCoW)n0FGg:n;w/"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="`b]MEL`H6m/?OXUVUvet"> <field name="VAR" id="Q/S3M`r?;xPFfJS7MeN*">State</field> </block> </value> <value name="B"> <block type="text" id=":D+DA_03{NoqDWs9hzMW"> <field name="TEXT">open</field> </block> </value> </block> </value> <statement name="DO1"> <block type="variables_set" id="ek5y;L5ZXzKYuME@xik~"> <field name="VAR" id="[WI)a^2Z6Y^Cd2n9QmB,">Richtung</field> <value name="VALUE"> <block type="text" id="i0QIMhZd:]MF(t`D/1[."> <field name="TEXT">open</field> </block> </value> </block> </statement> <statement name="ELSE"> <block type="timeouts_wait" id="N*eS{DFUq*+BWc9V_tQh"> <field name="DELAY">50</field> <field name="UNIT">ms</field> <next> <block type="variables_set" id=")@];vSYY)j^94sRhlc(G"> <field name="VAR" id="*Rgwj9#|oSb`YN/~SttT">Position_neu</field> <value name="VALUE"> <block type="get_value_var" id="4jTWGE39VxT{$a;nJ$ki"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id=":-#ltLYc;52/e?ExUBe`"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="X@~m!Q}]D!NL@;gjo0Hq"> <field name="VAR" id="Xl7C$m/{Y!I?CLq4|v#Q">Datapoint_position</field> </block> </value> </block> </value> <next> <block type="controls_if" id="ix)GPVCiy?]5uAeIF6rr"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="logic_compare" id="=Wus2RrHaFg.$M_@k`9Y"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="2%ZaZU?!,wVS~@?7}kkS"> <field name="VAR" id="[WI)a^2Z6Y^Cd2n9QmB,">Richtung</field> </block> </value> <value name="B"> <block type="text" id="GZa!2)g)TxG3Z*i%TU4%"> <field name="TEXT">close</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="0wl+WMX3lyFhjG1L%)A,"> <field name="VAR" id="=/.fldlHcxN4iQZ!6oak">aktuelle_Fahrt</field> <value name="VALUE"> <block type="math_arithmetic" id=".OgUnq*X%#6m[@FecZwk"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="09c~1|F0]B6GKiJs+XJ5"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="}mvjhjA|24WTKG_j!lDt"> <field name="VAR" id="_=|52nLA}C#@Rt53Z)-1">Position_alt</field> </block> </value> <value name="B"> <shadow type="math_number" id="3+0gmqK.ol)Ih_4+$Q[O"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="B+RQ2Z{^#9$ZG2IG`sxp"> <field name="VAR" id="*Rgwj9#|oSb`YN/~SttT">Position_neu</field> </block> </value> </block> </value> <next> <block type="math_change" id="3q~+7i/PRLhJB/{tO#U,"> <field name="VAR" id="=/.fldlHcxN4iQZ!6oak">aktuelle_Fahrt</field> <value name="DELTA"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="@yyG=s7Nh4?ym7O?,Z6e"> <field name="VAR" id="*.dUJw{n!a)gP+VHvR{+">letzteFahrt_close</field> </block> </value> <next> <block type="variables_set" id="Rq@fk^pr=YjyWN_c)PLU"> <field name="VAR" id="knS^%O4Urb%r6);=xzwe">Tilt_level</field> <value name="VALUE"> <block type="logic_ternary" id="w86`[@g#bYuPXio5FkKa"> <value name="IF"> <block type="logic_compare" id="FJ7.Jx{y(*J(8F5gY/zX"> <field name="OP">LTE</field> <value name="A"> <block type="variables_get" id="-qP{x}Yo.dwco[+MnjlJ"> <field name="VAR" id="=/.fldlHcxN4iQZ!6oak">aktuelle_Fahrt</field> </block> </value> <value name="B"> <block type="variables_get" id="*30IbN$qnrZ.D=titF_%"> <field name="VAR" id="_gvJ%jiZuj,`TW~.!EkJ">Kippdauer_in_Prozent</field> </block> </value> </block> </value> <value name="THEN"> <block type="math_arithmetic" id="liGByF0/:4AoMT:uh|ik"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="PwSASKNH.f~=CAKCO#j{"> <field name="NUM">1</field> </shadow> <block type="math_number" id="VOw5Ld4OG}#!%ZN+G6l."> <field name="NUM">100</field> </block> </value> <value name="B"> <shadow type="math_number" id=")]wE{,6tqe%)P/l@5%H/"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="Bnn%!$R]w?:SH[}J^AGs"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="=JM1M/Vl(79W{-NRc*Jd"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="MX+abdOf`4!TN2iICU]e"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="XgSI#Evo#gFPsueQoGx:"> <field name="NUM">100</field> </shadow> <block type="math_number" id="c3aWFgy(N,k/qVbmUC!@"> <field name="NUM">100</field> </block> </value> <value name="B"> <shadow type="math_number" id="`6Mn$/v#q=tsD?rJVn+S"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="1$Sg=o/7-^8^m)OPk?d}"> <field name="VAR" id="_gvJ%jiZuj,`TW~.!EkJ">Kippdauer_in_Prozent</field> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="BYP8K5m*]i@hvd!oOvGS"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="]3t6/Qqi:X_FmujDl#A?"> <field name="VAR" id="=/.fldlHcxN4iQZ!6oak">aktuelle_Fahrt</field> </block> </value> </block> </value> </block> </value> <value name="ELSE"> <block type="math_number" id="AA}a^7S.tF9%xNebdT1|"> <field name="NUM">0</field> </block> </value> </block> </value> <next> <block type="variables_set" id="C`u0Ax=`!:ZP!8_?]$,7"> <field name="VAR" id="*.dUJw{n!a)gP+VHvR{+">letzteFahrt_close</field> <value name="VALUE"> <block type="variables_get" id="/!3`?$O?bWO,#y;Ub@Cf"> <field name="VAR" id="=/.fldlHcxN4iQZ!6oak">aktuelle_Fahrt</field> </block> </value> <next> <block type="variables_set" id="L#}aP)?;f?G*gl69Vn$B"> <field name="VAR" id="Jz;kTATl+nZ/%j4Jr~I$">letzteFahrt_open</field> <value name="VALUE"> <block type="math_number" id="!D(R36Jg2j`l1O6HgZ;T"> <field name="NUM">0</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <value name="IF1"> <block type="logic_compare" id="l6S27t}QLkSYsE6jipi{"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="0a+bl@6oleq~45*HMeu}"> <field name="VAR" id="[WI)a^2Z6Y^Cd2n9QmB,">Richtung</field> </block> </value> <value name="B"> <block type="text" id="6:P8[9xY3deocUI|_=Vx"> <field name="TEXT">open</field> </block> </value> </block> </value> <statement name="DO1"> <block type="variables_set" id="AJp(%w99qf3=;I||9xzJ"> <field name="VAR" id="=/.fldlHcxN4iQZ!6oak">aktuelle_Fahrt</field> <value name="VALUE"> <block type="math_arithmetic" id="m!_@{m=y2}N,O/f8S,Xb"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="|0}O}Uzn8BS3yGKxu^w$"> <field name="VAR" id="*Rgwj9#|oSb`YN/~SttT">Position_neu</field> </block> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="}?:Al;)Tj06%_*Refd53"> <field name="VAR" id="_=|52nLA}C#@Rt53Z)-1">Position_alt</field> </block> </value> </block> </value> <next> <block type="math_change" id="%5MFwg^Hr~?tUS`WbJ;#"> <field name="VAR" id="=/.fldlHcxN4iQZ!6oak">aktuelle_Fahrt</field> <value name="DELTA"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="9HwO@Y~6`2l1r1.rU1oY"> <field name="VAR" id="Jz;kTATl+nZ/%j4Jr~I$">letzteFahrt_open</field> </block> </value> <next> <block type="variables_set" id="b}OwWaiyf3SgV~aCw~9$"> <field name="VAR" id="knS^%O4Urb%r6);=xzwe">Tilt_level</field> <value name="VALUE"> <block type="logic_ternary" id="^9X$[`aPhm@hXBtd42nO"> <value name="IF"> <block type="logic_compare" id="ZF5J]1`9Pg+2^zwQs6%?"> <field name="OP">LTE</field> <value name="A"> <block type="variables_get" id="K7:2go#w*TqWrLu|.AIK"> <field name="VAR" id="=/.fldlHcxN4iQZ!6oak">aktuelle_Fahrt</field> </block> </value> <value name="B"> <block type="variables_get" id="n9KV|vU`Jfx$O{Yt28rP"> <field name="VAR" id="_gvJ%jiZuj,`TW~.!EkJ">Kippdauer_in_Prozent</field> </block> </value> </block> </value> <value name="THEN"> <block type="math_arithmetic" id="KvJ|Lv(dLXf/0h!]7f^c"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="WNa0t4X460%)U`*=o)dw"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="/U{{FUisGg7FmwM{AAWo"> <field name="NUM">100</field> </shadow> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="jp)DpLLQf8ylQQ2Raz3l"> <field name="VAR" id="_gvJ%jiZuj,`TW~.!EkJ">Kippdauer_in_Prozent</field> </block> </value> </block> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="_{/f-Cs},cWi.{k;8oD7"> <field name="VAR" id="=/.fldlHcxN4iQZ!6oak">aktuelle_Fahrt</field> </block> </value> </block> </value> <value name="ELSE"> <block type="math_number" id=":p9itu3s.CXFhkESaU3;"> <field name="NUM">100</field> </block> </value> </block> </value> <next> <block type="variables_set" id=":/?,O3^U-DSiCV|x,V45"> <field name="VAR" id="Jz;kTATl+nZ/%j4Jr~I$">letzteFahrt_open</field> <value name="VALUE"> <block type="variables_get" id="=rC]=-A:W#E:x!jk%lNs"> <field name="VAR" id="=/.fldlHcxN4iQZ!6oak">aktuelle_Fahrt</field> </block> </value> <next> <block type="variables_set" id="4]qs0G!CAql`9yIV77(?"> <field name="VAR" id="*.dUJw{n!a)gP+VHvR{+">letzteFahrt_close</field> <value name="VALUE"> <block type="math_number" id="/r5?$?;jw,9FM#nm-r#3"> <field name="NUM">0</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="timeouts_wait" id="lP%tUil;MlVGNRuiSzOz"> <field name="DELAY">50</field> <field name="UNIT">ms</field> <next> <block type="variables_set" id="rQ:.;Qiul8c)*iHo$=Wp"> <field name="VAR" id="_=|52nLA}C#@Rt53Z)-1">Position_alt</field> <value name="VALUE"> <block type="get_value_var" id="%aSb]l]}e+:r~@2q0%$7"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="gEL67krQ:tTAUhmdU^:e"> <field name="VAR" id="Xl7C$m/{Y!I?CLq4|v#Q">Datapoint_position</field> </block> </value> </block> </value> <next> <block type="control_ex" id="2g$R]8Ut.Y]?}-*EE7nn"> <field name="TYPE">false</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="OID"> <shadow type="field_oid" id="fmB*92yy{PB#r^X[7fAA"> <field name="oid">Object ID</field> </shadow> <block type="variables_get" id="3_=MpI?v)OWJ8t+FP@cI"> <field name="VAR" id="P;8?x}BqZ%a$u(De,c+=">Datapoint_Tilt_level</field> </block> </value> <value name="VALUE"> <shadow type="logic_boolean" id="s6o?E#T/NS*yW%8.FH!P"> <field name="BOOL">TRUE</field> </shadow> <block type="variables_get" id="z$q6(/}wSGz+mq)_#]+h"> <field name="VAR" id="knS^%O4Urb%r6);=xzwe">Tilt_level</field> </block> </value> <value name="DELAY_MS"> <shadow type="math_number" id="?erI54{j8(Nttyw$d-+,"> <field name="NUM">0</field> </shadow> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </xml>
- Den Pfad zu 2 Datenpunkten des Shellys: