- Home
- Deutsch
- Skripten / Logik
- Blockly
- Blocky optimieren
Blocky optimieren
-
Hallo, da ich durch einen Thread auf die Temperaturen von den shellys aufmerksam wurde, dachte ich mir ich könnte diese mal überwachen. Da ich keine VIS odersowas in der Art nutze, wollte ich gerne eine Tabelle als DP haben, welche ich mir in iogo anzeigen lassen.
Prinzipiell funktioniert mein Blockly, könnte aber schöner sein, vielleicht hat ja jemand eine Idee dazu.
So sieht das dann in iogo aus:
Habe verschiedene Probleme:- Da anfangs die min/max leer sind, lasse ich diese wenn diese nicht größer 1 sind mit dem aktuellen wert füllen. Mein einer shelly startet manchmal neu, dann kommt ein murks wert oder nichts an, konnte ich noch nicht debuggen, dann wird der min Wert gelöscht und dann wieder auf aktuell gesetzt.
Edit: hab´s jetzt gesehen, da kommt dann eine 0, das abzufangen sollte kein Problem sein, außer es gibt noch eine schönere Möglichkeit als da jetzt nochmal ein falls aktuell nicht 0 drum zu packen. - Ist es irgendwie möglich in der Zeile auch mit Tabs zu arbeiten um die Tabelle schöner zu gestalten?
- Die Namen gefallen mir nicht, ich hätte diese gerne anders genutzt, bei Trigger kann man Namen nutzen:
Bei system von Objekt aber nicht
Wo könnte man sonst den Namen der ID her bekommen?
Das war es erstmal, danke für die Hilfe schon mal.
Ach so, hier noch kurz als export:
<xml xmlns="http://www.w3.org/1999/xhtml"> <variables> <variable type="" id="6-NSNvNoEz?1lKL6k:DS">refresh</variable> <variable type="" id="D9*Bn`U-y,VGVGRp]^yj">Werteliste</variable> <variable type="" id="yDWW0r3P2Ahb:?-!suKL">maxliste</variable> <variable type="" id="a~QfOUlB..`d!;,{zp8}">minliste</variable> <variable type="" id="@.+iuhpl/ADF+nQ?vF4k">IDs</variable> <variable type="undefined" id="timeout">timeout</variable> <variable type="" id="``8:;7tB~x]UGem%LQ(#">i</variable> <variable type="" id="RF+MOC7s0xRV{]cS#2U%">ID</variable> <variable type="" id="T{lY1P!96C}|}Y!=ejmu">aktuell</variable> <variable type="" id="y(uBzzKuR%yAe2$lvq,^">max</variable> <variable type="" id="tJ--j+1TuaMl|7*:*wxP">min</variable> <variable type="" id="C9w91CfSxs]/G*?^hn:e">Wertezeile</variable> </variables> <block type="variables_set" id="3[?hdPO_W^(31}MB20ww" x="37" y="163"> <field name="VAR" id="6-NSNvNoEz?1lKL6k:DS" variabletype="">refresh</field> <value name="VALUE"> <block type="logic_boolean" id="]vX0DGkP!o`fGCdD*DYt"> <field name="BOOL">TRUE</field> </block> </value> <next> <block type="variables_set" id="N#5I]4NwI%e0oJ)@VV*J"> <field name="VAR" id="D9*Bn`U-y,VGVGRp]^yj" variabletype="">Werteliste</field> <value name="VALUE"> <block type="lists_split" id="s_uS|R!dz8zZ[dShE^v$"> <mutation mode="SPLIT"></mutation> <field name="MODE">SPLIT</field> <value name="INPUT"> <block type="field_oid" id="3p2c5lMp)|H{In*uyN-s"> <field name="oid">0_userdata.0.Funktionen.Sicherheit.Shelly</field> </block> </value> <value name="DELIM"> <shadow type="text" id="TCPndQh,chcs`:|2rtbU"> <field name="TEXT">,</field> </shadow> <block type="text_newline" id="SNQiwYXnXVb_q/04(sax"> <field name="Type">\n</field> </block> </value> </block> </value> <next> <block type="variables_set" id="=vXkQ%Dus`[3Z[.Eq1J!"> <field name="VAR" id="yDWW0r3P2Ahb:?-!suKL" variabletype="">maxliste</field> <value name="VALUE"> <block type="lists_split" id="OIm;lDlEvA)/o]J%WJ_Z"> <mutation mode="SPLIT"></mutation> <field name="MODE">SPLIT</field> <value name="INPUT"> <block type="field_oid" id="TV-DkQ}iNxl_BnD,h4_k"> <field name="oid">0_userdata.0.Funktionen.Sicherheit.shelly_max</field> </block> </value> <value name="DELIM"> <shadow type="text" id="3g0cB9Gd-(2TZiV)Q1nW"> <field name="TEXT">:</field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="G,]0;R*4!Z#zc.HQ3f%!"> <field name="VAR" id="a~QfOUlB..`d!;,{zp8}" variabletype="">minliste</field> <value name="VALUE"> <block type="lists_split" id="wzA2`j,2%J6{OlA~jvIF"> <mutation mode="SPLIT"></mutation> <field name="MODE">SPLIT</field> <value name="INPUT"> <block type="field_oid" id="Q4m*8(44;5g9[I@6d@|b"> <field name="oid">0_userdata.0.Funktionen.Sicherheit.shelly_min</field> </block> </value> <value name="DELIM"> <shadow type="text" id="TCPndQh,chcs`:|2rtbU"> <field name="TEXT">:</field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="|HC/U0jowh!|vP~RRCQ}"> <field name="VAR" id="@.+iuhpl/ADF+nQ?vF4k" variabletype="">IDs</field> <value name="VALUE"> <block type="lists_create_with" id="Y9kAJ:h3{Jw,UP%$A6qq"> <mutation items="12"></mutation> <value name="ADD0"> <block type="field_oid" id="SXJiC3%/q(}@LUlVisgg"> <field name="oid">linkeddevices.0.Shelly_Temp.Bad_Licht</field> </block> </value> <value name="ADD1"> <block type="field_oid" id="x#-/3j:Tay!0y1ja_j01"> <field name="oid">linkeddevices.0.Shelly_Temp.Bad_Waschbecken</field> </block> </value> <value name="ADD2"> <block type="field_oid" id="v4WIt%q_M]7EfZb[$L!m"> <field name="oid">linkeddevices.0.Shelly_Temp.Briefkasten</field> </block> </value> <value name="ADD3"> <block type="field_oid" id="6U=.@dUt9.{:=,@yU;Gd"> <field name="oid">linkeddevices.0.Shelly_Temp.Esszimmer</field> </block> </value> <value name="ADD4"> <block type="field_oid" id="2?NisqwpqDZl+FE2V]0W"> <field name="oid">linkeddevices.0.Shelly_Temp.Garage</field> </block> </value> <value name="ADD5"> <block type="field_oid" id="~l|d3cXV]li.8pNdjJVg"> <field name="oid">linkeddevices.0.Shelly_Temp.Garten_Laternen</field> </block> </value> <value name="ADD6"> <block type="field_oid" id="z[#woXWiX}ACX]@-F?h)"> <field name="oid">linkeddevices.0.Shelly_Temp.Keller_Pumpe</field> </block> </value> <value name="ADD7"> <block type="field_oid" id=",@:pUu{c[TLay^L4}Z;("> <field name="oid">linkeddevices.0.Shelly_Temp.Kinderzimmer</field> </block> </value> <value name="ADD8"> <block type="field_oid" id="Th9yu7jGpw.o]bmm`3:v"> <field name="oid">linkeddevices.0.Shelly_Temp.Markise</field> </block> </value> <value name="ADD9"> <block type="field_oid" id="|528?b|24=ZjP3yUf_K-"> <field name="oid">linkeddevices.0.Shelly_Temp.Spielhaus</field> </block> </value> <value name="ADD10"> <block type="field_oid" id="FX##O%W*E4XSj^9Hnm!1"> <field name="oid">linkeddevices.0.Shelly_Temp.Terrasse</field> </block> </value> <value name="ADD11"> <block type="field_oid" id="wFy6T70^i`BrhJv*x!P2"> <field name="oid">linkeddevices.0.Shelly_Temp.Wohnzimmer</field> </block> </value> </block> </value> <next> <block type="on_ext" id="wQK1+XKe/1y]eG5378HL"> <mutation items="1"></mutation> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="s1ypPcnYX$G*yCqmTkG]"> <field name="oid">default</field> </shadow> <block type="variables_get" id="?g,8l1xkU}%]W]INAfn!"> <field name="VAR" id="@.+iuhpl/ADF+nQ?vF4k" variabletype="">IDs</field> </block> </value> <statement name="STATEMENT"> <block type="controls_if" id="Yfja2E#j,9[D6:62}iM8"> <value name="IF0"> <block type="variables_get" id="(kvlm0qEy~Xf4I0l`qqE"> <field name="VAR" id="6-NSNvNoEz?1lKL6k:DS" variabletype="">refresh</field> </block> </value> <statement name="DO0"> <block type="variables_set" id="F|Zg7fF`4(7pK?aXy?C;"> <field name="VAR" id="6-NSNvNoEz?1lKL6k:DS" variabletype="">refresh</field> <value name="VALUE"> <block type="logic_boolean" id="Q,sIzh~ogqL3/egJ!G^d"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="timeouts_settimeout" id=",Hjos};^pH/KF9()/KN%"> <field name="NAME">timeout</field> <field name="DELAY">1</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="variables_set" id="l9`3JTip8K6gEZlt)XS8"> <field name="VAR" id="6-NSNvNoEz?1lKL6k:DS" variabletype="">refresh</field> <value name="VALUE"> <block type="logic_boolean" id="*+ww]#nzs*mem2)Sau]Y"> <field name="BOOL">TRUE</field> </block> </value> </block> </statement> <next> <block type="controls_for" id="|a]0!!t[RUkj_h,kf+I2"> <field name="VAR" id="``8:;7tB~x]UGem%LQ(#" variabletype="">i</field> <value name="FROM"> <shadow type="math_number" id="q4S6(UGpYLt9e3B}62yw"> <field name="NUM">1</field> </shadow> </value> <value name="TO"> <shadow type="math_number" id="rP.~.)4:G_DC1KYAnkmk"> <field name="NUM">10</field> </shadow> <block type="lists_length" id="2`6`t#Qja5QI_LcazuQ3"> <value name="VALUE"> <block type="variables_get" id="w/sg]V#sppi{hy3AF]g]"> <field name="VAR" id="@.+iuhpl/ADF+nQ?vF4k" variabletype="">IDs</field> </block> </value> </block> </value> <value name="BY"> <shadow type="math_number" id="xA/5PgFGd%-beG7DCNN!"> <field name="NUM">1</field> </shadow> </value> <statement name="DO"> <block type="variables_set" id="z{/I]N*)_icx8k[Q%%:@"> <field name="VAR" id="RF+MOC7s0xRV{]cS#2U%" variabletype="">ID</field> <value name="VALUE"> <block type="lists_getIndex" id="DbpZSb:|W=k|27k:,0:P"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="variables_get" id="WQz_;KO-?[L!p.m+Gmm?"> <field name="VAR" id="@.+iuhpl/ADF+nQ?vF4k" variabletype="">IDs</field> </block> </value> <value name="AT"> <block type="variables_get" id="E]w:Uu34-XtCc$PqX?ZF"> <field name="VAR" id="``8:;7tB~x]UGem%LQ(#" variabletype="">i</field> </block> </value> </block> </value> <next> <block type="variables_set" id="/S?HeBx8S#twke![`Ho^"> <field name="VAR" id="T{lY1P!96C}|}Y!=ejmu" variabletype="">aktuell</field> <value name="VALUE"> <block type="get_value_var" id="d6:I)p^}})mPUfOFG%tR"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id="D%ny=m)xboH:J:e+7__]"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="`x`ij;uDN;78ms_?RRpm"> <field name="VAR" id="RF+MOC7s0xRV{]cS#2U%" variabletype="">ID</field> </block> </value> </block> </value> <next> <block type="variables_set" id="Ti$yXcsiIfMq!#W._OJ["> <field name="VAR" id="y(uBzzKuR%yAe2$lvq,^" variabletype="">max</field> <value name="VALUE"> <block type="lists_getIndex" id="NR*DonfYkw{IJ4e!G49p"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="variables_get" id="J+oqNG@F:pJ$r~$T$eCJ"> <field name="VAR" id="yDWW0r3P2Ahb:?-!suKL" variabletype="">maxliste</field> </block> </value> <value name="AT"> <block type="variables_get" id="UK~v/zAz.?qmBW9|pO6d"> <field name="VAR" id="``8:;7tB~x]UGem%LQ(#" variabletype="">i</field> </block> </value> </block> </value> <next> <block type="variables_set" id="Gq`T?R|.+Xf7;=qq~frc"> <field name="VAR" id="tJ--j+1TuaMl|7*:*wxP" variabletype="">min</field> <value name="VALUE"> <block type="lists_getIndex" id="E^Gy$:iW8%Uz:F:p)P!{"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="variables_get" id="^Wm~ou.}0%sZyriqD3e("> <field name="VAR" id="a~QfOUlB..`d!;,{zp8}" variabletype="">minliste</field> </block> </value> <value name="AT"> <block type="variables_get" id=",0};^tWVl*;!uO,DD+{;"> <field name="VAR" id="``8:;7tB~x]UGem%LQ(#" variabletype="">i</field> </block> </value> </block> </value> <next> <block type="controls_if" id="~a[m;5s)aw.+FrxB5Vo;"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="logic_negate" id="^%bz%Cg-P~Y]oKs2g5z,"> <value name="BOOL"> <block type="logic_compare" id="},`Wimf@J,-EOCYbdU{*"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="$Bz~#:-C6Wbe1pT7{.j-"> <field name="VAR" id="y(uBzzKuR%yAe2$lvq,^" variabletype="">max</field> </block> </value> <value name="B"> <block type="math_number" id="3MdTJp!EpJ?PqQ6DOZAi"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="9Zxgt1XvPwC`/N4]WO7l"> <field name="VAR" id="y(uBzzKuR%yAe2$lvq,^" variabletype="">max</field> <value name="VALUE"> <block type="variables_get" id="l[-%l[GeZy{YImYZG}Gb"> <field name="VAR" id="T{lY1P!96C}|}Y!=ejmu" variabletype="">aktuell</field> </block> </value> </block> </statement> <value name="IF1"> <block type="logic_compare" id="l]k|qX%oi{L0j2QY@f/H"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="$0Pp~mYr8w:3ii_bU5/}"> <field name="VAR" id="y(uBzzKuR%yAe2$lvq,^" variabletype="">max</field> </block> </value> <value name="B"> <block type="variables_get" id=":b1GR^!HmBprD87GkS(8"> <field name="VAR" id="T{lY1P!96C}|}Y!=ejmu" variabletype="">aktuell</field> </block> </value> </block> </value> <statement name="DO1"> <block type="variables_set" id="UJ|BD}t747]zK5f)Y3a`"> <field name="VAR" id="y(uBzzKuR%yAe2$lvq,^" variabletype="">max</field> <value name="VALUE"> <block type="variables_get" id="(BNh[hoiL:*:ZkI4,#vh"> <field name="VAR" id="T{lY1P!96C}|}Y!=ejmu" variabletype="">aktuell</field> </block> </value> </block> </statement> <next> <block type="controls_if" id=";UMM!/_i#TI;@buXQ[?|"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="logic_negate" id="{Qu~,4iwN9{U.x6hn4%3"> <value name="BOOL"> <block type="logic_compare" id="hE#ekuOjuii+Ulk}k:5V"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="ps_^:Y`ec]F|5OHYc}TQ"> <field name="VAR" id="tJ--j+1TuaMl|7*:*wxP" variabletype="">min</field> </block> </value> <value name="B"> <block type="math_number" id="-}A2Uiea3z%Et(8AK(sp"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="H0_bgR?GYT[PBC^9y-_n"> <field name="VAR" id="tJ--j+1TuaMl|7*:*wxP" variabletype="">min</field> <value name="VALUE"> <block type="variables_get" id="pQf~K8{4wODcv)?LRnL%"> <field name="VAR" id="T{lY1P!96C}|}Y!=ejmu" variabletype="">aktuell</field> </block> </value> </block> </statement> <value name="IF1"> <block type="logic_compare" id="2~Q6+l^]~TYU7n@t5]Gt"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="!;-9m6L0HsF;Epo3!*q1"> <field name="VAR" id="tJ--j+1TuaMl|7*:*wxP" variabletype="">min</field> </block> </value> <value name="B"> <block type="variables_get" id="NEjwej#|+IZ{)F*x))RP"> <field name="VAR" id="T{lY1P!96C}|}Y!=ejmu" variabletype="">aktuell</field> </block> </value> </block> </value> <statement name="DO1"> <block type="variables_set" id="j`NJ0DG.mBkYXXwFKIj?"> <field name="VAR" id="tJ--j+1TuaMl|7*:*wxP" variabletype="">min</field> <value name="VALUE"> <block type="variables_get" id="B#1LW^A!omsEjBIy:F-M"> <field name="VAR" id="T{lY1P!96C}|}Y!=ejmu" variabletype="">aktuell</field> </block> </value> </block> </statement> <next> <block type="variables_set" id="mLuI(!2hD{K5~Q/}V!n:"> <field name="VAR" id="C9w91CfSxs]/G*?^hn:e" variabletype="">Wertezeile</field> <value name="VALUE"> <block type="text_join" id=".FasB0L[ie?6F{i8zHLU"> <mutation items="7"></mutation> <value name="ADD0"> <block type="text_getSubstring" id="-v4(^wG{k5~zRLE{M+-9"> <mutation at1="true" at2="false"></mutation> <field name="WHERE1">FROM_START</field> <field name="WHERE2">LAST</field> <value name="STRING"> <block type="variables_get" id="-M=/[-LodIb=t@O,)Dag"> <field name="VAR" id="RF+MOC7s0xRV{]cS#2U%" variabletype="">ID</field> </block> </value> <value name="AT1"> <block type="math_number" id="41$x6D]|A!bbe.Y5-n|*"> <field name="NUM">29</field> </block> </value> </block> </value> <value name="ADD1"> <block type="text" id="Rx.fi^A]EJRAB`AME-DM"> <field name="TEXT"> min:</field> </block> </value> <value name="ADD2"> <block type="variables_get" id="TS^SJ=ZuV11fcus5=[TU"> <field name="VAR" id="tJ--j+1TuaMl|7*:*wxP" variabletype="">min</field> </block> </value> <value name="ADD3"> <block type="text" id=";9yb{%7C+-ET@XWO)uj^"> <field name="TEXT"> akt:</field> </block> </value> <value name="ADD4"> <block type="variables_get" id="0dc]1qDzG921D6Tqc_G)"> <field name="VAR" id="T{lY1P!96C}|}Y!=ejmu" variabletype="">aktuell</field> </block> </value> <value name="ADD5"> <block type="text" id="^1yx17_X2:]l|7![1{c("> <field name="TEXT"> max:</field> </block> </value> <value name="ADD6"> <block type="variables_get" id="7c{`.i+f,{xQx+fx|^lF"> <field name="VAR" id="y(uBzzKuR%yAe2$lvq,^" variabletype="">max</field> </block> </value> </block> </value> <next> <block type="lists_setIndex" id="o4)PZ#zZLOJNGbsQLS;Z"> <mutation at="true"></mutation> <field name="MODE">SET</field> <field name="WHERE">FROM_START</field> <value name="LIST"> <block type="variables_get" id="`7wregI!9F:B5s3Q];qi"> <field name="VAR" id="D9*Bn`U-y,VGVGRp]^yj" variabletype="">Werteliste</field> </block> </value> <value name="AT"> <block type="variables_get" id="4N`iFGlUzrw/^3jG_~P)"> <field name="VAR" id="``8:;7tB~x]UGem%LQ(#" variabletype="">i</field> </block> </value> <value name="TO"> <block type="variables_get" id="w?Qrju_HR}FS#4,Ssa-^"> <field name="VAR" id="C9w91CfSxs]/G*?^hn:e" variabletype="">Wertezeile</field> </block> </value> <next> <block type="lists_setIndex" id="?SwhVnqn:/1!z_3?{F9["> <mutation at="true"></mutation> <field name="MODE">SET</field> <field name="WHERE">FROM_START</field> <value name="LIST"> <block type="variables_get" id="mi69:[AZ!pZZ~p#Tlr~*"> <field name="VAR" id="yDWW0r3P2Ahb:?-!suKL" variabletype="">maxliste</field> </block> </value> <value name="AT"> <block type="variables_get" id="1J;^bUT*yRst.RCrMcW`"> <field name="VAR" id="``8:;7tB~x]UGem%LQ(#" variabletype="">i</field> </block> </value> <value name="TO"> <block type="variables_get" id="!g=#L}Gmw4GXo6.R=(uR"> <field name="VAR" id="y(uBzzKuR%yAe2$lvq,^" variabletype="">max</field> </block> </value> <next> <block type="lists_setIndex" id=":[UaLTkcDLM$VCLdB*kt"> <mutation at="true"></mutation> <field name="MODE">SET</field> <field name="WHERE">FROM_START</field> <value name="LIST"> <block type="variables_get" id="e!/fH3=VLPCbMI/+gu0i"> <field name="VAR" id="a~QfOUlB..`d!;,{zp8}" variabletype="">minliste</field> </block> </value> <value name="AT"> <block type="variables_get" id="_Mt0`xhDge^KRcSUk0WP"> <field name="VAR" id="``8:;7tB~x]UGem%LQ(#" variabletype="">i</field> </block> </value> <value name="TO"> <block type="variables_get" id="8n,egA3:I?j@sA8b*2IR"> <field name="VAR" id="tJ--j+1TuaMl|7*:*wxP" variabletype="">min</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="control" id="d@W@G3:[e6u!BO0?rHxp"> <mutation delay_input="false"></mutation> <field name="OID">0_userdata.0.Funktionen.Sicherheit.Shelly</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="lists_split" id="?Jv2%D/ob$y^U(jUYElB"> <mutation mode="JOIN"></mutation> <field name="MODE">JOIN</field> <value name="INPUT"> <block type="variables_get" id="o;:|bJ;/J$tze.]Sya)$"> <field name="VAR" id="D9*Bn`U-y,VGVGRp]^yj" variabletype="">Werteliste</field> </block> </value> <value name="DELIM"> <shadow type="text" id="2JXKweJ~S-[n!|]inJ}f"> <field name="TEXT">,</field> </shadow> <block type="text_newline" id="r*k=CP6X07+9#Qti2I6q"> <field name="Type">\n</field> </block> </value> </block> </value> <next> <block type="control" id="J:|FN1jKb;Q~CW8UN(l?"> <mutation delay_input="false"></mutation> <field name="OID">0_userdata.0.Funktionen.Sicherheit.shelly_min</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="lists_split" id="S+`!m2RvvF]XHSCRrL54"> <mutation mode="JOIN"></mutation> <field name="MODE">JOIN</field> <value name="INPUT"> <block type="variables_get" id="~z@F!3uVnVEUkYb-#R@Z"> <field name="VAR" id="a~QfOUlB..`d!;,{zp8}" variabletype="">minliste</field> </block> </value> <value name="DELIM"> <shadow type="text" id="2JXKweJ~S-[n!|]inJ}f"> <field name="TEXT">:</field> </shadow> </value> </block> </value> <next> <block type="control" id="%,NO?{4_RhGZv,?*Y0fJ"> <mutation delay_input="false"></mutation> <field name="OID">0_userdata.0.Funktionen.Sicherheit.shelly_max</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="lists_split" id="O:yD_TXc-(TrH;tp_X`W"> <mutation mode="JOIN"></mutation> <field name="MODE">JOIN</field> <value name="INPUT"> <block type="variables_get" id=",zgF5{9JSV{A@sa$C#ye"> <field name="VAR" id="yDWW0r3P2Ahb:?-!suKL" variabletype="">maxliste</field> </block> </value> <value name="DELIM"> <shadow type="text" id="SDbq-:06*[})GZq0)d]J"> <field name="TEXT">:</field> </shadow> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </xml>
- Da anfangs die min/max leer sind, lasse ich diese wenn diese nicht größer 1 sind mit dem aktuellen wert füllen. Mein einer shelly startet manchmal neu, dann kommt ein murks wert oder nichts an, konnte ich noch nicht debuggen, dann wird der min Wert gelöscht und dann wieder auf aktuell gesetzt.
-
so, 1. hab ich jetzt selbst in Ordnung gebracht:
fehlt nur noch 2. und 3.
-
@e-s sagte in:
Ist es irgendwie möglich in der Zeile auch mit Tabs zu arbeiten um die Tabelle schöner zu gestalten?
Die Namen gefallen mir nicht, ich hätte diese gerne anders genutzt, bei Trigger kann man Namen nutzen:In Vis gibt es die JSON-Tabelle, in der Name, Min, Akt, Max Überschriften sind.
Ich würde innerhalb des Triggers keine Schleife verwenden, sondern mit dem Index der Listen arbeiten, etwa so (Blockly ist mir zu umständlich):const IDs = [ 'shelly.0.dev1.ext.temperature', 'shelly.0.dev2.ext.temperature', 'shelly.0.dev3.ext.temperature' ]; const idMin = 'Shelly.Temperatur.MinListe'; const idMax = 'Shelly.Temperatur.MaxListe'; const idJson = 'Shelly.Temperatur.Tabelle'; var minListe = []; var maxListe = []; var tabelle = []; if(existsState(idJson)) { // in Blockly als Javascript-Funktion mit Ergebnis minListe = getState(idMin).val; maxListe = getState(idMax).val; tabelle = JSON.parse(getState(idJson).val); } else { for(let i = 0; i < IDs.length; i++) { let id = IDs[i]; let val = getState(id).val; minListe[i] = val; maxListe[i] = val; tabelle[i] = { Name: getObject(id).common.name, Min: val, Akt: val, Max: val } } createState(idMin, minListe, {type: 'array'}); createState(idMax, maxListe, {type: 'array'}); createState(idJson, JSON.stringify(tabelle), {type: 'string'}); } on(IDs, function(dp) { let idx = IDs.indexOf(dp.id); let val = dp.state.val; let min = minListe[idx]; let max = maxListe[idx]; if(val < min) { min = val; minListe[idx] = val; setState(idMin, minListe, true); } if(val > max) { max = val; maxListe[idx] = val; setState(idMax, maxListe, true); } tabelle[idx].Min = min; tabelle[idx].Akt = val; tabelle[idx].Max = max; setState(idJson, JSON.stringify(tabelle), true); });
-
@paul53
Tabelle bzw. json geht derzeit noch nicht in iogo, deswegen ja dieser unschöne Datenpunkt, werde aber mal versuchen @nis zu überzeugen das einzubauen.
Danke, habe jetzt mein script an deinem angepasst und bin mit dem Ergebnis bis auf die Tabellenform zufrieden.