Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Einsteigerfragen
    4. (Gelöst)Aus einer Liste "Name" und Wert

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    (Gelöst)Aus einer Liste "Name" und Wert

    This topic has been deleted. Only users with topic management privileges can see it.
    • Codierknecht
      Codierknecht Developer Most Active @paul53 last edited by

      @paul53
      Das wird @apollon77 mir sicher in das Issue schreiben 😁
      So ein Block-Element "getObject()" wäre natürlich noch cooler. Damit könnte man dann auch noch "unit", "read", "write" usw. ermitteln - ohne JS.

      paul53 apollon77 2 Replies Last reply Reply Quote 0
      • paul53
        paul53 @Codierknecht last edited by paul53

        @codierknecht sagte: Block-Element "getObject()" wäre natürlich noch cooler.

        In Blockly sollte man sich vielleicht auf getObject(id).common beschränken.

        1 Reply Last reply Reply Quote 1
        • H
          harald07 last edited by harald07

          Erst einmal allen vielen Dank!
          Leider bekomme ich es nicht hin. Da ich zu keinem Ergebnis gekommen bin habe ich habe es erst einmal auf den Minimalwert mit Hilfe des Selectors reduziert. Aber leider gab dies sochon kein Ergebnis.
          Screenshot (49).png

          Ohne den Selektor und ohne die Schleife bekomme ich den Minimalwert und Maximalwert, aber nicht die jeweiligen Zellen.

          Screenshot (50).png

          Kann ich den Selektor in irgendeiner Weise prüfen?

          paul53 Codierknecht 2 Replies Last reply Reply Quote 0
          • paul53
            paul53 @harald07 last edited by paul53

            @harald07 sagte: Kann ich den Selektor in irgendeiner Weise prüfen?

            Ja, einfach den Selektor per Debug-Block ausgeben. Prinzip:

            Blockly_temp.JPG

            @harald07 sagte in Aus einer Liste "Name" und Wert:

            Aber leider gab dies sochon kein Ergebnis.

            Zeige bitte mal die ID-Struktur der Datenpunkte.

            1 Reply Last reply Reply Quote 0
            • Codierknecht
              Codierknecht Developer Most Active @harald07 last edited by

              @harald07 sagte in Aus einer Liste "Name" und Wert:

              Ohne den Selektor und ohne die Schleife bekomme ich den Minimalwert und Maximalwert, aber nicht die jeweiligen Zellen.

              Dann probier doch mal mit Schleife 😉
              Die brauchst Du ja auch mit funktionierendem Selektor.

              <xml xmlns="https://developers.google.com/blockly/xml">
                <variables>
                  <variable id="A~:ypQ(^sX*l1C[*(J*f">objectID</variable>
                  <variable id="bhZlx3!hSc?sjp*V4Q`E">liste</variable>
                  <variable id="Aj-nChu[Wp@3CgK02W$J">voltMin</variable>
                  <variable id="MyIUf~c5FUDksDs??}8C">voltMax</variable>
                  <variable id="4)UVHmM{XPXRM28y.|3,">i</variable>
                  <variable id="ZC|_9A-1eH/he1X=(Ks+">voltAkt</variable>
                  <variable id="Uw4lz?=_m-;v@V$-q.MF">nameAkt</variable>
                  <variable id="8Sm7p6erU*hf@rVW15vc">nameMin</variable>
                  <variable id="OM(ZD@@sUa]ZQMPBA^.A">nameMax</variable>
                </variables>
                <block type="procedures_defcustomreturn" id="UOT5}.HTZe)Kjc^532X1" x="62" y="88">
                  <mutation statements="false">
                    <arg name="objectID" varid="A~:ypQ(^sX*l1C[*(J*f"></arg>
                  </mutation>
                  <field name="NAME">getObjectName</field>
                  <field name="SCRIPT">cmV0dXJuIGdldE9iamVjdChvYmplY3RJRCkuY29tbW9uLm5hbWU7</field>
                  <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                </block>
                <block type="variables_set" id="jBp^VZ7,7bQ-#1nmyMSH" x="62" y="128">
                  <field name="VAR" id="bhZlx3!hSc?sjp*V4Q`E">liste</field>
                  <value name="VALUE">
                    <block type="lists_create_with" id="`B+!j=H=qCQ:BY2Z-|Sr">
                      <mutation items="3"></mutation>
                      <value name="ADD0">
                        <block type="field_oid" id="g^,Hd_+TYJ]^8-uQwQw6">
                          <field name="oid">default</field>
                        </block>
                      </value>
                      <value name="ADD1">
                        <block type="field_oid" id="v]F#_(;`w6VWbR)L6lI-">
                          <field name="oid">default</field>
                        </block>
                      </value>
                      <value name="ADD2">
                        <block type="field_oid" id="YaE_DebsR{hU.Z[$@Bh{">
                          <field name="oid">default</field>
                        </block>
                      </value>
                    </block>
                  </value>
                  <next>
                    <block type="on" id="YgiA/=!`3gaZ_y1oWYQO">
                      <field name="OID">Object ID</field>
                      <field name="CONDITION">ne</field>
                      <field name="ACK_CONDITION"></field>
                      <statement name="STATEMENT">
                        <block type="variables_set" id="shOIp|-,)1QyBw~ccrcx">
                          <field name="VAR" id="Aj-nChu[Wp@3CgK02W$J">voltMin</field>
                          <value name="VALUE">
                            <block type="math_number" id="?D@x3zu?X%1w%7S(nu]f">
                              <field name="NUM">9999</field>
                            </block>
                          </value>
                          <next>
                            <block type="variables_set" id="T-)l(-da2eB0BRJ{4[mZ">
                              <field name="VAR" id="MyIUf~c5FUDksDs??}8C">voltMax</field>
                              <value name="VALUE">
                                <block type="math_number" id="AxKFw~!F:5uo$CL16E1.">
                                  <field name="NUM">0</field>
                                </block>
                              </value>
                              <next>
                                <block type="controls_forEach" id="`1%S^g=$~m-2@5V,2A%A">
                                  <field name="VAR" id="4)UVHmM{XPXRM28y.|3,">i</field>
                                  <value name="LIST">
                                    <block type="variables_get" id="Hl{8^KvH+5Ds4lf+1u2n">
                                      <field name="VAR" id="bhZlx3!hSc?sjp*V4Q`E">liste</field>
                                    </block>
                                  </value>
                                  <statement name="DO">
                                    <block type="variables_set" id="x!hMmFo3#5,abc9]mkFB">
                                      <field name="VAR" id="ZC|_9A-1eH/he1X=(Ks+">voltAkt</field>
                                      <value name="VALUE">
                                        <block type="get_value_var" id="@/6zXxF$PcQZBRGn]{h5">
                                          <field name="ATTR">val</field>
                                          <value name="OID">
                                            <shadow type="text" id="A9!pg*!mvM?X+RaEjB;k">
                                              <field name="TEXT"></field>
                                            </shadow>
                                            <block type="variables_get" id="9h6H57!blOoANWu]Bj%4">
                                              <field name="VAR" id="4)UVHmM{XPXRM28y.|3,">i</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="variables_set" id="7~l.(,3of}t}U?Gyu+J5">
                                          <field name="VAR" id="Uw4lz?=_m-;v@V$-q.MF">nameAkt</field>
                                          <value name="VALUE">
                                            <block type="procedures_callcustomreturn" id="I%~zDlnJRmunzhGKB8L~">
                                              <mutation name="getObjectName">
                                                <arg name="objectID"></arg>
                                              </mutation>
                                              <value name="ARG0">
                                                <block type="variables_get" id="4+c)R;?[DQe%+2vpA}Af">
                                                  <field name="VAR" id="4)UVHmM{XPXRM28y.|3,">i</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <next>
                                            <block type="controls_if" id="*HnYlB^frWrq)xEu9G0E">
                                              <value name="IF0">
                                                <block type="logic_compare" id="Z4]Piz]]+BYOn+9I$ou,">
                                                  <field name="OP">LT</field>
                                                  <value name="A">
                                                    <block type="variables_get" id="=r`v4OL(AF%`|!|3[4LX">
                                                      <field name="VAR" id="ZC|_9A-1eH/he1X=(Ks+">voltAkt</field>
                                                    </block>
                                                  </value>
                                                  <value name="B">
                                                    <block type="variables_get" id="*sUfB*-D:l#|)+p_JM$^">
                                                      <field name="VAR" id="Aj-nChu[Wp@3CgK02W$J">voltMin</field>
                                                    </block>
                                                  </value>
                                                </block>
                                              </value>
                                              <statement name="DO0">
                                                <block type="variables_set" id=";X(jot?RmW?Gw/ty)=`_">
                                                  <field name="VAR" id="Aj-nChu[Wp@3CgK02W$J">voltMin</field>
                                                  <value name="VALUE">
                                                    <block type="variables_get" id="1^nliQYKBMSuf2I~WL$^">
                                                      <field name="VAR" id="ZC|_9A-1eH/he1X=(Ks+">voltAkt</field>
                                                    </block>
                                                  </value>
                                                  <next>
                                                    <block type="variables_set" id="*2kcJ^Eg8|C0ckmy}8@*">
                                                      <field name="VAR" id="8Sm7p6erU*hf@rVW15vc">nameMin</field>
                                                      <value name="VALUE">
                                                        <block type="variables_get" id="+f3/2^wh$8vs@3GPwOI[">
                                                          <field name="VAR" id="Uw4lz?=_m-;v@V$-q.MF">nameAkt</field>
                                                        </block>
                                                      </value>
                                                    </block>
                                                  </next>
                                                </block>
                                              </statement>
                                              <next>
                                                <block type="controls_if" id=".JYC#cUROp3;c9Ly!o.w">
                                                  <value name="IF0">
                                                    <block type="logic_compare" id="Pj#6T{LC)mSD3q;g|E[7">
                                                      <field name="OP">GT</field>
                                                      <value name="A">
                                                        <block type="variables_get" id="fSm$m`{8ZD#Hoe]02lOB">
                                                          <field name="VAR" id="ZC|_9A-1eH/he1X=(Ks+">voltAkt</field>
                                                        </block>
                                                      </value>
                                                      <value name="B">
                                                        <block type="variables_get" id="qSWsI-NDk[=c#VaxO1Ph">
                                                          <field name="VAR" id="MyIUf~c5FUDksDs??}8C">voltMax</field>
                                                        </block>
                                                      </value>
                                                    </block>
                                                  </value>
                                                  <statement name="DO0">
                                                    <block type="variables_set" id="2a1Y/Lpg%6w=4-!G45I;">
                                                      <field name="VAR" id="MyIUf~c5FUDksDs??}8C">voltMax</field>
                                                      <value name="VALUE">
                                                        <block type="variables_get" id="cAdJ^#g9Jl+#oO$]r1[?">
                                                          <field name="VAR" id="ZC|_9A-1eH/he1X=(Ks+">voltAkt</field>
                                                        </block>
                                                      </value>
                                                      <next>
                                                        <block type="variables_set" id="uM9PPevc?Uu_^Tk0Lm.#">
                                                          <field name="VAR" id="OM(ZD@@sUa]ZQMPBA^.A">nameMax</field>
                                                          <value name="VALUE">
                                                            <block type="variables_get" id="Q7KYi8vc;%-^+*[@n9E/">
                                                              <field name="VAR" id="Uw4lz?=_m-;v@V$-q.MF">nameAkt</field>
                                                            </block>
                                                          </value>
                                                        </block>
                                                      </next>
                                                    </block>
                                                  </statement>
                                                </block>
                                              </next>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </statement>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </statement>
                    </block>
                  </next>
                </block>
              </xml>
              

              1 Reply Last reply Reply Quote 0
              • H
                harald07 last edited by harald07

                @paul53 gerne.!

                Screenshot (51).png

                P3_Z01 - P3_Z16 sind die Zellen. Alle Zellen des Packs haben die Funktion "Zellen_Alle" & "Zellen_P3".

                paul53 1 Reply Last reply Reply Quote 0
                • paul53
                  paul53 @harald07 last edited by

                  @harald07
                  Möchtest du Minimum und Maximum von jeweils einem Pack oder von allen Packs?

                  1 Reply Last reply Reply Quote 0
                  • H
                    harald07 last edited by

                    Für jedes Pack und nochmal alle zusammen.
                    Screenshot (52).png
                    Hier fehlt noch Minimal und Maximal mit der Info welche Zelle es ist.

                    paul53 2 Replies Last reply Reply Quote 0
                    • paul53
                      paul53 @harald07 last edited by paul53

                      @harald07 sagte: Für jedes Pack

                      Pack_3:

                      Blockly_temp.JPG

                      Inhalt der JS-Funktion getName(id):

                      return getObject(id).common.name;
                      
                      1 Reply Last reply Reply Quote 0
                      • H
                        harald07 last edited by

                        @paul53 Vielen Dank! Versuche ich sofort umzusetzen.

                        1 Reply Last reply Reply Quote 0
                        • paul53
                          paul53 @harald07 last edited by

                          @harald07 sagte: nochmal alle zusammen.

                          Der Selektor für alle Zellen:

                          Blockly_temp.JPG

                          1 Reply Last reply Reply Quote 0
                          • H
                            harald07 last edited by Homoran

                            @paul53 Es tut sich was.

                            2023-02-13 18:08:21.581 - info: javascript.0 (5714) script.js.PV.Zellen_Paul53: ['0_userdata.0.PV.Pack_3.P3_Z01','0_userdata.0.PV.Pack_3.P3_Z02','0_userdata.0.PV.Pack_3.P3_Z03','0_userdata.0.PV.Pack_3.P3_Z04','0_userdata.0.PV.Pack_3.P3_Z05','0_userdata.0.PV.Pack_3.P3_Z06','0_userdata.0.PV.Pack_3.P3_Z07','0_userdata.0.PV.Pack_3.P3_Z08','0_userdata.0.PV.Pack_3.P3_Z09','0_userdata.0.PV.Pack_3.P3_Z10','0_userdata.0.PV.Pack_3.P3_Z11','0_userdata.0.PV.Pack_3.P3_Z12','0_userdata.0.PV.Pack_3.P3_Z13','0_userdata.0.PV.Pack_3.P3_Z14','0_userdata.0.PV.Pack_3.P3_Z15','0_userdata.0.PV.Pack_3.P3_Z16']
                            2023-02-13 18:08:21.582 - info: javascript.0 (5714) script.js.PV.Zellen_Paul53: registered 0 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
                            2023-02-13 18:08:32.111 - info: admin.0 (5672) <== Disconnect system.user.admin from ::ffff:192.168.20.20 javascript
                            

                            MOD-EDIT: Code in code-tags gesetzt!

                            paul53 1 Reply Last reply Reply Quote 0
                            • paul53
                              paul53 @harald07 last edited by

                              @harald07
                              Log-Ausgaben bitte in Code tags (oben </>) posten!

                              1 Reply Last reply Reply Quote 0
                              • H
                                harald07 last edited by

                                @paul53 Teilerfolg!
                                Screenshot (53).png
                                Minimalwert und Maximalwert werden gesetzt.
                                Aber nicht die Namen

                                2023-02-13 18:48:03.967 - warn: javascript.0 (5714) getState "undefined" not found (3)
                                2023-02-13 18:48:03.968 - warn: javascript.0 (5714) at Object. (script.js.PV.Zellen_Paul53:17:12)
                                2023-02-13 18:48:03.969 - warn: javascript.0 (5714) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1244:38)
                                2023-02-13 18:48:03.969 - warn: javascript.0 (5714) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:593:29)
                                2023-02-13 18:48:03.970 - warn: javascript.0 (5714) at Immediate._onImmediate (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/src/lib/adapter/adapter.js:5916:56)
                                2023-02-13 18:48:03.970 - warn: javascript.0 (5714) at processImmediate (node:internal/timers:466:21)
                                2023-02-13 18:48:03.970 - warn: javascript.0 (5714) script.js.PV.Zellen_Paul53: Object "undefined" does not exist
                                2023-02-13 18:48:03.972 - error: javascript.0 (5714) script.js.PV.Zellen_Paul53: TypeError: Cannot read properties of null (reading 'common')
                                2023-02-13 18:48:03.973 - error: javascript.0 (5714) at getName (script.js.PV.Zellen_Paul53:5:25)
                                2023-02-13 18:48:03.973 - error: javascript.0 (5714) at Object. (script.js.PV.Zellen_Paul53:18:19)
                                2023-02-13 18:48:03.973 - error: javascript.0 (5714) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1244:38)
                                2023-02-13 18:48:03.973 - error: javascript.0 (5714) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:593:29)
                                2023-02-13 18:48:03.973 - error: javascript.0 (5714) at Immediate. (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/src/lib/adapter/adapter.js:5916:56)
                                2023-02-13 18:48:03.973 - error: javascript.0 (5714) at processImmediate (node:internal/timers:466:21)
                                
                                
                                paul53 1 Reply Last reply Reply Quote 0
                                • paul53
                                  paul53 @harald07 last edited by paul53

                                  @harald07
                                  Ändere für jeden Wert i --> für jeden Wert id. Falsch:

                                  Blockly_temp.JPG

                                  Richtig:

                                  Blockly_temp.JPG

                                  Die "aktualisiere"-Blöcke müssen in den Trigger unter die Schleife.

                                  1 Reply Last reply Reply Quote 0
                                  • H
                                    harald07 last edited by

                                    @paul53 Die "id" habe ich durch "i" ersetzt.

                                    2023-02-13 18:53:40.162 - warn: javascript.0 (5714) getState "undefined" not found (3)
                                    2023-02-13 18:53:40.163 - warn: javascript.0 (5714) at Object. (script.js.PV.Zellen_Paul53:17:12)
                                    2023-02-13 18:53:40.164 - warn: javascript.0 (5714) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1244:38)
                                    2023-02-13 18:53:40.164 - warn: javascript.0 (5714) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:593:29)
                                    2023-02-13 18:53:40.164 - warn: javascript.0 (5714) at Immediate._onImmediate (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/src/lib/adapter/adapter.js:5916:56)
                                    2023-02-13 18:53:40.164 - warn: javascript.0 (5714) at processImmediate (node:internal/timers:466:21)
                                    2023-02-13 18:53:40.164 - warn: javascript.0 (5714) script.js.PV.Zellen_Paul53: Object "undefined" does not exist
                                    2023-02-13 18:53:40.166 - error: javascript.0 (5714) script.js.PV.Zellen_Paul53: TypeError: Cannot read properties of null (reading 'common')
                                    2023-02-13 18:53:40.167 - error: javascript.0 (5714) at getName (script.js.PV.Zellen_Paul53:5:25)
                                    2023-02-13 18:53:40.167 - error: javascript.0 (5714) at Object. (script.js.PV.Zellen_Paul53:18:19)
                                    2023-02-13 18:53:40.168 - error: javascript.0 (5714) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1244:38)
                                    2023-02-13 18:53:40.168 - error: javascript.0 (5714) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:593:29)
                                    2023-02-13 18:53:40.168 - error: javascript.0 (5714) at Immediate. (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/src/lib/adapter/adapter.js:5916:56)
                                    2023-02-13 18:53:40.168 - error: javascript.0 (5714) at processImmediate (node:internal/timers:466:21)
                                    2023-02-13 18:53:40.755 - info: javascript.0 (5714) Stop script script.js.PV.Zellen_Paul53
                                    2023-02-13 18:54:32.898 - info: javascript.0 (5714) Stop script script.js.PV.Zellen_Paul53
                                    2023-02-13 18:54:34.810 - info: javascript.0 (5714) Start javascript script.js.PV.Zellen_Paul53
                                    2023-02-13 18:54:34.818 - info: javascript.0 (5714) script.js.PV.Zellen_Paul53: registered 16 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
                                    2023-02-13 18:54:34.830 - info: javascript.0 (5714) State value to set for "0_userdata.0.PV.Pack_3.P3_Minimum" has to be type "number" but received type "object"
                                    2023-02-13 18:54:34.831 - info: javascript.0 (5714) State value to set for "0_userdata.0.PV.Pack_3.P3_Name_Min" has to be type "string" but received type "object"
                                    2023-02-13 18:54:34.831 - info: javascript.0 (5714) State value to set for "0_userdata.0.PV.Pack_3.P3_Maximum" has to be type "number" but received type "object"
                                    2023-02-13 18:54:34.831 - info: javascript.0 (5714) State value to set for "0_userdata.0.PV.Pack_3.P3_Name_Max" has to be type "string" but received type "object"
                                    2023-02-13 18:54:43.842 - info: admin.0 (5672) <== Disconnect system.user.admin from ::ffff:192.168.20.20 javascript
                                    

                                    Screenshot (54).png

                                    paul53 1 Reply Last reply Reply Quote 0
                                    • paul53
                                      paul53 @harald07 last edited by

                                      @harald07 sagte: Die "id" habe ich durch "i" ersetzt.

                                      Wo? Umgekehrt wird ein Schuh draus (s.o.).

                                      1 Reply Last reply Reply Quote 0
                                      • H
                                        harald07 last edited by harald07

                                        @paul53 Du bist der Beste.
                                        Screenshot (55).png
                                        Screenshot (56).png

                                        Vielen, vielen Dank!!!!

                                        1 Reply Last reply Reply Quote 0
                                        • H
                                          harald07 last edited by

                                          Am Design muss ich noch ein wenig feilen!
                                          Screenshot (57).png

                                          1 Reply Last reply Reply Quote 0
                                          • apollon77
                                            apollon77 @Codierknecht last edited by

                                            @codierknecht Da ich nicht der Blockly experte bin schreibts doch bitte selbst rein wenn Ihr es hier schon rausarbeitet 🙂

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            687
                                            Online

                                            31.9k
                                            Users

                                            80.3k
                                            Topics

                                            1.3m
                                            Posts

                                            4
                                            31
                                            1202
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo