- Home
- Deutsch
- Skripten / Logik
- Blockly
- Ziggbee Geräteüberwachung verbessern
Ziggbee Geräteüberwachung verbessern
-
Hallo,
Ich habe mir ein Blockly-Script gebastelt um mir Geräte anzeigen zu lassen die die Verbindung verloren haben. Das klappt auch, aber das geht doch bestimmt auch "schöner" und schlanker. Im Moment bekomme ich die Anzahl der Geräte ohne Verbindung und ein (das letzte) Gerät ohne Verbindung als Text angezeigt.Mich stört aber an dem Script, dass ich mit so vielen Timeouts arbeiten muss um hoch zählen zu können, und immer nur ein Gerät als Text angezeigt wird. Ich würde gerne alle in einem Objekt hintereinander stehen haben.
Hat da jemand noch Tipps für mich?
<xml xmlns="http://www.w3.org/1999/xhtml"> <variables> <variable type="undefined" id="timeout">timeout</variable> <variable type="undefined" id="timeout2">timeout2</variable> <variable type="undefined" id="timeout3">timeout3</variable> <variable type="undefined" id="timeout4">timeout4</variable> <variable type="undefined" id="timeout5">timeout5</variable> <variable type="undefined" id="timeout6">timeout6</variable> <variable type="undefined" id="timeout7">timeout7</variable> <variable type="undefined" id="timeout8">timeout8</variable> <variable type="undefined" id="timeout9">timeout9</variable> <variable type="undefined" id="timeout10">timeout10</variable> </variables> <block type="schedule" id="L-|Q6KV7UXvdJY+q{Aj2" x="63" y="13"> <field name="SCHEDULE">{"time":{"start":"00:00","end":"23:59","mode":"hours","interval":2},"period":{"days":1}}</field> <statement name="STATEMENT"> <block type="control" id="SCc0D`MI_##YJ}k],/k^"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_number" id="cB%xuCz;H!@1m@U0Avw="> <field name="NUM">0</field> </block> </value> <next> <block type="timeouts_settimeout" id="Udwwd5-]l.!w]#TAN+D#"> <field name="NAME">timeout</field> <field name="DELAY">100</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="comment" id="6Dp|,B3VL32ul;oIOcxu"> <field name="COMMENT">Fensterkontackt Bad 1.OG</field> <next> <block type="controls_if" id="3YKL:EKAm39-U9};lPV#"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="n:1f}Fu(S4fGtUQCx{.|" inline="false"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="Lj]|#nCNBFD#yG.X6Cj6"> <field name="ATTR">ts</field> <field name="OID">zigbee.0.00158d00039fbe09.link_quality</field> </block> </value> <value name="B"> <block type="math_arithmetic" id="ECm4cQFP^1BMVg+kj~nD"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="|x#:^ms@8e3g-*E:_{BT"> <field name="NUM">1</field> </shadow> <block type="time_get" id="o?tF.6{sJM(GkGn@QIkz"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <value name="B"> <shadow type="math_number" id="1pj^)3ADU_?@Fv7V~WTF"> <field name="NUM">7200000</field> </shadow> </value> </block> </value> </block> </value> <statement name="ELSE"> <block type="control" id="Ng(Way:7)yg@^bi/b?Y^"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.Störung_Zigbee</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="ym,$$nT|UqS=b)e}vacE"> <field name="TEXT">Verbindung Fensterkontakt Bad 1.OG</field> </block> </value> <next> <block type="control" id="i1qeUVU`Q~)zy5T]8Xok"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="2Bee=pzY?#A{pQzR/$3x"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="nc,;jIF;Q54wE;.?g*M{"> <field name="NUM">1</field> </shadow> <block type="get_value" id="@eE@%~^RwlF/%%wJkHsW"> <field name="ATTR">val</field> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> </block> </value> <value name="B"> <shadow type="math_number" id="Zcdf5UdH7X~$ppm#2P0x"> <field name="NUM">1</field> </shadow> <block type="math_number" id="^vo:^co.-[C:.`=0O,m4"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </next> </block> </statement> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id="`mG9-%GI##+Zdfd6CZ;d"> <field name="NAME">timeout2</field> <field name="DELAY">150</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="comment" id="4d,Edb:LD4Lkr6bB}ope"> <field name="COMMENT">Bewegungsmelder Haustür</field> <next> <block type="controls_if" id="eDjYXK?=;t]K#@0pi4R^"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="8^2u1J*Od7{`O?^(JA9g" inline="false"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="UaW+Mp]8rcK]0.ll//Gz"> <field name="ATTR">ts</field> <field name="OID">zigbee.0.00158d00028b0ef9.link_quality</field> </block> </value> <value name="B"> <block type="math_arithmetic" id="_PKZViUd3A*2Q5d!XU.Y"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="|x#:^ms@8e3g-*E:_{BT"> <field name="NUM">1</field> </shadow> <block type="time_get" id="#ey_3d4G%Un7L18Mik{Y"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <value name="B"> <shadow type="math_number" id="A4,,t$XV7ny?DQJx,eV="> <field name="NUM">7200000</field> </shadow> </value> </block> </value> </block> </value> <statement name="ELSE"> <block type="control" id="9q2rPNsY4x~|vBQKGh@-"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.Störung_Zigbee</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="r#Vk?Jz_F[]A1D4Eqse@"> <field name="TEXT">Verbindung Bewegungsmelder Haustür</field> </block> </value> <next> <block type="control" id="%.bT|*Gt/G0(T.YIVv~("> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="]WnqE{blIj7Qn`a:_Hw`"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="nc,;jIF;Q54wE;.?g*M{"> <field name="NUM">1</field> </shadow> <block type="get_value" id="mp(6c46N,~H.N37[^OFO"> <field name="ATTR">val</field> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> </block> </value> <value name="B"> <shadow type="math_number" id="Zcdf5UdH7X~$ppm#2P0x"> <field name="NUM">1</field> </shadow> <block type="math_number" id="IEnyH{V;*wib0`iIl-a`"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </next> </block> </statement> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id="iZcft=?d_=t9eNIhmgpz"> <field name="NAME">timeout3</field> <field name="DELAY">200</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="comment" id="u~xDOwiVWc(7N-Y546u^"> <field name="COMMENT">Fensterkontackt Bad EG</field> <next> <block type="controls_if" id="Nru.yHp,/QHDOH;|b7fU"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="[x4w/ZM)6xg{na0e**2(" inline="false"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="mlsoKjk]j~a[C/OxB0Og"> <field name="ATTR">ts</field> <field name="OID">zigbee.0.00158d0002bfc99a.link_quality</field> </block> </value> <value name="B"> <block type="math_arithmetic" id=".0LR`WP|e3.S$_42xNk("> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="|x#:^ms@8e3g-*E:_{BT"> <field name="NUM">1</field> </shadow> <block type="time_get" id="K=%[56Pus0xuO62;IAN*"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <value name="B"> <shadow type="math_number" id="F!.BJc`wiSl:Y5%J=QeX"> <field name="NUM">7200000</field> </shadow> </value> </block> </value> </block> </value> <statement name="ELSE"> <block type="control" id="`,(pu0;_mcL`BR8to]b["> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.Störung_Zigbee</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="TfHT+xghzIec6QgMz.VG"> <field name="TEXT">Verbindung Fensterkontackt Bad EG</field> </block> </value> <next> <block type="control" id="vU%D+00DJ2!}khJuXtX-"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="e_Q,i`A!Fb?wY0E=?RFK"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="nc,;jIF;Q54wE;.?g*M{"> <field name="NUM">1</field> </shadow> <block type="get_value" id="n9PD[MF5oG{wGHDEW/HZ"> <field name="ATTR">val</field> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> </block> </value> <value name="B"> <shadow type="math_number" id="Zcdf5UdH7X~$ppm#2P0x"> <field name="NUM">1</field> </shadow> <block type="math_number" id="SM%E7/TJ8i4.)jQit5]l"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </next> </block> </statement> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id="pTzE,6uY,a6Ldb12R.?]"> <field name="NAME">timeout4</field> <field name="DELAY">250</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="comment" id="tes9Qj_Oea#EQ|aq)}jH"> <field name="COMMENT">Temperatursensor Bad EG</field> <next> <block type="controls_if" id="zQWR#+_~gh/t4m?+IW?R"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="-NVQ,/h?}i!ZtQ@C;}CT" inline="false"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="LE8^).Q8!!mMIGi_,~:4"> <field name="ATTR">ts</field> <field name="OID">zigbee.0.00158d000315dfbb.link_quality</field> </block> </value> <value name="B"> <block type="math_arithmetic" id="7e9n#$n*.o-qd%Qv.~rx"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="|x#:^ms@8e3g-*E:_{BT"> <field name="NUM">1</field> </shadow> <block type="time_get" id="ai:4WNwSP=6u.zN%5o8c"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <value name="B"> <shadow type="math_number" id="4EXeW1n9$^d)t@#mWs*]"> <field name="NUM">7200000</field> </shadow> </value> </block> </value> </block> </value> <statement name="ELSE"> <block type="control" id="y7rS=toPn8AczX%A/4U%"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.Störung_Zigbee</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="D]}3u%*,i|z],=D79O=6"> <field name="TEXT">VerbindungTemperatursensor Bad EG</field> </block> </value> <next> <block type="control" id=")3!NOHsHFJbXF*+cw3u+"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="j0a#qE*|RR-E![*hG7o2"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="nc,;jIF;Q54wE;.?g*M{"> <field name="NUM">1</field> </shadow> <block type="get_value" id="uHIi{g:nY:9`#:{^k2b7"> <field name="ATTR">val</field> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> </block> </value> <value name="B"> <shadow type="math_number" id="Zcdf5UdH7X~$ppm#2P0x"> <field name="NUM">1</field> </shadow> <block type="math_number" id="j:v*N^U_1YymKV-l)4[J"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </next> </block> </statement> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id="]JJuViM6aap`OMa~9uDw"> <field name="NAME">timeout5</field> <field name="DELAY">300</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="comment" id="VA2eU)?}W*ErK-?.x2Oa"> <field name="COMMENT">Button Radio</field> <next> <block type="controls_if" id="/@Eyu9whmn}k`Q7-^K`H"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id=".oJOX+`.nfiN.1Rfn[U8" inline="false"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="V+SCiA0j.C*i_uW%tks#"> <field name="ATTR">ts</field> <field name="OID">zigbee.0.00158d0003960e77.link_quality</field> </block> </value> <value name="B"> <block type="math_arithmetic" id="Tlqb7,~$jWiLY3JWEw];"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="|x#:^ms@8e3g-*E:_{BT"> <field name="NUM">1</field> </shadow> <block type="time_get" id="W#?8lw9zJNyy_wMVU)8s"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <value name="B"> <shadow type="math_number" id="j[H8wwoxe;3nIyctBQuL"> <field name="NUM">7200000</field> </shadow> </value> </block> </value> </block> </value> <statement name="ELSE"> <block type="control" id="E|a[S(cW}UDv=g@u4oh4"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.Störung_Zigbee</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="Wi`;MU-6QhuZ^`9P%x~N"> <field name="TEXT">Verbindung Button Radio</field> </block> </value> <next> <block type="control" id="_B.O9g`RYMUsWnC5rcM6"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="yG{]+vL5!]H]}K!x(rh}"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="nc,;jIF;Q54wE;.?g*M{"> <field name="NUM">1</field> </shadow> <block type="get_value" id="Apsx5w,G*tn9!)bQOomS"> <field name="ATTR">val</field> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> </block> </value> <value name="B"> <shadow type="math_number" id="Zcdf5UdH7X~$ppm#2P0x"> <field name="NUM">1</field> </shadow> <block type="math_number" id="IEXr8u$9KJB@3K:zLl$L"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </next> </block> </statement> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id=".PA#-UC7@o)!Jn.+CG@H"> <field name="NAME">timeout6</field> <field name="DELAY">350</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="comment" id="@7TE)i0;PH2eCWqsB?/H"> <field name="COMMENT">Sensor Kellertür verriegelt</field> <next> <block type="controls_if" id="?).gs3E6b*]joVh8!!+|"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="a[D+7vvKd./Hz=xV_V[u" inline="false"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id=",hx=JYY,[zNU3^VcDSQI"> <field name="ATTR">ts</field> <field name="OID">zigbee.0.00158d00039fefb8.link_quality</field> </block> </value> <value name="B"> <block type="math_arithmetic" id="`~2aKkc2w@T;K7mpo4JM"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="|x#:^ms@8e3g-*E:_{BT"> <field name="NUM">1</field> </shadow> <block type="time_get" id="L]n/J1h3lQ!N[+`)r6!]"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <value name="B"> <shadow type="math_number" id="lb^QESHjOQ!XXs_}|cnx"> <field name="NUM">7200000</field> </shadow> </value> </block> </value> </block> </value> <statement name="ELSE"> <block type="control" id="_IC:SnrBox{hOm#{KO?R"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.Störung_Zigbee</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="6[$n|N.(NiX;V;dpyad3"> <field name="TEXT">Verbindung Türkontackt Kellertür verriegelt</field> </block> </value> <next> <block type="control" id="]OfEMxw4]pk9LgG]{HLW"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="cYp-^^}=#.qcK$:-TtL3"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="nc,;jIF;Q54wE;.?g*M{"> <field name="NUM">1</field> </shadow> <block type="get_value" id=",2bTGaaGB,-#%{;UOoo("> <field name="ATTR">val</field> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> </block> </value> <value name="B"> <shadow type="math_number" id="Zcdf5UdH7X~$ppm#2P0x"> <field name="NUM">1</field> </shadow> <block type="math_number" id="*AuBm*zD55cOk(%.N=9:"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </next> </block> </statement> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id="9?E;Wv7J=AO6_JAt0fQ9"> <field name="NAME">timeout7</field> <field name="DELAY">400</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="comment" id="q-0y%R^%a~6tF*=E:Vgq"> <field name="COMMENT">Router EG</field> <next> <block type="controls_if" id="`--R-slGLUeVtCK;5W0["> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id=":Ym#5dM/#;U#XX(x*pO8" inline="false"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="7Y-q5Q5UvcQWTtR@J6A+"> <field name="ATTR">ts</field> <field name="OID">zigbee.0.00124b001bd80bf2.link_quality</field> </block> </value> <value name="B"> <block type="math_arithmetic" id="bO2*p0`n;b9`-k(o,`+@"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="|x#:^ms@8e3g-*E:_{BT"> <field name="NUM">1</field> </shadow> <block type="time_get" id="|P:3QcvToxpCkV.p5X_X"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <value name="B"> <shadow type="math_number" id="KBn.S3%Vk:7izOkYv.ck"> <field name="NUM">7200000</field> </shadow> </value> </block> </value> </block> </value> <statement name="ELSE"> <block type="control" id="ep(;~6+}@Ocl2QreKGYv"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.Störung_Zigbee</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="$k(40{%)2:5}K5l]cCTA"> <field name="TEXT">Verbindung Router EG Statusdisplay</field> </block> </value> <next> <block type="control" id=":``3nn8ti9aL8sZQWI*["> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="cJh+Qp2!}C~d6.jpGEac"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="nc,;jIF;Q54wE;.?g*M{"> <field name="NUM">1</field> </shadow> <block type="get_value" id="!oRFNY@uj{#c{@.#~zj{"> <field name="ATTR">val</field> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> </block> </value> <value name="B"> <shadow type="math_number" id="Zcdf5UdH7X~$ppm#2P0x"> <field name="NUM">1</field> </shadow> <block type="math_number" id="}Rh0c2c#HJzi)NLSu+~a"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </next> </block> </statement> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id=")3vERFg`dH3S!6ek$S;Z"> <field name="NAME">timeout8</field> <field name="DELAY">450</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="comment" id="4tt_f_qTArMl!*x]8@Ri"> <field name="COMMENT">Router Keller</field> <next> <block type="controls_if" id="DAo4yRF]`TW;(GmOI`To"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="$NEfoE={:1UpB;0wA4F7" inline="false"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="U7Y}@V*,(43/dGiqr2kl"> <field name="ATTR">ts</field> <field name="OID">zigbee.0.00124b001c3067e3.link_quality</field> </block> </value> <value name="B"> <block type="math_arithmetic" id="$0$[Zd`y7s*pb5;(+74:"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="|x#:^ms@8e3g-*E:_{BT"> <field name="NUM">1</field> </shadow> <block type="time_get" id="b4=43V%hQ^0W9FXYg1|I"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <value name="B"> <shadow type="math_number" id="jTH4J}k!35-pzOJTXp=a"> <field name="NUM">7200000</field> </shadow> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="controls_if" id="}d,P~TLy2lm#$n4?0^Q)"> <value name="IF0"> <block type="logic_compare" id="`D,4Av,vAB!;Q3-FbaX["> <field name="OP">EQ</field> <value name="A"> <block type="get_value" id="[0YwJ!OBR*g0x7p:HeS-"> <field name="ATTR">val</field> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> </block> </value> <value name="B"> <block type="math_number" id="afY3IOBe6m!+fYMvhx$V"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id=".Z]9_QQH{SUo=/-e,YjV"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.Störung_Zigbee</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="Wd*%E**lfh_K{+hnj#Pz"> <field name="TEXT">keins</field> </block> </value> </block> </statement> </block> </statement> <statement name="ELSE"> <block type="control" id="btE9;F~6s^+^Ay9a,Lkq"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.Störung_Zigbee</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="l3zDr?S3$:DT_Z82LM~W"> <field name="TEXT">Verbindung Router Keller</field> </block> </value> <next> <block type="control" id="Bl}iFg2{v(()APZ1CRup"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="pB0(]^Eew.WpXv[M?zi^"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="nc,;jIF;Q54wE;.?g*M{"> <field name="NUM">1</field> </shadow> <block type="get_value" id="mMP+5oci0PU;$bPdSJhi"> <field name="ATTR">val</field> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> </block> </value> <value name="B"> <shadow type="math_number" id="Zcdf5UdH7X~$ppm#2P0x"> <field name="NUM">1</field> </shadow> <block type="math_number" id="a5fQPJAZfmA/[nc}1|p9"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </next> </block> </statement> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id="fD8.?e/y=Xo*G}`q5pmL"> <field name="NAME">timeout9</field> <field name="DELAY">500</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="comment" id="FgSSd~PSckZ4_N)dq|Yy"> <field name="COMMENT">Fensterkontackt Fenster Schlafzimmer</field> <next> <block type="controls_if" id="ucgUq^1R-*7!h4!?{L)t"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="fDzn#$Cr=u{KI:$T@u{+" inline="false"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="_}2w:}Os._Y58L9s{4Ml"> <field name="ATTR">ts</field> <field name="OID">zigbee.0.00158d0004532078.link_quality</field> </block> </value> <value name="B"> <block type="math_arithmetic" id="Q}fXI)#)s7z_p.gUt(?@"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="|x#:^ms@8e3g-*E:_{BT"> <field name="NUM">1</field> </shadow> <block type="time_get" id="TkTX3ga:}I9@G8Q%|d-U"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <value name="B"> <shadow type="math_number" id="R-Tj^,m^1l^gS(vAxSi_"> <field name="NUM">7200000</field> </shadow> </value> </block> </value> </block> </value> <statement name="ELSE"> <block type="control" id="NbnyO,Fy==/k]kuj}Y~/"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.Störung_Zigbee</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="S%Tc(Q.DjJAe,seHTxhf"> <field name="TEXT">Verbindung Fensterkontackt Schlafzimmer</field> </block> </value> <next> <block type="control" id="+Ac(J8NwYD(GoP@+A|:4"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="?V_J,v8#)+^9+R2?YmG6"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="nc,;jIF;Q54wE;.?g*M{"> <field name="NUM">1</field> </shadow> <block type="get_value" id="aCpU_Wgr7!qsxIhgDI]S"> <field name="ATTR">val</field> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> </block> </value> <value name="B"> <shadow type="math_number" id="Zcdf5UdH7X~$ppm#2P0x"> <field name="NUM">1</field> </shadow> <block type="math_number" id="Bf)*og^}NK!s,rX6tj!b"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </next> </block> </statement> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id="}#}i~t$_]38n{v5ibwb!"> <field name="NAME">timeout10</field> <field name="DELAY">550</field> <field name="UNIT">ms</field> <statement name="STATEMENT"> <block type="comment" id="^P3L)SC{3%C{8h!W5tX-"> <field name="COMMENT">Fensterkontackt Balkontür Schlafzimmer</field> <next> <block type="controls_if" id=":eV]_Y*ks42zGB9p,iD|"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="KqKlvMy@l[2=-CSdSF[7" inline="false"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="KJc:+v?M6ocJ0;~B,UQ^"> <field name="ATTR">ts</field> <field name="OID">zigbee.0.00158d00035aca77.link_quality</field> </block> </value> <value name="B"> <block type="math_arithmetic" id="/z+x+g8[vqkmWZ$.YJj1"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="|x#:^ms@8e3g-*E:_{BT"> <field name="NUM">1</field> </shadow> <block type="time_get" id="_A)VKHF-MGgrbr~zogVW"> <mutation format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <value name="B"> <shadow type="math_number" id="$O;)o(J6[+O~c1vv{fS."> <field name="NUM">7200000</field> </shadow> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="controls_if" id="p7;F-((xTLc?E_xDE.9#"> <value name="IF0"> <block type="logic_compare" id="g35mW_(o.rjyO+??c?k7"> <field name="OP">EQ</field> <value name="A"> <block type="get_value" id="la6ZZ-Qn[KdUgfBE+wiE"> <field name="ATTR">val</field> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> </block> </value> <value name="B"> <block type="math_number" id="O6!{37jc(2hx?pEMn_*M"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="~{jHeQ6$6F]*b:dM,c(G"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.Störung_Zigbee</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="$lWBi8idg/NK/g[@g+BJ"> <field name="TEXT">keins</field> </block> </value> </block> </statement> </block> </statement> <statement name="ELSE"> <block type="control" id="I#A0zIT|ReStzm`ag6Ci"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.Störung_Zigbee</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="d2zR%f9[bA%ysYYJ]8mA"> <field name="TEXT">Verbindung Türkontackt Schlafzimmer</field> </block> </value> <next> <block type="control" id="!]c$55uMHDexrkDf7gG{"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="WXECM`C4Vn3O)}hj_0nG"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="nc,;jIF;Q54wE;.?g*M{"> <field name="NUM">1</field> </shadow> <block type="get_value" id="6Br:B.`yD1JV/k0L4(#^"> <field name="ATTR">val</field> <field name="OID">javascript.0.Eigene_Objekte.ZigbeeGeräte_mit_Störung</field> </block> </value> <value name="B"> <shadow type="math_number" id="Zcdf5UdH7X~$ppm#2P0x"> <field name="NUM">1</field> </shadow> <block type="math_number" id="zc,[ia%7bBA=fu/2v;fd"> <field name="NUM">1</field> </block> </value> </block> </value> </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> </next> </block> </next> </block> </statement> </block> </xml>
-
@hoktar sagte in Ziggbee Geräteüberwachung verbessern:
vielen Timeouts arbeiten muss um hoch zählen zu können, und immer nur ein Gerät als Text angezeigt wird.
Das geht ohne Timeouts, wenn man eine Skriptvariable anstelle eines Datenpunktes hochzählt. Prinzip:
-
oder du nimmst das hier:
createState('zigbeestatus.Anzahl_Geräte', 0, {type: 'number'}); createState('zigbeestatus.offline', 0, {type: 'number'}); createState('zigbeestatus.Gerät', " ", {type: 'string'}); const loggen = true; var arrOFFLINE; function offline(id){ var obj = getObject(id); arrOFFLINE.push(obj.common.name); if(loggen) log("Gerät: " + obj.common.name); } function countOffline() { var zigbee = $('channel[state.id=zigbee.*.link_quality]'); var moeglicheOFFLINE = 0; arrOFFLINE =[]; zigbee.each(function (id, i){ if(Math.round((new Date() - new Date(getState(id).ts)) / 1000 / 60) > 60) offline(id); ++moeglicheOFFLINE; }); if(loggen) log("Text: "+arrOFFLINE.join(', ')); if(loggen) log("Anzahl Geräte: " + moeglicheOFFLINE + " // davon offline: " + arrOFFLINE.length); setState("zigbeestatus.Gerät", arrOFFLINE.join(', ')); setState("zigbeestatus.offline", arrOFFLINE.length); setState("zigbeestatus.Anzahl_Geräte", moeglicheOFFLINE); } countOffline(); schedule("7 * * * *", countOffline);
-
@v522533 sagte:
if(Math.round((new Date() - new Date(getState(id).ts)) / 1000 / 60) > 60) offline(id);
Weshalb wird gerundet, wenn ein Vergleich "größer als" erfolgt ? Mit new Date() wird ein Date-Objekt erzeugt und die Subtraktion funktioniert nur aufgrund der impliziten Typwandlung von Javascript. Besser:
if(Date.now() - getState(id).ts > 3600000) offline(id);
-
@paul53 Ah, mit Skriptvariablen hatte ich es nicht ausprobiert. Mit Datenpunkten hat das nicht funktioniert. Werde ich dann mal ausprobieren.
Danke -
@paul53 sagte in Ziggbee Geräteüberwachung verbessern:
@v522533 sagte:
if(Math.round((new Date() - new Date(getState(id).ts)) / 1000 / 60) > 60) offline(id);
Weshalb wird gerundet, wenn ein Vergleich "größer als" erfolgt ? Mit new Date() wird ein Date-Objekt erzeugt und die Subtraktion funktioniert nur aufgrund der impliziten Typwandlung von Javascript. Besser:
if(Date.now() - getState(id).ts > 3600000) offline(id);
Das kann ich dir nicht sagen, weil ich mich mit javascript nicht auskenne, habe das skript kopiert und es funktioniert. das ist alles was ich sagen kann
habe die zeile durch deine ersetzt. danke dir