NEWS
Einfache Falls Abfrage geht nicht
-
Hallo,
meine einfache Abfrage bekomme ich nicht zum Laufen und verstehe nicht warum, es wird nur ein Boolean abgefragt und die . Meldung kommt nicht.
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="Py[rK)6s1i[2500)].{r">Lampe</variable> </variables> <block type="variables_set" id="l_VdLKv1l~xL,gMm6-gY" x="-1637" y="463"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> <value name="VALUE"> <block type="text" id="gPDfvyl8PJ/,XCbRt/B{"> <field name="TEXT">alias.0.Bad.Licht.Licht_Decke.ON</field> </block> </value> </block> <block type="on_ext" id="EUlhAA(rO@4E]G9~Vu(U" inline="true" x="-1687" y="538"> <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="IJiEC0UE3Hb:6sZ5ljpm"> <field name="oid">ID auswählen</field> </shadow> <block type="variables_get" id="QpCku!u~FRi{m.Y;aHQh"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> <statement name="STATEMENT"> <block type="debug" id="=w+SwR7e-fAhAXM7^TFf"> <field name="Severity">warn</field> <value name="TEXT"> <shadow type="text" id="I)KvULNvf!l]}O+kj.a0"> <field name="TEXT">gestartet</field> </shadow> <block type="text_join" id="ocfs|Gy}5CnOnPc!q|0L"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="}43%zl%Y#6/pe:*%O*N:"> <field name="TEXT">gestartet </field> </block> </value> <value name="ADD1"> <block type="get_value_var" id="+bE5|Af;3wvG6dd6h#|}"> <field name="ATTR">val</field> <value name="OID"> <shadow type="field_oid" id="Ro3Sc4:!_v!6z,_?VsLk"> <field name="oid">ID auswählen</field> </shadow> <block type="variables_get" id="g$[23}9Dn;`%]U55:)`N"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> </block> </value> </block> </value> <next> <block type="controls_if" id="YQY8`XBixA7?kv*6c]02"> <value name="IF0"> <block type="get_value_var" id="YyS_*z_4YBs|685YIFfn"> <field name="ATTR">val</field> <value name="OID"> <shadow type="field_oid" id="u{.YC(ln_Ug)igS%lGLQ"> <field name="oid">ID auswählen</field> </shadow> <block type="logic_compare" id="Bv+tvIFrGo}F_%y72vLL"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="CKsKU6mZQ-Teat(mGnyS"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> <value name="B"> <block type="logic_boolean" id="SA/BdyPxcmvfZ!Q%xn-}"> <field name="BOOL">TRUE</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="debug" id="id]hyxW+^/~(T9${lP[N"> <field name="Severity">error</field> <value name="TEXT"> <shadow type="text" id="!w(ktF{EE9v[o=G/*:9M"> <field name="TEXT">Lampe</field> </shadow> </value> </block> </statement> </block> </next> </block> </statement> </block> <block type="on_ext" id="/b{BPf+oYaoK.QmF?8Bo" inline="true" collapsed="true" disabled="true" x="-1412" y="538"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation> <field name="CONDITION">false</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="?//+uI=~Tq7~oEf[8o2%"> <field name="oid">ID auswählen</field> </shadow> <block type="variables_get" id="W,I26JNu$GH:fq3rwjHS"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> <statement name="STATEMENT"> <block type="control" id="QKJkdy?!@~ELkZ[!}avy"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">0_userdata.0.Bad.Licht.Bewegungsmelder_disable</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">2</field> <field name="UNIT">sec</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="##Qupd]K{nfN5kE0KTlz"> <field name="BOOL">FALSE</field> </block> </value> </block> </statement> </block> </xml> <xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="Py[rK)6s1i[2500)].{r">Lampe</variable> </variables> <block type="variables_set" id="l_VdLKv1l~xL,gMm6-gY" x="-1637" y="463"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> <value name="VALUE"> <block type="text" id="gPDfvyl8PJ/,XCbRt/B{"> <field name="TEXT">alias.0.Bad.Licht.Licht_Decke.ON</field> </block> </value> </block> <block type="on_ext" id="EUlhAA(rO@4E]G9~Vu(U" inline="true" x="-1687" y="538"> <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="IJiEC0UE3Hb:6sZ5ljpm"> <field name="oid">ID auswählen</field> </shadow> <block type="variables_get" id="QpCku!u~FRi{m.Y;aHQh"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> <statement name="STATEMENT"> <block type="debug" id="=w+SwR7e-fAhAXM7^TFf"> <field name="Severity">warn</field> <value name="TEXT"> <shadow type="text" id="I)KvULNvf!l]}O+kj.a0"> <field name="TEXT">gestartet</field> </shadow> <block type="text_join" id="ocfs|Gy}5CnOnPc!q|0L"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="}43%zl%Y#6/pe:*%O*N:"> <field name="TEXT">gestartet </field> </block> </value> <value name="ADD1"> <block type="get_value_var" id="+bE5|Af;3wvG6dd6h#|}"> <field name="ATTR">val</field> <value name="OID"> <shadow type="field_oid" id="Ro3Sc4:!_v!6z,_?VsLk"> <field name="oid">ID auswählen</field> </shadow> <block type="variables_get" id="g$[23}9Dn;`%]U55:)`N"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> </block> </value> </block> </value> <next> <block type="controls_if" id="YQY8`XBixA7?kv*6c]02"> <value name="IF0"> <block type="get_value_var" id="YyS_*z_4YBs|685YIFfn"> <field name="ATTR">val</field> <value name="OID"> <shadow type="field_oid" id="u{.YC(ln_Ug)igS%lGLQ"> <field name="oid">ID auswählen</field> </shadow> <block type="logic_compare" id="Bv+tvIFrGo}F_%y72vLL"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="CKsKU6mZQ-Teat(mGnyS"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> <value name="B"> <block type="logic_boolean" id="SA/BdyPxcmvfZ!Q%xn-}"> <field name="BOOL">TRUE</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="debug" id="id]hyxW+^/~(T9${lP[N"> <field name="Severity">error</field> <value name="TEXT"> <shadow type="text" id="!w(ktF{EE9v[o=G/*:9M"> <field name="TEXT">Lampe</field> </shadow> </value> </block> </statement> </block> </next> </block> </statement> </block> <block type="on_ext" id="/b{BPf+oYaoK.QmF?8Bo" inline="true" collapsed="true" disabled="true" x="-1412" y="538"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation> <field name="CONDITION">false</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="?//+uI=~Tq7~oEf[8o2%"> <field name="oid">ID auswählen</field> </shadow> <block type="variables_get" id="W,I26JNu$GH:fq3rwjHS"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> <statement name="STATEMENT"> <block type="control" id="QKJkdy?!@~ELkZ[!}avy"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">0_userdata.0.Bad.Licht.Bewegungsmelder_disable</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">2</field> <field name="UNIT">sec</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="##Qupd]K{nfN5kE0KTlz"> <field name="BOOL">FALSE</field> </block> </value> </block> </statement> </block> </xml>
Fehlermeldung::
javascript.0 2025-03-19 15:13:22.498 error at process.processImmediate (node:internal/timers:483:21) javascript.0 2025-03-19 15:13:22.498 error at Immediate.<anonymous> (file:///opt/iobroker/node_modules/@iobroker/db-states-redis/build/esm/lib/states/statesInRedisClient.js:291:37) javascript.0 2025-03-19 15:13:22.498 error at change (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/build/cjs/lib/adapter/adapter.js:7312:31) javascript.0 2025-03-19 15:13:22.498 error at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:645:29) javascript.0 2025-03-19 15:13:22.498 error at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1452:38) javascript.0 2025-03-19 15:13:22.498 error at Object.<anonymous> (script.js.Licht.Bad.V2_04:11:32) javascript.0 2025-03-19 15:13:22.498 error script.js.Licht.Bad.V2_04: TypeError: Cannot read properties of undefined (reading 'val') javascript.0 2025-03-19 15:13:22.496 error script.js.Licht.Bad.V2_04: getState has been called with id of type "boolean" but expects a string javascript.0 2025-03-19 15:13:22.496 warn script.js.Licht.Bad.V2_04: gestartet true javascript.0 2025-03-19 15:13:15.148 info script.js.Licht.Bad.V2_04: registered 1 subscription, 0 schedules, 0 messages, 0 logs and 0 file subscriptions javascript.0 2025-03-19 15:13:15.145 info Start JavaScript script.js.Licht.Bad.V2_04 (Blockly) javascript.0 2025-03-19 15:13:15.057 info Stopping script script.js.Licht.Bad.V2_04
Dann habe ich es so probiert::
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="Py[rK)6s1i[2500)].{r">Lampe</variable> </variables> <block type="variables_set" id="l_VdLKv1l~xL,gMm6-gY" x="-1637" y="463"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> <value name="VALUE"> <block type="text" id="gPDfvyl8PJ/,XCbRt/B{"> <field name="TEXT">alias.0.Bad.Licht.Licht_Decke.ON</field> </block> </value> </block> <block type="on_ext" id="EUlhAA(rO@4E]G9~Vu(U" inline="true" x="-1687" y="538"> <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="IJiEC0UE3Hb:6sZ5ljpm"> <field name="oid">ID auswählen</field> </shadow> <block type="variables_get" id="QpCku!u~FRi{m.Y;aHQh"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> <statement name="STATEMENT"> <block type="debug" id="=w+SwR7e-fAhAXM7^TFf"> <field name="Severity">warn</field> <value name="TEXT"> <shadow type="text" id="I)KvULNvf!l]}O+kj.a0"> <field name="TEXT">gestartet</field> </shadow> <block type="text_join" id="ocfs|Gy}5CnOnPc!q|0L"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="}43%zl%Y#6/pe:*%O*N:"> <field name="TEXT">gestartet </field> </block> </value> <value name="ADD1"> <block type="get_value_var" id="+bE5|Af;3wvG6dd6h#|}"> <field name="ATTR">val</field> <value name="OID"> <shadow type="field_oid" id="Ro3Sc4:!_v!6z,_?VsLk"> <field name="oid">ID auswählen</field> </shadow> <block type="variables_get" id="g$[23}9Dn;`%]U55:)`N"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> </block> </value> </block> </value> <next> <block type="controls_if" id="YQY8`XBixA7?kv*6c]02"> <value name="IF0"> <block type="logic_compare" id="Bv+tvIFrGo}F_%y72vLL"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="CKsKU6mZQ-Teat(mGnyS"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> <value name="B"> <block type="logic_boolean" id="SA/BdyPxcmvfZ!Q%xn-}"> <field name="BOOL">TRUE</field> </block> </value> </block> </value> <statement name="DO0"> <block type="debug" id="id]hyxW+^/~(T9${lP[N"> <field name="Severity">error</field> <value name="TEXT"> <shadow type="text" id="!w(ktF{EE9v[o=G/*:9M"> <field name="TEXT">Lampe</field> </shadow> </value> </block> </statement> </block> </next> </block> </statement> </block> <block type="on_ext" id="/b{BPf+oYaoK.QmF?8Bo" inline="true" collapsed="true" disabled="true" x="-1412" y="538"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation> <field name="CONDITION">false</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="?//+uI=~Tq7~oEf[8o2%"> <field name="oid">ID auswählen</field> </shadow> <block type="variables_get" id="W,I26JNu$GH:fq3rwjHS"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> <statement name="STATEMENT"> <block type="control" id="QKJkdy?!@~ELkZ[!}avy"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">0_userdata.0.Bad.Licht.Bewegungsmelder_disable</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">2</field> <field name="UNIT">sec</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="##Qupd]K{nfN5kE0KTlz"> <field name="BOOL">FALSE</field> </block> </value> </block> </statement> </block> </xml> <xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="Py[rK)6s1i[2500)].{r">Lampe</variable> </variables> <block type="variables_set" id="l_VdLKv1l~xL,gMm6-gY" x="-1637" y="463"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> <value name="VALUE"> <block type="text" id="gPDfvyl8PJ/,XCbRt/B{"> <field name="TEXT">alias.0.Bad.Licht.Licht_Decke.ON</field> </block> </value> </block> <block type="on_ext" id="EUlhAA(rO@4E]G9~Vu(U" inline="true" x="-1687" y="538"> <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="IJiEC0UE3Hb:6sZ5ljpm"> <field name="oid">ID auswählen</field> </shadow> <block type="variables_get" id="QpCku!u~FRi{m.Y;aHQh"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> <statement name="STATEMENT"> <block type="debug" id="=w+SwR7e-fAhAXM7^TFf"> <field name="Severity">warn</field> <value name="TEXT"> <shadow type="text" id="I)KvULNvf!l]}O+kj.a0"> <field name="TEXT">gestartet</field> </shadow> <block type="text_join" id="ocfs|Gy}5CnOnPc!q|0L"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="}43%zl%Y#6/pe:*%O*N:"> <field name="TEXT">gestartet </field> </block> </value> <value name="ADD1"> <block type="get_value_var" id="+bE5|Af;3wvG6dd6h#|}"> <field name="ATTR">val</field> <value name="OID"> <shadow type="field_oid" id="Ro3Sc4:!_v!6z,_?VsLk"> <field name="oid">ID auswählen</field> </shadow> <block type="variables_get" id="g$[23}9Dn;`%]U55:)`N"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> </block> </value> </block> </value> <next> <block type="controls_if" id="YQY8`XBixA7?kv*6c]02"> <value name="IF0"> <block type="logic_compare" id="Bv+tvIFrGo}F_%y72vLL"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="CKsKU6mZQ-Teat(mGnyS"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> <value name="B"> <block type="logic_boolean" id="SA/BdyPxcmvfZ!Q%xn-}"> <field name="BOOL">TRUE</field> </block> </value> </block> </value> <statement name="DO0"> <block type="debug" id="id]hyxW+^/~(T9${lP[N"> <field name="Severity">error</field> <value name="TEXT"> <shadow type="text" id="!w(ktF{EE9v[o=G/*:9M"> <field name="TEXT">Lampe</field> </shadow> </value> </block> </statement> </block> </next> </block> </statement> </block> <block type="on_ext" id="/b{BPf+oYaoK.QmF?8Bo" inline="true" collapsed="true" disabled="true" x="-1412" y="538"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation> <field name="CONDITION">false</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="?//+uI=~Tq7~oEf[8o2%"> <field name="oid">ID auswählen</field> </shadow> <block type="variables_get" id="W,I26JNu$GH:fq3rwjHS"> <field name="VAR" id="Py[rK)6s1i[2500)].{r">Lampe</field> </block> </value> <statement name="STATEMENT"> <block type="control" id="QKJkdy?!@~ELkZ[!}avy"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">0_userdata.0.Bad.Licht.Bewegungsmelder_disable</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">2</field> <field name="UNIT">sec</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="##Qupd]K{nfN5kE0KTlz"> <field name="BOOL">FALSE</field> </block> </value> </block> </statement> </block> </xml>
Fehlermeldung:
avascript.0 2025-03-19 15:24:08.033 warn script.js.Licht.Bad.V2_04: gestartet true
Obwohl true angezeigt wird, wird es nicht ausgeführt.
VG
Krodon
-
@krodon sagte: wird es nicht ausgeführt.
Du vergleichst die ID (String) mit wahr. Dabei ist es ganz einfach:
-
@paul53 ich wollte es aber mit der Variablen machen, damit ich den String nicht an allen Stellen, bei einer Änderung neu eintragen muss, gibt es hierzu eine Lösung?
VG
Krodon
-
@krodon Du hast einen Systematischen Fehler in deinem ersten Versuch:
Da passt im
falls
die Reihenfolge der Blöcke nicht:
muss so aussehen:
Dann macht das ganze mehr Sinn.
Allerdings ist die Optimierung die @paul53 geschrieben hat Sinnvoll. Auch da musst du die ID des DP nur einmal angeben. Du kannst natürlich an der mit X bezeichneten Stelle einfach die Variable
Lampe
andocken.A.
-
@krodon sagte: ich wollte es aber mit der Variablen machen
Variablen verwendet man dann, wenn ein Wert / String mehr als einmal verwendet wird.
-
@asgothian herzlichen Dank, ich kannte den Baustein Wert nicht, mit ihm ist vieles einfacher
VG
Krodon