- ioBroker Community Home
- Deutsch
- Skripten / Logik
- Blockly
- Datenquelle ermitteln
Datenquelle ermitteln
-
Ok hier nun meine NodeRed Lösung.
Ich habe mal folgende Testdatenpunkte angelegt, damit das in etwa Deiner Struktur gleich kommt.

Ich habe also die Enums genommen, die im System verankert sind. ;)
Du siehst einmal ist der Raum Wohnzimmer, dann Bad.
[ { "id": "2df53e5d19a0cb01", "type": "ioBroker list", "z": "7e6af0015415146d", "name": "", "topic": "", "objType": "", "regex": "", "asArray": "false", "onlyIDs": "false", "withValues": "false", "x": 810, "y": 3180, "wires": [ [ "f8e6aad5dbd578ac" ] ] }, { "id": "87bcd684e308ef6e", "type": "debug", "z": "7e6af0015415146d", "name": "Raum", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1170, "y": 3180, "wires": [] }, { "id": "f8e6aad5dbd578ac", "type": "change", "z": "7e6af0015415146d", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$each(payload.enums,function($v, $k) {$contains($k,\"rooms\") ? $v})", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 990, "y": 3180, "wires": [ [ "87bcd684e308ef6e" ] ] }, { "id": "ca329680d55789a4", "type": "ioBroker in", "z": "7e6af0015415146d", "name": "", "topic": "0_userdata.0.Test.Temperaturen.*.Temperatur", "payloadType": "value", "onlyack": "", "func": "all", "gap": "", "fireOnStart": "false", "outFormat": "MQTT", "x": 210, "y": 3180, "wires": [ [ "d81ce08693b81463" ] ] }, { "id": "d81ce08693b81463", "type": "switch", "z": "7e6af0015415146d", "name": "", "property": "max", "propertyType": "flow", "rules": [ { "t": "lt", "v": "payload", "vt": "msg" }, { "t": "null" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 470, "y": 3180, "wires": [ [ "6db8ef90a96693aa" ], [ "6db8ef90a96693aa" ] ] }, { "id": "6db8ef90a96693aa", "type": "change", "z": "7e6af0015415146d", "name": "", "rules": [ { "t": "set", "p": "max", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 640, "y": 3180, "wires": [ [ "2df53e5d19a0cb01" ] ] }, { "id": "1869413e4e017020", "type": "inject", "z": "7e6af0015415146d", "name": "reset", "props": [ { "p": "reset", "v": "true", "vt": "bool" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "x": 470, "y": 3240, "wires": [ [ "e98b2e244eb334ee" ] ] }, { "id": "e98b2e244eb334ee", "type": "change", "z": "7e6af0015415146d", "name": "", "rules": [ { "t": "delete", "p": "max", "pt": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 650, "y": 3240, "wires": [ [] ] } ]Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.
-
Ok und hier nun meine Blockly Lösung - mit JS - ermittelt den Raum aus der Objekt ID

<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="ALTyF=LZs}rPzBcD(1^(">ID</variable> <variable id="b1|*w2/IBSZtltFBq[mt">Max</variable> </variables> <block type="procedures_defcustomreturn" id="9M;cS2116}Q=Cw,Bj614" x="87" y="-363"> <mutation statements="false"> <arg name="ID" varid="ALTyF=LZs}rPzBcD(1^("></arg> </mutation> <field name="NAME">getRoom</field> <field name="SCRIPT">dmFyIG9iaiA9IHt9Ow0Kb2JqLnNlYXJjaCA9IElEOw0Kb2JqLnJvb21zID0gZ2V0RW51bXMoJ3Jvb21zJyk7DQpyZXR1cm4gYXdhaXQganNvbmF0YUV4cHJlc3Npb24ob2JqLCIkLnJvb21zWyQkLnNlYXJjaCBpbiBtZW1iZXJzXS5uYW1lIik7</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="variables_set" id="hT|PTjDQZc|bKu:?[[zb" x="87" y="-287"> <field name="VAR" id="b1|*w2/IBSZtltFBq[mt">Max</field> <value name="VALUE"> <block type="math_number" id="F05G|j80GCJgv+,@tW_@"> <field name="NUM">-30</field> </block> </value> <next> <block type="on_ext" id="4}3oeeat{mVDhPWIv#$@"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="2"></mutation> <field name="CONDITION">any</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="O_Hiq6qP6{;ZCo,39k`U"> <field name="oid">0_userdata.0.Test.Temperaturen.Bad.Temperatur</field> </shadow> </value> <value name="OID1"> <shadow type="field_oid" id="0@$.bMAo[1#1/2mYKs8T"> <field name="oid">0_userdata.0.Test.Temperaturen.Wohnzimmer.Temperatur</field> </shadow> </value> <statement name="STATEMENT"> <block type="controls_if" id="`yyEGE6E{M?~Pe}kF4YB"> <value name="IF0"> <block type="logic_compare" id="El:P_-DP4vlJJY={Fd/("> <field name="OP">GT</field> <value name="A"> <block type="on_source" id="FM-hrz1fFe+I2YfRZWY:"> <field name="ATTR">state.val</field> </block> </value> <value name="B"> <block type="variables_get" id="zb(D$R30?UAw~A{O76r9"> <field name="VAR" id="b1|*w2/IBSZtltFBq[mt">Max</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="ipx(~jBY#t{IEa/1Mr@Z"> <field name="VAR" id="b1|*w2/IBSZtltFBq[mt">Max</field> <value name="VALUE"> <block type="on_source" id="%G0r$1HCsZ3#[r!yrL4a"> <field name="ATTR">state.val</field> </block> </value> <next> <block type="debug" id="Wg8Ay#ioly{/fkOTH:_R"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="!VL#h,d@zxcAl#6!0ut+"> <field name="TEXT">test</field> </shadow> <block type="procedures_callcustomreturn" id="YmgZHu$By;yP{|d}$XSE"> <mutation name="getRoom"> <arg name="ID"></arg> </mutation> <value name="ARG0"> <block type="on_source" id="UzY1~8w~z7.Xs#x9v;l1"> <field name="ATTR">id</field> </block> </value> </block> </value> </block> </next> </block> </statement> </block> </statement> </block> </next> </block> </xml>Der Reset wird momentan durch Neustart des Skripts gemacht. Aber das sollte ja kein Problem sein, das Maximum entsprechend zu setzen. Wenn ein Datenpunkt 2 Räumen zugeordnet ist, dann kommt ein Array mit beiden Räumen raus. ;)


Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.
-
In beiden Lösungen habe ich auf Arrays und Listen verzichtet, da es ja nur darum geht, ob es ein neues Maximum gibt und das wird einmal in der Variablen gespeichert. ggf. könnte man das Maximum auch in einem Datenpunkt festhalten. Die Werte, die kein Maximum darstellen sind mE unwichtig.
Das zyklische Auslesen aller Werte und speichern in Arrays kann man machen Ich bin davon kein Anhänger.

<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="ALTyF=LZs}rPzBcD(1^(">ID</variable> <variable id="b1|*w2/IBSZtltFBq[mt">Max</variable> <variable id="c|3E03D|}2G4$KV$KDcI">idsTemp</variable> </variables> <block type="procedures_defcustomreturn" id="9M;cS2116}Q=Cw,Bj614" x="-12" y="-362"> <mutation statements="false"> <arg name="ID" varid="ALTyF=LZs}rPzBcD(1^("></arg> </mutation> <field name="NAME">getRoom</field> <field name="SCRIPT">dmFyIG9iaiA9IHt9Ow0Kb2JqLnNlYXJjaCA9IElEOw0Kb2JqLnJvb21zID0gZ2V0RW51bXMoJ3Jvb21zJyk7DQpyZXR1cm4gYXdhaXQganNvbmF0YUV4cHJlc3Npb24ob2JqLCIkLnJvb21zWyQkLnNlYXJjaCBpbiBtZW1iZXJzXS5uYW1lIik7</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="variables_set" id="lsecKayOZ4=Vf/5EgJCm" x="-13" y="-288"> <field name="VAR" id="b1|*w2/IBSZtltFBq[mt">Max</field> <value name="VALUE"> <block type="math_number" id="e{A/ctXs0!;RsQl_8CBU"> <field name="NUM">-30</field> </block> </value> <next> <block type="variables_set" id="e|oEG20j1v?9MN[Ekgls"> <field name="VAR" id="c|3E03D|}2G4$KV$KDcI">idsTemp</field> <value name="VALUE"> <block type="lists_create_with" id="s/k[)5H$IS*+,-X`C.vj"> <mutation items="2"></mutation> <value name="ADD0"> <block type="field_oid" id="59TZ(Xip0eevyJ+Nz#W["> <field name="oid">0_userdata.0.Test.Temperaturen.Bad.Temperatur</field> </block> </value> <value name="ADD1"> <block type="field_oid" id="QE7RX_:Zn@LO7PuoNdD*"> <field name="oid">0_userdata.0.Test.Temperaturen.Wohnzimmer.Temperatur</field> </block> </value> </block> </value> <next> <block type="on_ext" id="a;ViTG!bb-pX.jTorvJ8"> <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="i%1xDs6.nZ9wnp2aj.MM"> <field name="oid">default</field> </shadow> <block type="variables_get" id="E@Gr[#Bwaf=tinJNsv+T"> <field name="VAR" id="c|3E03D|}2G4$KV$KDcI">idsTemp</field> </block> </value> <statement name="STATEMENT"> <block type="controls_forEach" id="8_xK-^laWl]^P}j::7mO"> <field name="VAR" id="ALTyF=LZs}rPzBcD(1^(">ID</field> <value name="LIST"> <block type="variables_get" id="c/y];d@:x;IgX3T?fOR3"> <field name="VAR" id="c|3E03D|}2G4$KV$KDcI">idsTemp</field> </block> </value> <statement name="DO"> <block type="controls_if" id="`yyEGE6E{M?~Pe}kF4YB"> <value name="IF0"> <block type="logic_compare" id="El:P_-DP4vlJJY={Fd/("> <field name="OP">GT</field> <value name="A"> <block type="get_value_var" id="@@uymSTw|kZqu.WZ:fs."> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id="`Gc7SE*~nsYba%DD$D`D"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="-!Y0v9V:jSN{KYT#),!m"> <field name="VAR" id="ALTyF=LZs}rPzBcD(1^(">ID</field> </block> </value> </block> </value> <value name="B"> <block type="variables_get" id="zb(D$R30?UAw~A{O76r9"> <field name="VAR" id="b1|*w2/IBSZtltFBq[mt">Max</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="ipx(~jBY#t{IEa/1Mr@Z"> <field name="VAR" id="b1|*w2/IBSZtltFBq[mt">Max</field> <value name="VALUE"> <block type="get_value_var" id="Va7]-8]?5(d/GAUyT{!,"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="j!GI7IU|Ri0M`gV`*tpg"> <field name="VAR" id="ALTyF=LZs}rPzBcD(1^(">ID</field> </block> </value> </block> </value> <next> <block type="debug" id="M%1)Q#tj4Zn(,C`Na^Y_"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id=":@[;Kk#l)s]su?JioeuF"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="/vI;M`yL[0/o4jJa1153"> <field name="VAR" id="b1|*w2/IBSZtltFBq[mt">Max</field> </block> </value> <next> <block type="debug" id="Wg8Ay#ioly{/fkOTH:_R"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="!VL#h,d@zxcAl#6!0ut+"> <field name="TEXT">test</field> </shadow> <block type="procedures_callcustomreturn" id="YmgZHu$By;yP{|d}$XSE"> <mutation name="getRoom"> <arg name="ID"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="U)I)Dcvbv7mJ%eMupUi="> <field name="VAR" id="ALTyF=LZs}rPzBcD(1^(">ID</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </statement> </block> </statement> </block> </statement> </block> </next> </block> </next> </block> </xml>Wie gesagt ich präferiere die Lösung ohne Listen und damit das Ermitteln des Maximums mit den jeweils aktuell eintrudelnden Werten.
Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.
-
In beiden Lösungen habe ich auf Arrays und Listen verzichtet, da es ja nur darum geht, ob es ein neues Maximum gibt und das wird einmal in der Variablen gespeichert. ggf. könnte man das Maximum auch in einem Datenpunkt festhalten. Die Werte, die kein Maximum darstellen sind mE unwichtig.
Das zyklische Auslesen aller Werte und speichern in Arrays kann man machen Ich bin davon kein Anhänger.

<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="ALTyF=LZs}rPzBcD(1^(">ID</variable> <variable id="b1|*w2/IBSZtltFBq[mt">Max</variable> <variable id="c|3E03D|}2G4$KV$KDcI">idsTemp</variable> </variables> <block type="procedures_defcustomreturn" id="9M;cS2116}Q=Cw,Bj614" x="-12" y="-362"> <mutation statements="false"> <arg name="ID" varid="ALTyF=LZs}rPzBcD(1^("></arg> </mutation> <field name="NAME">getRoom</field> <field name="SCRIPT">dmFyIG9iaiA9IHt9Ow0Kb2JqLnNlYXJjaCA9IElEOw0Kb2JqLnJvb21zID0gZ2V0RW51bXMoJ3Jvb21zJyk7DQpyZXR1cm4gYXdhaXQganNvbmF0YUV4cHJlc3Npb24ob2JqLCIkLnJvb21zWyQkLnNlYXJjaCBpbiBtZW1iZXJzXS5uYW1lIik7</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="variables_set" id="lsecKayOZ4=Vf/5EgJCm" x="-13" y="-288"> <field name="VAR" id="b1|*w2/IBSZtltFBq[mt">Max</field> <value name="VALUE"> <block type="math_number" id="e{A/ctXs0!;RsQl_8CBU"> <field name="NUM">-30</field> </block> </value> <next> <block type="variables_set" id="e|oEG20j1v?9MN[Ekgls"> <field name="VAR" id="c|3E03D|}2G4$KV$KDcI">idsTemp</field> <value name="VALUE"> <block type="lists_create_with" id="s/k[)5H$IS*+,-X`C.vj"> <mutation items="2"></mutation> <value name="ADD0"> <block type="field_oid" id="59TZ(Xip0eevyJ+Nz#W["> <field name="oid">0_userdata.0.Test.Temperaturen.Bad.Temperatur</field> </block> </value> <value name="ADD1"> <block type="field_oid" id="QE7RX_:Zn@LO7PuoNdD*"> <field name="oid">0_userdata.0.Test.Temperaturen.Wohnzimmer.Temperatur</field> </block> </value> </block> </value> <next> <block type="on_ext" id="a;ViTG!bb-pX.jTorvJ8"> <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="i%1xDs6.nZ9wnp2aj.MM"> <field name="oid">default</field> </shadow> <block type="variables_get" id="E@Gr[#Bwaf=tinJNsv+T"> <field name="VAR" id="c|3E03D|}2G4$KV$KDcI">idsTemp</field> </block> </value> <statement name="STATEMENT"> <block type="controls_forEach" id="8_xK-^laWl]^P}j::7mO"> <field name="VAR" id="ALTyF=LZs}rPzBcD(1^(">ID</field> <value name="LIST"> <block type="variables_get" id="c/y];d@:x;IgX3T?fOR3"> <field name="VAR" id="c|3E03D|}2G4$KV$KDcI">idsTemp</field> </block> </value> <statement name="DO"> <block type="controls_if" id="`yyEGE6E{M?~Pe}kF4YB"> <value name="IF0"> <block type="logic_compare" id="El:P_-DP4vlJJY={Fd/("> <field name="OP">GT</field> <value name="A"> <block type="get_value_var" id="@@uymSTw|kZqu.WZ:fs."> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id="`Gc7SE*~nsYba%DD$D`D"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="-!Y0v9V:jSN{KYT#),!m"> <field name="VAR" id="ALTyF=LZs}rPzBcD(1^(">ID</field> </block> </value> </block> </value> <value name="B"> <block type="variables_get" id="zb(D$R30?UAw~A{O76r9"> <field name="VAR" id="b1|*w2/IBSZtltFBq[mt">Max</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="ipx(~jBY#t{IEa/1Mr@Z"> <field name="VAR" id="b1|*w2/IBSZtltFBq[mt">Max</field> <value name="VALUE"> <block type="get_value_var" id="Va7]-8]?5(d/GAUyT{!,"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="j!GI7IU|Ri0M`gV`*tpg"> <field name="VAR" id="ALTyF=LZs}rPzBcD(1^(">ID</field> </block> </value> </block> </value> <next> <block type="debug" id="M%1)Q#tj4Zn(,C`Na^Y_"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id=":@[;Kk#l)s]su?JioeuF"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="/vI;M`yL[0/o4jJa1153"> <field name="VAR" id="b1|*w2/IBSZtltFBq[mt">Max</field> </block> </value> <next> <block type="debug" id="Wg8Ay#ioly{/fkOTH:_R"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="!VL#h,d@zxcAl#6!0ut+"> <field name="TEXT">test</field> </shadow> <block type="procedures_callcustomreturn" id="YmgZHu$By;yP{|d}$XSE"> <mutation name="getRoom"> <arg name="ID"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="U)I)Dcvbv7mJ%eMupUi="> <field name="VAR" id="ALTyF=LZs}rPzBcD(1^(">ID</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </statement> </block> </statement> </block> </statement> </block> </next> </block> </next> </block> </xml>Wie gesagt ich präferiere die Lösung ohne Listen und damit das Ermitteln des Maximums mit den jeweils aktuell eintrudelnden Werten.
Auch dir vielen Dank für deine Lösungsvorschläge. Schau ich mir an.
–
Ciao, Gerhard
-
In beiden Lösungen habe ich auf Arrays und Listen verzichtet, da es ja nur darum geht, ob es ein neues Maximum gibt und das wird einmal in der Variablen gespeichert. ggf. könnte man das Maximum auch in einem Datenpunkt festhalten. Die Werte, die kein Maximum darstellen sind mE unwichtig.
Das zyklische Auslesen aller Werte und speichern in Arrays kann man machen Ich bin davon kein Anhänger.

<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="ALTyF=LZs}rPzBcD(1^(">ID</variable> <variable id="b1|*w2/IBSZtltFBq[mt">Max</variable> <variable id="c|3E03D|}2G4$KV$KDcI">idsTemp</variable> </variables> <block type="procedures_defcustomreturn" id="9M;cS2116}Q=Cw,Bj614" x="-12" y="-362"> <mutation statements="false"> <arg name="ID" varid="ALTyF=LZs}rPzBcD(1^("></arg> </mutation> <field name="NAME">getRoom</field> <field name="SCRIPT">dmFyIG9iaiA9IHt9Ow0Kb2JqLnNlYXJjaCA9IElEOw0Kb2JqLnJvb21zID0gZ2V0RW51bXMoJ3Jvb21zJyk7DQpyZXR1cm4gYXdhaXQganNvbmF0YUV4cHJlc3Npb24ob2JqLCIkLnJvb21zWyQkLnNlYXJjaCBpbiBtZW1iZXJzXS5uYW1lIik7</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="variables_set" id="lsecKayOZ4=Vf/5EgJCm" x="-13" y="-288"> <field name="VAR" id="b1|*w2/IBSZtltFBq[mt">Max</field> <value name="VALUE"> <block type="math_number" id="e{A/ctXs0!;RsQl_8CBU"> <field name="NUM">-30</field> </block> </value> <next> <block type="variables_set" id="e|oEG20j1v?9MN[Ekgls"> <field name="VAR" id="c|3E03D|}2G4$KV$KDcI">idsTemp</field> <value name="VALUE"> <block type="lists_create_with" id="s/k[)5H$IS*+,-X`C.vj"> <mutation items="2"></mutation> <value name="ADD0"> <block type="field_oid" id="59TZ(Xip0eevyJ+Nz#W["> <field name="oid">0_userdata.0.Test.Temperaturen.Bad.Temperatur</field> </block> </value> <value name="ADD1"> <block type="field_oid" id="QE7RX_:Zn@LO7PuoNdD*"> <field name="oid">0_userdata.0.Test.Temperaturen.Wohnzimmer.Temperatur</field> </block> </value> </block> </value> <next> <block type="on_ext" id="a;ViTG!bb-pX.jTorvJ8"> <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="i%1xDs6.nZ9wnp2aj.MM"> <field name="oid">default</field> </shadow> <block type="variables_get" id="E@Gr[#Bwaf=tinJNsv+T"> <field name="VAR" id="c|3E03D|}2G4$KV$KDcI">idsTemp</field> </block> </value> <statement name="STATEMENT"> <block type="controls_forEach" id="8_xK-^laWl]^P}j::7mO"> <field name="VAR" id="ALTyF=LZs}rPzBcD(1^(">ID</field> <value name="LIST"> <block type="variables_get" id="c/y];d@:x;IgX3T?fOR3"> <field name="VAR" id="c|3E03D|}2G4$KV$KDcI">idsTemp</field> </block> </value> <statement name="DO"> <block type="controls_if" id="`yyEGE6E{M?~Pe}kF4YB"> <value name="IF0"> <block type="logic_compare" id="El:P_-DP4vlJJY={Fd/("> <field name="OP">GT</field> <value name="A"> <block type="get_value_var" id="@@uymSTw|kZqu.WZ:fs."> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id="`Gc7SE*~nsYba%DD$D`D"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="-!Y0v9V:jSN{KYT#),!m"> <field name="VAR" id="ALTyF=LZs}rPzBcD(1^(">ID</field> </block> </value> </block> </value> <value name="B"> <block type="variables_get" id="zb(D$R30?UAw~A{O76r9"> <field name="VAR" id="b1|*w2/IBSZtltFBq[mt">Max</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="ipx(~jBY#t{IEa/1Mr@Z"> <field name="VAR" id="b1|*w2/IBSZtltFBq[mt">Max</field> <value name="VALUE"> <block type="get_value_var" id="Va7]-8]?5(d/GAUyT{!,"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="j!GI7IU|Ri0M`gV`*tpg"> <field name="VAR" id="ALTyF=LZs}rPzBcD(1^(">ID</field> </block> </value> </block> </value> <next> <block type="debug" id="M%1)Q#tj4Zn(,C`Na^Y_"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id=":@[;Kk#l)s]su?JioeuF"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="/vI;M`yL[0/o4jJa1153"> <field name="VAR" id="b1|*w2/IBSZtltFBq[mt">Max</field> </block> </value> <next> <block type="debug" id="Wg8Ay#ioly{/fkOTH:_R"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="!VL#h,d@zxcAl#6!0ut+"> <field name="TEXT">test</field> </shadow> <block type="procedures_callcustomreturn" id="YmgZHu$By;yP{|d}$XSE"> <mutation name="getRoom"> <arg name="ID"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="U)I)Dcvbv7mJ%eMupUi="> <field name="VAR" id="ALTyF=LZs}rPzBcD(1^(">ID</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </statement> </block> </statement> </block> </statement> </block> </next> </block> </next> </block> </xml>Wie gesagt ich präferiere die Lösung ohne Listen und damit das Ermitteln des Maximums mit den jeweils aktuell eintrudelnden Werten.
So, die Lösung von @paul53 hab ich umgesetzt. Funktioniert so wie ich es mir vorgestellt habe. Danke dafür.
Die Node Red Lösung von @mickym hab ich mir angeschaut, aber da ich (leider) immernoch kein wirkliche Erfahrung mit JavaScript habe, ist mir die reine Blockly Lösung näher. Trotzdem auch dir danke für deine Hilfe.
–
Ciao, Gerhard
-
So, die Lösung von @paul53 hab ich umgesetzt. Funktioniert so wie ich es mir vorgestellt habe. Danke dafür.
Die Node Red Lösung von @mickym hab ich mir angeschaut, aber da ich (leider) immernoch kein wirkliche Erfahrung mit JavaScript habe, ist mir die reine Blockly Lösung näher. Trotzdem auch dir danke für deine Hilfe.
@linedancer Na meine Blockly-Lösungen greifen halt auf den Raum zu, den Du direkt im Admin eingegeben hast und nicht über eigene Zuordnungen. Und ich dachte das war Dein Hauptziel. Deswegen hab ich halt das Blockly entsprechend mit einer JS Funktion erweitert.
Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.
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