NEWS
Посчитать кол-во включенных приборов
-
Решил задачу таким скриптом:
~~http://joxi.ru/nAyzgqJhYzQowr.jpg" />код:
! ````
<xml xmlns="http://www.w3.org/1999/xhtml"><block type="on_ext" id="4W3T6|*uuRs}?Zj,ei_V" x="-213" y="-787"><mutation items="10"></mutation>
<field name="CONDITION">ne</field><value name="OID0"><shadow type="field_oid" id="+:si#]d8X}[8p5t;SGr!"><field name="oid">mihome.0.devices.ctrl_neutral1_158d0001e6b56d.channel_0</field></shadow></value> <value name="OID1"><shadow type="field_oid" id="hky|]yX;1dv{XQ`FwV-o"><field name="oid">default</field></shadow> <block type="field_oid" id="3(WU~r*[)71~^Y`49gA:"><field name="oid">mihome.0.devices.ctrl_neutral1_158d0001e6c0dc.channel_0</field></block></value> <value name="OID2"><shadow type="field_oid" id="am)WPx5R#IwilKk%l^?O"><field name="oid">mihome.0.devices.ctrl_neutral1_158d0001f56a86.channel_0</field></shadow></value> <value name="OID3"><shadow type="field_oid" id="sxwQ,^kjXMN@.pead3G|"><field name="oid">mihome.0.devices.ctrl_neutral1_158d0001f56da6.channel_0</field></shadow></value> <value name="OID4"><shadow type="field_oid" id="oK!#wqr9x1QXfF|5?wj,"><field name="oid">mihome.0.devices.ctrl_neutral2_158d0002235aaa.channel_0</field></shadow></value> <value name="OID5"><shadow type="field_oid" id="DK.NymbA#?3JKs,+IL9,"><field name="oid">mihome.0.devices.ctrl_neutral2_158d0002235aaa.channel_1</field></shadow></value> <value name="OID6"><shadow type="field_oid" id="pMWPOR]S+W#G:nw!Xt!b"><field name="oid">mihome.0.devices.ctrl_neutral2_158d0002235b0e.channel_0</field></shadow></value> <value name="OID7"><shadow type="field_oid" id="Ta+h=]g%P7}ji#[~yf1v"><field name="oid">mihome.0.devices.ctrl_neutral2_158d0002237ecf.channel_0</field></shadow></value> <value name="OID8"><shadow type="field_oid" id="+9KcPW=e_Tns=Ly6]BG?"><field name="oid">mihome.0.devices.ctrl_neutral2_158d0002237ecf.channel_1</field></shadow></value> <value name="OID9"><shadow type="field_oid" id="iPL{n-z`U:sf76qbKj#-"><field name="oid">mihome.0.devices.gateway_7811dcdebfa0.on</field></shadow></value> <statement name="STATEMENT"><block type="variables_set" id="{OA2lk2[/j@{n*I-T!cd"><field name="VAR">c</field> <value name="VALUE"><block type="math_number" id="Y,cngSz~I^280Z|Q=A)7"><field name="NUM">0</field></block></value> <next><block type="controls_forEach" id="e8KX6kPRvDCW9th#1lE5"><field name="VAR">i</field> <value name="LIST"><block type="lists_create_with" id="G%qBp~2/UpHq{]u]:9Js"><mutation items="10"></mutation> <value name="ADD0"><block type="get_value" id="d]3B#FC~4!x=Dz-BC6?)"><field name="ATTR">val</field> <field name="OID">mihome.0.devices.ctrl_neutral1_158d0001e6b56d.channel_0</field></block></value> <value name="ADD1"><block type="get_value" id="JOiUkeT(t!tk!-bh25~~"><field name="ATTR">val</field> <field name="OID">mihome.0.devices.ctrl_neutral1_158d0001e6c0dc.channel_0</field></block></value> <value name="ADD2"><block type="get_value" id="ySK4c{gqFnE+*8`Nt3)O"><field name="ATTR">val</field> <field name="OID">mihome.0.devices.ctrl_neutral1_158d0001f56a86.channel_0</field></block></value> <value name="ADD3"><block type="get_value" id="W(#*u4^yQWPVZ~}:TW+)"><field name="ATTR">val</field> <field name="OID">mihome.0.devices.ctrl_neutral1_158d0001f56da6.channel_0</field></block></value> <value name="ADD4"><block type="get_value" id=",J;=D=EHuw#uyj*@a|I2"><field name="ATTR">val</field> <field name="OID">mihome.0.devices.ctrl_neutral2_158d0002235aaa.channel_0</field></block></value> <value name="ADD5"><block type="get_value" id="[5;rqG;x]8hOcG=zR?Zl"><field name="ATTR">val</field> <field name="OID">mihome.0.devices.ctrl_neutral2_158d0002235aaa.channel_1</field></block></value> <value name="ADD6"><block type="get_value" id="3~XQ7t95ZC6Iszfk:87E"><field name="ATTR">val</field> <field name="OID">mihome.0.devices.ctrl_neutral2_158d0002235b0e.channel_0</field></block></value> <value name="ADD7"><block type="get_value" id="XP.Pg6N1DUpV(h5xNtDN"><field name="ATTR">val</field> <field name="OID">mihome.0.devices.ctrl_neutral2_158d0002237ecf.channel_0</field></block></value> <value name="ADD8"><block type="get_value" id=")_Y^Cx#zoh!.0vAvrNfr"><field name="ATTR">val</field> <field name="OID">mihome.0.devices.ctrl_neutral2_158d0002237ecf.channel_1</field></block></value> <value name="ADD9"><block type="get_value" id="Tj3rJ1,Xss@_!c)RYviL"><field name="ATTR">val</field> <field name="OID">mihome.0.devices.gateway_7811dcdebfa0.on</field></block></value></block></value> <statement name="DO"><block type="controls_if" id="cJ2Kh[Fodvnu^*/`6Wd+"><mutation else="1"></mutation> <value name="IF0"><block type="logic_compare" id="W:8,}|-hE16Z`-|nwY~d"><field name="OP">EQ</field> <value name="A"><block type="variables_get" id="Nl%6NMVCX1eLorGF^PNh"><field name="VAR">i</field></block></value> <value name="B"><block type="logic_boolean" id="435a7byt!3B*=(F.n:8s"><field name="BOOL">TRUE</field></block></value></block></value> <statement name="DO0"><block type="variables_set" id="6uor=QdWqt!S+wB;,c|]"><field name="VAR">b</field> <value name="VALUE"><block type="math_number" id="Z]GB}XX.}:)xsx397jPW"><field name="NUM">1</field></block></value></block></statement> <statement name="ELSE"><block type="variables_set" id="=dP4u]3/BX4VWJXF)9!^"><field name="VAR">b</field> <value name="VALUE"><block type="math_number" id="J;DGHJREZl.KT2`0qea6"><field name="NUM">0</field></block></value></block></statement> <next><block type="variables_set" id="@@vIgtu_:*PM(`~},8RD"><field name="VAR">c</field> <value name="VALUE"><block type="math_arithmetic" id="D3kyAk]{,J|nhs!t.@SW"><field name="OP">ADD</field> <value name="A"><shadow type="math_number" id="5NJ5+TsZ_e`XnTx}f*!M"><field name="NUM">1</field></shadow> <block type="variables_get" id="j%6PCn/Wyp^ufbu#ZVi5"><field name="VAR">c</field></block></value> <value name="B"><shadow type="math_number" id="({V{gA0w;)sHp*ap~fw3"><field name="NUM">1</field></shadow> <block type="variables_get" id="krN^?.bLl:YM~M^w+l]n"><field name="VAR">b</field></block></value></block></value></block></next></block></statement> <next><block type="control" id="znIl*t4w!fh4S*#Nx]/]"><mutation delay_input="false"></mutation> <field name="OID">mihome.0.info.ActiveLamp</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"><block type="variables_get" id="`gimS#c[_5VdzTG`]]uW"><field name="VAR">c</field></block></value></block></next></block></next></block></statement></block></xml>! ````~~
-
Тоже задавался таким вопросом, решил так:
createState ("javascript.0.Power.ALL_Light", 0); on(/^megadd\.0\.(p7_P7|p8_P8|p9_P9|p11_P11|p12_P12|p13_P13|p22_P22|p23_P23|p24_P24|p25_P25|p26_P26|p27_P27|p28_P28)/, function (obj) { setState ("javascript.0.Power.ALL_Light", (getState('megadd.0.p7_P7').val + getState('megadd.0.p8_P8').val + getState('megadd.0.p9_P9').val + getState('megadd.0.p11_P11').val + getState('megadd.0.p12_P12').val + getState('megadd.0.p13_P13').val + getState('megadd.0.p22_P22').val + getState('megadd.0.p23_P23').val + getState('megadd.0.p24_P24').val + getState('megadd.0.p25_P25').val), true); });
Hey! Du scheinst an dieser Unterhaltung interessiert zu sein, hast aber noch kein Konto.
Hast du es satt, bei jedem Besuch durch die gleichen Beiträge zu scrollen? Wenn du dich für ein Konto anmeldest, kommst du immer genau dorthin zurück, wo du zuvor warst, und kannst dich über neue Antworten benachrichtigen lassen (entweder per E-Mail oder Push-Benachrichtigung). Du kannst auch Lesezeichen speichern und Beiträge positiv bewerten, um anderen Community-Mitgliedern deine Wertschätzung zu zeigen.
Mit deinem Input könnte dieser Beitrag noch besser werden 💗
Registrieren Anmelden