- ioBroker Community Home
- Deutsch
- Skripten / Logik
- Blockly
- [gelöst] Maximum aus Selektor
[gelöst] Maximum aus Selektor
-
Ich versuche meine Lüftung etwas weiter zu optimieren und versuche die maximale und "gemittelte" Luftfeuchtigkeit dazu zu verwenden. Dazu habe ich eine Aufzählung erstellt mit allen Hygrometerwerten, ermittle im Blockly die Anzahl und die Summe der Werte und bilde daraus den Mittelwert. Das klappt soweit. Allerdings scheitere ich daran aus der Aufzählung den Maximalwert zu ermitteln. Hatte mich an nen Tip von @paul53 gehalten (https://forum.iobroker.net/topic/35931/blockly-kleinster-wert-von-mehreren-dp-herausfinden/3) als Ergebnis kommt aber nur undefined und ich habe keinen Plan warum.
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="Ejg-VYVcC2R=NE.}}{/=">Maximum</variable>
<variable id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</variable>
<variable id="s2p-{W#Y9{8U)QwG7h}a">Summe</variable>
<variable id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</variable>
<variable id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</variable>
<variable id="v[$M9d1}YOgOF#gT~0u*">i</variable>
</variables>
<block type="on_ext" id="q;^(ON~A|[Ony6?],Ira" x="113" y="-62">
<mutation xmlns="http://www.w3.org/1999/xhtml" items="2"></mutation>
<field name="CONDITION">ne</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow type="field_oid" id="dAD~C;a#Mu7e?JqYjT@i">
<field name="oid">default</field>
</shadow>
<block type="selector" id="KBT|JX$6JlS0z6ae4/3o">
<field name="TEXT">stateid=*</field>
</block>
</value>
<value name="OID1">
<shadow type="field_oid" id="$NnAJOBY4fCl4[:e!{i/">
<field name="oid">0_userdata.0.Test.Test_Number</field>
</shadow>
</value>
<statement name="STATEMENT">
<block type="variables_set" id="V*#t4e4C@D7mS9pZ1[:"> <field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field> <value name="VALUE"> <block type="math_number" id=",;$m1xm^V9I]hGXZcSbp"> <field name="NUM">0</field> </block> </value> <next> <block type="variables_set" id="d8lr$a9m$JkF}RM(I:4["> <field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field> <value name="VALUE"> <block type="math_number" id="lK?~bXp{5/?SL%!9pG,X"> <field name="NUM">0</field> </block> </value> <next> <block type="variables_set" id="DF]k[.VulDG(r+^Nq+#|"> <field name="VAR" id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</field> <value name="VALUE"> <block type="math_number" id="8OD*Xjkoyac[+^tcL{jv"> <field name="NUM">0</field> </block> </value> <next> <block type="variables_set" id="L@[~x+L*wP/LOfS_c2Tu"> <field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field> <value name="VALUE"> <block type="math_number" id="@D|m)|PLDbjc,alB3|~@"> <field name="NUM">0</field> </block> </value> <next> <block type="controls_forEach" id="ioen|%H^B):0ag]^.7b!"> <field name="VAR" id="v[$M9d1}YOgOF#gT~0u*">i</field> <value name="LIST"> <block type="selector" id="SN45+2xki[!#zw~-vvPc"> <field name="TEXT">state[id=*](functions="humidity-inside")</field> </block> </value> <statement name="DO"> <block type="math_change" id="ant*pGup:l}|S$PP1{r">
<field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field>
<value name="DELTA">
<shadow type="math_number" id="xmGu+y04Xd.BbMp9II@D">
<field name="NUM">1</field>
</shadow>
</value>
<next>
<block type="math_change" id="p*(=,r0pLeW|~un/7@(">
<field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field>
<value name="DELTA">
<shadow type="math_number" id="eHvfCJBn#.t6{NZaA44O">
<field name="NUM">1</field>
</shadow>
<block type="get_value_var" id="V47~^^jR+[RDQf4gmj">
<field name="ATTR">val</field>
<value name="OID">
<shadow type="field_oid" id=")n9xT-FG_8lBQmKq8w-S">
<field name="oid">Object ID</field>
</shadow>
<block type="variables_get" id="1uC7~tZOhkJ7mi)]^1f[">
<field name="VAR" id="v[$M9d1}YOgOF#gT~0u*">i</field>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" id="LV#hdPmGc1#sOhm:t,Ki">
<field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field>
<value name="VALUE">
<block type="convert_tonumber" id="+T5-K~QERGlHK82$!wRr">
<value name="VALUE">
<block type="get_value_var" id="MROa6uo?8qZt3cV:o]I"> <field name="ATTR">val</field> <value name="OID"> <shadow type="field_oid" id=")n9xT-FG_8lBQmKq8w-S"> <field name="oid">Object ID</field> </shadow> <block type="variables_get" id="G;[R3?hUbz!mB#.__p#]"> <field name="VAR" id="v[$M9d1}YOgOF#gT~0u*">i</field> </block> </value> </block> </value> </block> </value> <next> <block type="controls_if" id="(mil(?yR-)lM)NbKL(Z)"> <value name="IF0"> <block type="logic_compare" id="+e2J12qw2UIeIvI#*miY"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="_#C^9l(SW_m:C%n*1%E">
<field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field>
</block>
</value>
<value name="B">
<block type="variables_get" id="8bPs:}+6vqwv.|)%Lu=/">
<field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="dnL_G???FU,emwfyN%M"> <field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field> <value name="VALUE"> <block type="convert_tonumber" id="?^c7|T{1Mz9~:~Lh{^q">
<value name="VALUE">
<block type="variables_get" id="m}G~wGv{LNv@VVoo}7+"> <field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field> </block> </value> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="variables_set" id="l%U}t2JFEQ:^N.I[go/}"> <field name="VAR" id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</field> <value name="VALUE"> <block type="math_rndfixed" id="1SO?%nHyZl.Uu=objlFw"> <field name="n">1</field> <value name="x"> <shadow type="math_number" id="?DmFi}z#:cb13u8nG{X1"> <field name="NUM">3.1234</field> </shadow> <block type="math_arithmetic" id="b@ZBz|D)N|Xl8[|w/4e/"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="0:O)LSWtVE_SNJ*.aWW|"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="7(YM4qD#bOL}6n|ebHxn"> <field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field> </block> </value> <value name="B"> <shadow type="math_number" id="~0nt.g!S;jO.YsTv#QR">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="d6/r|5V:QlyRJ+:CxKaF">
<field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field>
</block>
</value>
</block>
</value>
</block>
</value>
<next>
<block type="debug" id="+OZTt00CUiUC4=yo?OjV" collapsed="true">
<field name="Severity">warn</field>
<value name="TEXT">
<shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw">
<field name="TEXT">test</field>
</shadow>
<block type="variables_get" id="S^!2%QIltg.4}H?VvhN">
<field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field>
</block>
</value>
<next>
<block type="debug" id="pt!9F_3o3CxWoMAl:r/" collapsed="true">
<field name="Severity">warn</field>
<value name="TEXT">
<shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw">
<field name="TEXT">test</field>
</shadow>
<block type="variables_get" id="uc:Su$^N#wKlJF-Bk~W"> <field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field> </block> </value> <next> <block type="debug" id="a{LMA+Lia,Sk,ke%?oEb" collapsed="true"> <field name="Severity">warn</field> <value name="TEXT"> <shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="F=U9Un?:0kO+iArl4/v6"> <field name="VAR" id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</field> </block> </value> <next> <block type="debug" id="R0ga,0My#EBryT24/" collapsed="true"> <field name="Severity">warn</field> <value name="TEXT"> <shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="?X_ZX*j.~4EZ!M%V-m8I"> <field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> <block type="variables_set" id="iO),hH6ep+-Kf;MyBP]" x="512" y="363">
<field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field>
<value name="VALUE">
<block type="convert_tonumber" id="rY=q]f(4(Fz0(%mhV1*"></block> </value> </block> </xml> [/s] Ich versuche meine Lüftung etwas weiter zu optimieren und versuche die maximale und "gemittelte" Luftfeuchtigkeit dazu zu verwenden. Dazu habe ich eine Aufzählung erstellt mit allen Hygrometerwerten, ermittle im Blockly die Anzahl und die Summe der Werte und bilde daraus den Mittelwert. Das klappt soweit. Allerdings scheitere ich daran aus der Aufzählung den Maximalwert zu ermitteln. Hatte mich an nen Tip von @paul53 gehalten (https://forum.iobroker.net/topic/35931/blockly-kleinster-wert-von-mehreren-dp-herausfinden/3) als Ergebnis kommt aber nur undefined und ich habe keinen Plan warum. [s=Blockly Export] <xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="Ejg-VYVcC2R=NE.}}{/=">Maximum</variable> <variable id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</variable> <variable id="s2p-{W#Y9{8U)QwG7h}a">Summe</variable> <variable id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</variable> <variable id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</variable> <variable id="v[$M9d1}YOgOF#gT~0u*">i</variable> </variables> <block type="on_ext" id="q;^(ON~A|[Ony6?],Ira" x="113" y="-62"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="2"></mutation> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="dAD~C;a#Mu7e?JqYjT@i"> <field name="oid">default</field> </shadow> <block type="selector" id="KBT|JX$6JlS0z6ae4/3o"> <field name="TEXT">state[id=*](functions="humidity-inside")</field> </block> </value> <value name="OID1"> <shadow type="field_oid" id="$NnAJOBY4fCl4[:e!{i/"> <field name="oid">0_userdata.0.Test.Test_Number</field> </shadow> </value> <statement name="STATEMENT"> <block type="variables_set" id="V*#t4e4C@D7mS9pZ1[:">
<field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field>
<value name="VALUE">
<block type="math_number" id=",;$m1xm^V9I]hGXZcSbp">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="variables_set" id="d8lr$a9m$JkF}RM(I:4[">
<field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field>
<value name="VALUE">
<block type="math_number" id="lK?~bXp{5/?SL%!9pG,X">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="variables_set" id="DF]k[.VulDG(r+^Nq+#|">
<field name="VAR" id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</field>
<value name="VALUE">
<block type="math_number" id="8ODXjkoyac[+^tcL{jv">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="variables_set" id="L@[~x+LwP/LOfS_c2Tu">
<field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field>
<value name="VALUE">
<block type="math_number" id="@D|m)|PLDbjc,alB3|~@">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="controls_forEach" id="ioen|%H^B):0ag]^.7b!">
<field name="VAR" id="v[$M9d1}YOgOF#gT~0u">i</field>
<value name="LIST">
<block type="selector" id="SN45+2xki[!#zw~-vvPc">
<field name="TEXT">stateid=*</field>
</block>
</value>
<statement name="DO">
<block type="math_change" id="antpGup:l}|S$PP1{r"> <field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field> <value name="DELTA"> <shadow type="math_number" id="xmGu+y04Xd.BbMp9II@D"> <field name="NUM">1</field> </shadow> </value> <next> <block type="math_change" id="p*(=,r0pLeW|~un/_7@("> <field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field> <value name="DELTA"> <shadow type="math_number" id="eHvfCJBn#.t6{NZaA44O"> <field name="NUM">1</field> </shadow> <block type="get_value_var" id="V*47~^^jR+[RDQf4g*mj"> <field name="ATTR">val</field> <value name="OID"> <shadow type="field_oid" id=")n9xT-FG_8lBQmKq8w-S"> <field name="oid">Object ID</field> </shadow> <block type="variables_get" id="1uC7~tZOhkJ7mi)]^1f["> <field name="VAR" id="v[$M9d1}YOgOF#gT~0u*">i</field> </block> </value> </block> </value> <next> <block type="variables_set" id="LV#hdPmGc1#sOhm:t,Ki"> <field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field> <value name="VALUE"> <block type="convert_tonumber" id="+T5-K~QERGlHK82$!wRr"> <value name="VALUE"> <block type="get_value_var" id="MROa6uo?8qZt3cV:o]I">
<field name="ATTR">val</field>
<value name="OID">
<shadow type="field_oid" id=")n9xT-FG_8lBQmKq8w-S">
<field name="oid">Object ID</field>
</shadow>
<block type="variables_get" id="G;[R3?hUbz!mB#.__p#]">
<field name="VAR" id="v[$M9d1}YOgOF#gT~0u">i</field>
</block>
</value>
</block>
</value>
</block>
</value>
<next>
<block type="controls_if" id="(mil(?yR-)lM)NbKL(Z)">
<value name="IF0">
<block type="logic_compare" id="+e2J12qw2UIeIvI#*miY">
<field name="OP">GT</field>
<value name="A">
<block type="variables_get" id="#C^9l(SW_m:C%n*1%E"> <field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field> </block> </value> <value name="B"> <block type="variables_get" id="8bPs:}+6vqwv.|)%Lu=/"> <field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="dnL_G???FU,emwfyN%M">
<field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field>
<value name="VALUE">
<block type="convert_tonumber" id="?^c7|T{1Mz9~:~Lh{^q"> <value name="VALUE"> <block type="variables_get" id="m}G~wGv{LNv@VVoo}7+">
<field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field>
</block>
</value>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
<next>
<block type="variables_set" id="l%U}t2JFEQ:^N.I[go/}">
<field name="VAR" id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</field>
<value name="VALUE">
<block type="math_rndfixed" id="1SO?%nHyZl.Uu=objlFw">
<field name="n">1</field>
<value name="x">
<shadow type="math_number" id="?DmFi}z#:cb13u8nG{X1">
<field name="NUM">3.1234</field>
</shadow>
<block type="math_arithmetic" id="b@ZBz|D)N|Xl8[|w/4e/">
<field name="OP">DIVIDE</field>
<value name="A">
<shadow type="math_number" id="0:O)LSWtVE_SNJ*.aWW|">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="7(YM4qD#bOL}6n|ebHxn">
<field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field>
</block>
</value>
<value name="B">
<shadow type="math_number" id="~0nt.g!S;jO.YsTv#QR"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="d6/r|5V:QlyRJ+:CxKaF"> <field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field> </block> </value> </block> </value> </block> </value> <next> <block type="debug" id="+OZTt00CUiUC4=yo?OjV" collapsed="true"> <field name="Severity">warn</field> <value name="TEXT"> <shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="S_^!2%QIltg.4}H?VvhN"> <field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field> </block> </value> <next> <block type="debug" id="pt!9F_3o3CxWoMAl:r/_" collapsed="true"> <field name="Severity">warn</field> <value name="TEXT"> <shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="uc:Su$^N#wKlJF-Bk~W">
<field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field>
</block>
</value>
<next>
<block type="debug" id="a{LMA+Lia,Sk,ke%?oEb" collapsed="true">
<field name="Severity">warn</field>
<value name="TEXT">
<shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw">
<field name="TEXT">test</field>
</shadow>
<block type="variables_get" id="F=U9Un?:0kO+iArl4/v6">
<field name="VAR" id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</field>
</block>
</value>
<next>
<block type="debug" id="R0ga,*0My#EBryT24/" collapsed="true">
<field name="Severity">warn</field>
<value name="TEXT">
<shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw">
<field name="TEXT">test</field>
</shadow>
<block type="variables_get" id="?X_ZXj.~4EZ!M%V-m8I">
<field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="variables_set" id="iO),hH6ep+-Kf;MyBP]" x="512" y="363"> <field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field> <value name="VALUE"> <block type="convert_tonumber" id="rY=q]f(4(Fz0(%mhV1"></block>
</value>
</block>
</xml>
@bommel_030
Du musstMaximummit 0 initialisieren - nichtmaxtemp.Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs -
@bommel_030
Du musstMaximummit 0 initialisieren - nichtmaxtemp.@paul53
Danke.... Und ich war mir beim klicken noch sicher das richtige ausgewählt zu haben.... -
Ich versuche meine Lüftung etwas weiter zu optimieren und versuche die maximale und "gemittelte" Luftfeuchtigkeit dazu zu verwenden. Dazu habe ich eine Aufzählung erstellt mit allen Hygrometerwerten, ermittle im Blockly die Anzahl und die Summe der Werte und bilde daraus den Mittelwert. Das klappt soweit. Allerdings scheitere ich daran aus der Aufzählung den Maximalwert zu ermitteln. Hatte mich an nen Tip von @paul53 gehalten (https://forum.iobroker.net/topic/35931/blockly-kleinster-wert-von-mehreren-dp-herausfinden/3) als Ergebnis kommt aber nur undefined und ich habe keinen Plan warum.
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="Ejg-VYVcC2R=NE.}}{/=">Maximum</variable>
<variable id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</variable>
<variable id="s2p-{W#Y9{8U)QwG7h}a">Summe</variable>
<variable id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</variable>
<variable id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</variable>
<variable id="v[$M9d1}YOgOF#gT~0u*">i</variable>
</variables>
<block type="on_ext" id="q;^(ON~A|[Ony6?],Ira" x="113" y="-62">
<mutation xmlns="http://www.w3.org/1999/xhtml" items="2"></mutation>
<field name="CONDITION">ne</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow type="field_oid" id="dAD~C;a#Mu7e?JqYjT@i">
<field name="oid">default</field>
</shadow>
<block type="selector" id="KBT|JX$6JlS0z6ae4/3o">
<field name="TEXT">stateid=*</field>
</block>
</value>
<value name="OID1">
<shadow type="field_oid" id="$NnAJOBY4fCl4[:e!{i/">
<field name="oid">0_userdata.0.Test.Test_Number</field>
</shadow>
</value>
<statement name="STATEMENT">
<block type="variables_set" id="V*#t4e4C@D7mS9pZ1[:"> <field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field> <value name="VALUE"> <block type="math_number" id=",;$m1xm^V9I]hGXZcSbp"> <field name="NUM">0</field> </block> </value> <next> <block type="variables_set" id="d8lr$a9m$JkF}RM(I:4["> <field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field> <value name="VALUE"> <block type="math_number" id="lK?~bXp{5/?SL%!9pG,X"> <field name="NUM">0</field> </block> </value> <next> <block type="variables_set" id="DF]k[.VulDG(r+^Nq+#|"> <field name="VAR" id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</field> <value name="VALUE"> <block type="math_number" id="8OD*Xjkoyac[+^tcL{jv"> <field name="NUM">0</field> </block> </value> <next> <block type="variables_set" id="L@[~x+L*wP/LOfS_c2Tu"> <field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field> <value name="VALUE"> <block type="math_number" id="@D|m)|PLDbjc,alB3|~@"> <field name="NUM">0</field> </block> </value> <next> <block type="controls_forEach" id="ioen|%H^B):0ag]^.7b!"> <field name="VAR" id="v[$M9d1}YOgOF#gT~0u*">i</field> <value name="LIST"> <block type="selector" id="SN45+2xki[!#zw~-vvPc"> <field name="TEXT">state[id=*](functions="humidity-inside")</field> </block> </value> <statement name="DO"> <block type="math_change" id="ant*pGup:l}|S$PP1{r">
<field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field>
<value name="DELTA">
<shadow type="math_number" id="xmGu+y04Xd.BbMp9II@D">
<field name="NUM">1</field>
</shadow>
</value>
<next>
<block type="math_change" id="p*(=,r0pLeW|~un/7@(">
<field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field>
<value name="DELTA">
<shadow type="math_number" id="eHvfCJBn#.t6{NZaA44O">
<field name="NUM">1</field>
</shadow>
<block type="get_value_var" id="V47~^^jR+[RDQf4gmj">
<field name="ATTR">val</field>
<value name="OID">
<shadow type="field_oid" id=")n9xT-FG_8lBQmKq8w-S">
<field name="oid">Object ID</field>
</shadow>
<block type="variables_get" id="1uC7~tZOhkJ7mi)]^1f[">
<field name="VAR" id="v[$M9d1}YOgOF#gT~0u*">i</field>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" id="LV#hdPmGc1#sOhm:t,Ki">
<field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field>
<value name="VALUE">
<block type="convert_tonumber" id="+T5-K~QERGlHK82$!wRr">
<value name="VALUE">
<block type="get_value_var" id="MROa6uo?8qZt3cV:o]I"> <field name="ATTR">val</field> <value name="OID"> <shadow type="field_oid" id=")n9xT-FG_8lBQmKq8w-S"> <field name="oid">Object ID</field> </shadow> <block type="variables_get" id="G;[R3?hUbz!mB#.__p#]"> <field name="VAR" id="v[$M9d1}YOgOF#gT~0u*">i</field> </block> </value> </block> </value> </block> </value> <next> <block type="controls_if" id="(mil(?yR-)lM)NbKL(Z)"> <value name="IF0"> <block type="logic_compare" id="+e2J12qw2UIeIvI#*miY"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="_#C^9l(SW_m:C%n*1%E">
<field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field>
</block>
</value>
<value name="B">
<block type="variables_get" id="8bPs:}+6vqwv.|)%Lu=/">
<field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="dnL_G???FU,emwfyN%M"> <field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field> <value name="VALUE"> <block type="convert_tonumber" id="?^c7|T{1Mz9~:~Lh{^q">
<value name="VALUE">
<block type="variables_get" id="m}G~wGv{LNv@VVoo}7+"> <field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field> </block> </value> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="variables_set" id="l%U}t2JFEQ:^N.I[go/}"> <field name="VAR" id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</field> <value name="VALUE"> <block type="math_rndfixed" id="1SO?%nHyZl.Uu=objlFw"> <field name="n">1</field> <value name="x"> <shadow type="math_number" id="?DmFi}z#:cb13u8nG{X1"> <field name="NUM">3.1234</field> </shadow> <block type="math_arithmetic" id="b@ZBz|D)N|Xl8[|w/4e/"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="0:O)LSWtVE_SNJ*.aWW|"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="7(YM4qD#bOL}6n|ebHxn"> <field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field> </block> </value> <value name="B"> <shadow type="math_number" id="~0nt.g!S;jO.YsTv#QR">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="d6/r|5V:QlyRJ+:CxKaF">
<field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field>
</block>
</value>
</block>
</value>
</block>
</value>
<next>
<block type="debug" id="+OZTt00CUiUC4=yo?OjV" collapsed="true">
<field name="Severity">warn</field>
<value name="TEXT">
<shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw">
<field name="TEXT">test</field>
</shadow>
<block type="variables_get" id="S^!2%QIltg.4}H?VvhN">
<field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field>
</block>
</value>
<next>
<block type="debug" id="pt!9F_3o3CxWoMAl:r/" collapsed="true">
<field name="Severity">warn</field>
<value name="TEXT">
<shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw">
<field name="TEXT">test</field>
</shadow>
<block type="variables_get" id="uc:Su$^N#wKlJF-Bk~W"> <field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field> </block> </value> <next> <block type="debug" id="a{LMA+Lia,Sk,ke%?oEb" collapsed="true"> <field name="Severity">warn</field> <value name="TEXT"> <shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="F=U9Un?:0kO+iArl4/v6"> <field name="VAR" id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</field> </block> </value> <next> <block type="debug" id="R0ga,0My#EBryT24/" collapsed="true"> <field name="Severity">warn</field> <value name="TEXT"> <shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="?X_ZX*j.~4EZ!M%V-m8I"> <field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> <block type="variables_set" id="iO),hH6ep+-Kf;MyBP]" x="512" y="363">
<field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field>
<value name="VALUE">
<block type="convert_tonumber" id="rY=q]f(4(Fz0(%mhV1*"></block> </value> </block> </xml> [/s] Ich versuche meine Lüftung etwas weiter zu optimieren und versuche die maximale und "gemittelte" Luftfeuchtigkeit dazu zu verwenden. Dazu habe ich eine Aufzählung erstellt mit allen Hygrometerwerten, ermittle im Blockly die Anzahl und die Summe der Werte und bilde daraus den Mittelwert. Das klappt soweit. Allerdings scheitere ich daran aus der Aufzählung den Maximalwert zu ermitteln. Hatte mich an nen Tip von @paul53 gehalten (https://forum.iobroker.net/topic/35931/blockly-kleinster-wert-von-mehreren-dp-herausfinden/3) als Ergebnis kommt aber nur undefined und ich habe keinen Plan warum. [s=Blockly Export] <xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="Ejg-VYVcC2R=NE.}}{/=">Maximum</variable> <variable id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</variable> <variable id="s2p-{W#Y9{8U)QwG7h}a">Summe</variable> <variable id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</variable> <variable id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</variable> <variable id="v[$M9d1}YOgOF#gT~0u*">i</variable> </variables> <block type="on_ext" id="q;^(ON~A|[Ony6?],Ira" x="113" y="-62"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="2"></mutation> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="dAD~C;a#Mu7e?JqYjT@i"> <field name="oid">default</field> </shadow> <block type="selector" id="KBT|JX$6JlS0z6ae4/3o"> <field name="TEXT">state[id=*](functions="humidity-inside")</field> </block> </value> <value name="OID1"> <shadow type="field_oid" id="$NnAJOBY4fCl4[:e!{i/"> <field name="oid">0_userdata.0.Test.Test_Number</field> </shadow> </value> <statement name="STATEMENT"> <block type="variables_set" id="V*#t4e4C@D7mS9pZ1[:">
<field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field>
<value name="VALUE">
<block type="math_number" id=",;$m1xm^V9I]hGXZcSbp">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="variables_set" id="d8lr$a9m$JkF}RM(I:4[">
<field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field>
<value name="VALUE">
<block type="math_number" id="lK?~bXp{5/?SL%!9pG,X">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="variables_set" id="DF]k[.VulDG(r+^Nq+#|">
<field name="VAR" id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</field>
<value name="VALUE">
<block type="math_number" id="8ODXjkoyac[+^tcL{jv">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="variables_set" id="L@[~x+LwP/LOfS_c2Tu">
<field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field>
<value name="VALUE">
<block type="math_number" id="@D|m)|PLDbjc,alB3|~@">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="controls_forEach" id="ioen|%H^B):0ag]^.7b!">
<field name="VAR" id="v[$M9d1}YOgOF#gT~0u">i</field>
<value name="LIST">
<block type="selector" id="SN45+2xki[!#zw~-vvPc">
<field name="TEXT">stateid=*</field>
</block>
</value>
<statement name="DO">
<block type="math_change" id="antpGup:l}|S$PP1{r"> <field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field> <value name="DELTA"> <shadow type="math_number" id="xmGu+y04Xd.BbMp9II@D"> <field name="NUM">1</field> </shadow> </value> <next> <block type="math_change" id="p*(=,r0pLeW|~un/_7@("> <field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field> <value name="DELTA"> <shadow type="math_number" id="eHvfCJBn#.t6{NZaA44O"> <field name="NUM">1</field> </shadow> <block type="get_value_var" id="V*47~^^jR+[RDQf4g*mj"> <field name="ATTR">val</field> <value name="OID"> <shadow type="field_oid" id=")n9xT-FG_8lBQmKq8w-S"> <field name="oid">Object ID</field> </shadow> <block type="variables_get" id="1uC7~tZOhkJ7mi)]^1f["> <field name="VAR" id="v[$M9d1}YOgOF#gT~0u*">i</field> </block> </value> </block> </value> <next> <block type="variables_set" id="LV#hdPmGc1#sOhm:t,Ki"> <field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field> <value name="VALUE"> <block type="convert_tonumber" id="+T5-K~QERGlHK82$!wRr"> <value name="VALUE"> <block type="get_value_var" id="MROa6uo?8qZt3cV:o]I">
<field name="ATTR">val</field>
<value name="OID">
<shadow type="field_oid" id=")n9xT-FG_8lBQmKq8w-S">
<field name="oid">Object ID</field>
</shadow>
<block type="variables_get" id="G;[R3?hUbz!mB#.__p#]">
<field name="VAR" id="v[$M9d1}YOgOF#gT~0u">i</field>
</block>
</value>
</block>
</value>
</block>
</value>
<next>
<block type="controls_if" id="(mil(?yR-)lM)NbKL(Z)">
<value name="IF0">
<block type="logic_compare" id="+e2J12qw2UIeIvI#*miY">
<field name="OP">GT</field>
<value name="A">
<block type="variables_get" id="#C^9l(SW_m:C%n*1%E"> <field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field> </block> </value> <value name="B"> <block type="variables_get" id="8bPs:}+6vqwv.|)%Lu=/"> <field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="dnL_G???FU,emwfyN%M">
<field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field>
<value name="VALUE">
<block type="convert_tonumber" id="?^c7|T{1Mz9~:~Lh{^q"> <value name="VALUE"> <block type="variables_get" id="m}G~wGv{LNv@VVoo}7+">
<field name="VAR" id="n-}Vdy}h6=%@B8J:l.Tv">maxtemp</field>
</block>
</value>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
<next>
<block type="variables_set" id="l%U}t2JFEQ:^N.I[go/}">
<field name="VAR" id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</field>
<value name="VALUE">
<block type="math_rndfixed" id="1SO?%nHyZl.Uu=objlFw">
<field name="n">1</field>
<value name="x">
<shadow type="math_number" id="?DmFi}z#:cb13u8nG{X1">
<field name="NUM">3.1234</field>
</shadow>
<block type="math_arithmetic" id="b@ZBz|D)N|Xl8[|w/4e/">
<field name="OP">DIVIDE</field>
<value name="A">
<shadow type="math_number" id="0:O)LSWtVE_SNJ*.aWW|">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="7(YM4qD#bOL}6n|ebHxn">
<field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field>
</block>
</value>
<value name="B">
<shadow type="math_number" id="~0nt.g!S;jO.YsTv#QR"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="d6/r|5V:QlyRJ+:CxKaF"> <field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field> </block> </value> </block> </value> </block> </value> <next> <block type="debug" id="+OZTt00CUiUC4=yo?OjV" collapsed="true"> <field name="Severity">warn</field> <value name="TEXT"> <shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="S_^!2%QIltg.4}H?VvhN"> <field name="VAR" id=",4HtWr!Hs3k6^:Y@-Lhq">Anzahl</field> </block> </value> <next> <block type="debug" id="pt!9F_3o3CxWoMAl:r/_" collapsed="true"> <field name="Severity">warn</field> <value name="TEXT"> <shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="uc:Su$^N#wKlJF-Bk~W">
<field name="VAR" id="s2p-{W#Y9{8U)QwG7h}a">Summe</field>
</block>
</value>
<next>
<block type="debug" id="a{LMA+Lia,Sk,ke%?oEb" collapsed="true">
<field name="Severity">warn</field>
<value name="TEXT">
<shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw">
<field name="TEXT">test</field>
</shadow>
<block type="variables_get" id="F=U9Un?:0kO+iArl4/v6">
<field name="VAR" id="mtB)9u{@%oB_HLK.@PT~">Mittelwert</field>
</block>
</value>
<next>
<block type="debug" id="R0ga,*0My#EBryT24/" collapsed="true">
<field name="Severity">warn</field>
<value name="TEXT">
<shadow type="text" id="l.}[OzDRv,4_PV5/U+Nw">
<field name="TEXT">test</field>
</shadow>
<block type="variables_get" id="?X_ZXj.~4EZ!M%V-m8I">
<field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="variables_set" id="iO),hH6ep+-Kf;MyBP]" x="512" y="363"> <field name="VAR" id="Ejg-VYVcC2R=NE.}}{/=">Maximum</field> <value name="VALUE"> <block type="convert_tonumber" id="rY=q]f(4(Fz0(%mhV1"></block>
</value>
</block>
</xml>
Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs -
@paul53
Danke, hab es umgebaut. Ich habe noch versucht den falls-Teil durch Maximalwert der Liste zu ersetzen. Das klappt leider nicht.
Verstehe den Block so, dass er den Maximalwert aus der Liste "ids" nehmen soll. Ist "ids" keine Liste im klassischen Sinn?
Fehler ist NaN, auch wenn ich noch ein "nach Zahl" davor stelle.

-
@paul53
Danke, hab es umgebaut. Ich habe noch versucht den falls-Teil durch Maximalwert der Liste zu ersetzen. Das klappt leider nicht.
Verstehe den Block so, dass er den Maximalwert aus der Liste "ids" nehmen soll. Ist "ids" keine Liste im klassischen Sinn?
Fehler ist NaN, auch wenn ich noch ein "nach Zahl" davor stelle.

@bommel_030 sagte: Ist "ids" keine Liste im klassischen Sinn?
idsist eine Liste der IDs - nicht der Werte.Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs -
@bommel_030 sagte: Ist "ids" keine Liste im klassischen Sinn?
idsist eine Liste der IDs - nicht der Werte.@paul53
Und wie kann ich eine Liste mit den Werten erstellen? -
@paul53
Und wie kann ich eine Liste mit den Werten erstellen?Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs -
@paul53
Thx, wird hier hier nicht wirklich benötigt, reiner Wissensdurst ;-) -
@paul53
Ich bräuchte hier noch einmal Hilfe... Mittlere und maximale Luftfeuchte läuft einwandfrei. Nun wollte ich noch den Raum oder Name des "Maximums" auslesen und scheitere aber hiermit. Kannst du mir nen Tip geben wie ich den Raum oder Gerätename des Maximums auslese?

-
@paul53
Ich bräuchte hier noch einmal Hilfe... Mittlere und maximale Luftfeuchte läuft einwandfrei. Nun wollte ich noch den Raum oder Name des "Maximums" auslesen und scheitere aber hiermit. Kannst du mir nen Tip geben wie ich den Raum oder Gerätename des Maximums auslese?

@bommel_030 sagte: Raum oder Gerätename des Maximums auslese?
Diese Möglichkeit bietet Blockly nicht. Du kannst aber den Objektnamen oder die Objektbeschreibung (common.desc) so anpassen, dass sie den Raum enthält.
Der untere Block ist Quatsch, denn
Maximumenthält keine Objekt-ID, sondern eine Zahl. Du musst die ID zum Maximum-Datenpunkt bei der Prüfung des Maximum in der Schleife merken: "setzeidMaxaufi".
Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs
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

