Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. mehrere IDs vom Selektor

    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

    mehrere IDs vom Selektor

    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jwerlsdf last edited by

      Hallo,
      ich möchte beim Selektor mehrere IDs abfragen. Aber es funktioniert immer nur 1. Mit zwei funktioniert es nicht. Wie muss ich das genau machen? Ich habe es so versucht, aber leider klappt es nicht:

      *.STATE(functions=Licht-EG), *.LEVEL(functions=Licht-EG)
      
      paul53 1 Reply Last reply Reply Quote 0
      • paul53
        paul53 @jwerlsdf last edited by paul53

        @jwerlsdf sagte: Mit zwei funktioniert es nicht.

        Man muss eine Liste erstellen und diese um eine weitere Liste erweitern, was unter Javascript mittels concat() erfolgt. Da aber Blockly gewünscht, funktioniert es mit einer Schleife.

        Blockly_temp.JPG

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

          @paul53
          danke für deine Nachricht. So sieht mein Skript aus. Leider funktioniert es aber nicht wie gewünscht. Level wird mal angezeigt, aber 10 Mal oder mehr. Irgendwie ist der Wurm drinne:
          Screenshot 2024-12-26 170229.png

          Anbei der export:

          <xml xmlns="https://developers.google.com/blockly/xml">
           <variables>
             <variable id="49uXg6HLqFYWFA:qXC@Q">id</variable>
             <variable id="a8Hk_)m.S#v]xOx,|g]B">ids</variable>
             <variable id="p8z4a0D*3/v6krF]%fZK">an</variable>
             <variable id="P(vzemG|?%LTz:_r9=_I">ausgabe</variable>
           </variables>
           <block type="comment" id="Un`t3N6C$dh|YUz=}~}{" x="-12" y="-163">
             <field name="COMMENT">erzeuge Liste mit Anzahl und Aufzählung der Lichter</field>
             <next>
               <block type="variables_set" id="+MFQe5tZBT5!whBe|iFA">
                 <field name="VAR" id="a8Hk_)m.S#v]xOx,|g]B">ids</field>
                 <value name="VALUE">
                   <block type="selector" id="|Y{K/}d6n@!iKbM},%LM">
                     <field name="TEXT">*.STATE(functions=Licht-EG)</field>
                   </block>
                 </value>
                 <next>
                   <block type="on_ext" id="%;xKJA^hdmL.h]{^~f1^">
                     <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="/IZY1f-MIzB=|5jwj%X^">
                         <field name="oid">default</field>
                       </shadow>
                       <block type="variables_get" id="C!jgwb6-ylj1moU4[@-|">
                         <field name="VAR" id="a8Hk_)m.S#v]xOx,|g]B">ids</field>
                       </block>
                     </value>
                     <statement name="STATEMENT">
                       <block type="controls_forEach" id=".#.XRRNVp(XbrR8_+*]f">
                         <field name="VAR" id="49uXg6HLqFYWFA:qXC@Q">id</field>
                         <value name="LIST">
                           <block type="selector" id="M0G^t}YBR?B@CVzTz!}e">
                             <field name="TEXT">*.LEVEL(functions=Licht-EG)</field>
                           </block>
                         </value>
                         <statement name="DO">
                           <block type="lists_setIndex" id="lIUL(L,T1PrxL[`ZfZ1X">
                             <mutation at="false"></mutation>
                             <field name="MODE">INSERT</field>
                             <field name="WHERE">LAST</field>
                             <value name="LIST">
                               <block type="variables_get" id="J(z/cbe{;2j6__+P%:#T">
                                 <field name="VAR" id="a8Hk_)m.S#v]xOx,|g]B">ids</field>
                               </block>
                             </value>
                             <value name="TO">
                               <block type="variables_get" id="vWR0?Y=}A-cz*o-(#B]+">
                                 <field name="VAR" id="49uXg6HLqFYWFA:qXC@Q">id</field>
                               </block>
                             </value>
                           </block>
                         </statement>
                         <next>
                           <block type="variables_set" id="jw[mYBdN9^y9Dk!BPhJE">
                             <field name="VAR" id="p8z4a0D*3/v6krF]%fZK">an</field>
                             <value name="VALUE">
                               <block type="lists_create_with" id="`9G-Tj284acj[FYBy%rN">
                                 <mutation items="0"></mutation>
                               </block>
                             </value>
                             <next>
                               <block type="controls_forEach" id="WMPl}l}=L$2Zw)NA*TVy">
                                 <field name="VAR" id="49uXg6HLqFYWFA:qXC@Q">id</field>
                                 <value name="LIST">
                                   <block type="variables_get" id="l;;%nd.bGb.#gpGdu;b4">
                                     <field name="VAR" id="a8Hk_)m.S#v]xOx,|g]B">ids</field>
                                   </block>
                                 </value>
                                 <statement name="DO">
                                   <block type="controls_if" id="`JE~9u-b2ugOMZ.:1(#X">
                                     <value name="IF0">
                                       <block type="get_value_var" id="}_NRDK8u4v`;cKJcme`7">
                                         <field name="ATTR">val</field>
                                         <value name="OID">
                                           <shadow type="text" id="tzQ/EjJ-;3Z,h.sG`jKi">
                                             <field name="TEXT"></field>
                                           </shadow>
                                           <block type="variables_get" id=".l1{d-4+KoMP[E$t|=Gb">
                                             <field name="VAR" id="49uXg6HLqFYWFA:qXC@Q">id</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <statement name="DO0">
                                       <block type="lists_setIndex" id="DyfzqLSC_%oiZ`g^W?m:">
                                         <mutation at="false"></mutation>
                                         <field name="MODE">INSERT</field>
                                         <field name="WHERE">LAST</field>
                                         <value name="LIST">
                                           <block type="variables_get" id="CpNch0%9GPu|K{s+|m!}">
                                             <field name="VAR" id="p8z4a0D*3/v6krF]%fZK">an</field>
                                           </block>
                                         </value>
                                         <value name="TO">
                                           <block type="procedures_callcustomreturn" id="z*lB%;}2qJrPQkmG~u8@">
                                             <mutation name="parentName">
                                               <arg name="id"></arg>
                                             </mutation>
                                             <value name="ARG0">
                                               <block type="variables_get" id="_|YU61%vg@+Pg2n)iMaA">
                                                 <field name="VAR" id="49uXg6HLqFYWFA:qXC@Q">id</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                       </block>
                                     </statement>
                                   </block>
                                 </statement>
                                 <next>
                                   <block type="controls_if" id="hR^gCWwe.;UCu9p-qyGx">
                                     <mutation elseif="1" else="1"></mutation>
                                     <value name="IF0">
                                       <block type="logic_compare" id="p`L;~I5uAoOKRrfa5q%5">
                                         <field name="OP">EQ</field>
                                         <value name="A">
                                           <block type="lists_length" id="B0-8oi/qN*^MH*+eY%}o">
                                             <value name="VALUE">
                                               <block type="variables_get" id="9wi8O-AzAH/n~~6ZmvsG">
                                                 <field name="VAR" id="p8z4a0D*3/v6krF]%fZK">an</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                         <value name="B">
                                           <block type="math_number" id="%6|xhjTa4nGB(Q8^QbWC">
                                             <field name="NUM">0</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <statement name="DO0">
                                       <block type="variables_set" id="-iZbaLpFBLPN.J@90mF~">
                                         <field name="VAR" id="P(vzemG|?%LTz:_r9=_I">ausgabe</field>
                                         <value name="VALUE">
                                           <block type="text" id="aejqq*esw$7N.go7eu}8">
                                             <field name="TEXT"></field>
                                           </block>
                                         </value>
                                       </block>
                                     </statement>
                                     <value name="IF1">
                                       <block type="logic_compare" id="J;3HQA0zahV=5||8`a{M">
                                         <field name="OP">EQ</field>
                                         <value name="A">
                                           <block type="lists_length" id="tGrk`@6hM}vbYuPp^.X?">
                                             <value name="VALUE">
                                               <block type="variables_get" id="*9Ls*xgSS$m3UsN-sRoL">
                                                 <field name="VAR" id="p8z4a0D*3/v6krF]%fZK">an</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                         <value name="B">
                                           <block type="math_number" id="bmu)D!?io4CW#nzEkUY#">
                                             <field name="NUM">1</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <statement name="DO1">
                                       <block type="variables_set" id="Q12Yagv4i-tD51BDOL^}">
                                         <field name="VAR" id="P(vzemG|?%LTz:_r9=_I">ausgabe</field>
                                         <value name="VALUE">
                                           <block type="lists_getIndex" id="uGu+PjyJ,YH},N)0^y`0">
                                             <mutation statement="false" at="true"></mutation>
                                             <field name="MODE">GET</field>
                                             <field name="WHERE">FROM_START</field>
                                             <value name="VALUE">
                                               <block type="variables_get" id="1:t{r2P-/)Dy:}/@pUpK">
                                                 <field name="VAR" id="p8z4a0D*3/v6krF]%fZK">an</field>
                                               </block>
                                             </value>
                                             <value name="AT">
                                               <block type="math_number" id="s!.zhK}UIPL42aEBV`kx">
                                                 <field name="NUM">1</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                       </block>
                                     </statement>
                                     <statement name="ELSE">
                                       <block type="variables_set" id="96@Bh=6u1R(Z?;6{3ElK">
                                         <field name="VAR" id="P(vzemG|?%LTz:_r9=_I">ausgabe</field>
                                         <value name="VALUE">
                                           <block type="lists_split" id="Ijd5bXGR[PLR6Asezh0Q">
                                             <mutation mode="JOIN"></mutation>
                                             <field name="MODE">JOIN</field>
                                             <value name="INPUT">
                                               <block type="variables_get" id="@[6p#KdsR}+[:i%rq0jp">
                                                 <field name="VAR" id="p8z4a0D*3/v6krF]%fZK">an</field>
                                               </block>
                                             </value>
                                             <value name="DELIM">
                                               <shadow type="text" id="MTy@`+OFu$3rBE02j^XH">
                                                 <field name="TEXT">,</field>
                                               </shadow>
                                               <block type="text_newline" id="%6,QDgXz|$,~l2IK]:14">
                                                 <field name="Type">\n</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                       </block>
                                     </statement>
                                     <next>
                                       <block type="update" id="ij5GfvgPkPgtFeM^r,6=">
                                         <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                         <field name="OID">0_userdata.0.Status.EG.Licht.Anzahl</field>
                                         <field name="WITH_DELAY">FALSE</field>
                                         <value name="VALUE">
                                           <block type="lists_length" id="yAh@[4L7aiqh|Y-mp=)T">
                                             <value name="VALUE">
                                               <block type="variables_get" id="gc)VyPoi_;-]k`}DWZ3(">
                                                 <field name="VAR" id="p8z4a0D*3/v6krF]%fZK">an</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                         <next>
                                           <block type="update" id="1#i4HwZ)Lu5@1*b6H%Q$">
                                             <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                             <field name="OID">0_userdata.0.Status.EG.Licht.Ausgabe</field>
                                             <field name="WITH_DELAY">FALSE</field>
                                             <value name="VALUE">
                                               <block type="variables_get" id="3ujfW6Y_|@F1$zIV_R11">
                                                 <field name="VAR" id="P(vzemG|?%LTz:_r9=_I">ausgabe</field>
                                               </block>
                                             </value>
                                           </block>
                                         </next>
                                       </block>
                                     </next>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </statement>
                   </block>
                 </next>
               </block>
             </next>
           </block>
           <block type="procedures_defcustomreturn" id="C0=Q3DO]s2JewM3;[Og1" x="337" y="-88">
             <mutation statements="false">
               <arg name="id" varid="49uXg6HLqFYWFA:qXC@Q"></arg>
             </mutation>
             <field name="NAME">parentName</field>
             <field name="SCRIPT">aWQgPSBpZC5zdWJzdHJpbmcoMCwgaWQubGFzdEluZGV4T2YoJy4nKSk7DQppZihleGlzdHNPYmplY3QoaWQpKSByZXR1cm4gZ2V0T2JqZWN0KGlkKS5jb21tb24ubmFtZTs=</field>
             <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
           </block>
          </xml>
          

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

            @jwerlsdf sagte: 10 Mal oder mehr.

            Die komplette ID-Liste muss außerhalb des Triggers erstellt werden, so wie gezeigt.

            Blockly_temp.JPG

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

              @paul53
              Perfekt vielen Dank dir!!! Funktioniert.

              1 Reply Last reply Reply Quote 0
              • J
                jwerlsdf last edited by

                Ich habe noch eine zweite Frage:
                Wenn ich mit dem Befehl

                *.on(functions=Licht-EG)
                

                den Status überprüfe, bekomme ich den Status vom "on" im Ordner "seg". Ich benötige das "on" aber direkt im Ordner "483fda....".
                Mit dem Befehl

                wled.0.483fda1f74d5.on(functions=Licht-EG)
                

                klappt es nicht.

                In der Aufzählung ist der "483fda..." Ordner ausgewählt.
                Nun meine Frage. Wie kann ich das erste "on" überspringen bzw. wie kann ich das richtige "on" direkt auswählen? Ich hoffe es ist verständlich?!

                Screenshot 2024-12-27 174555.png

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

                  @jwerlsdf sagte: In der Aufzählung ist der "483fda..." Ordner ausgewählt.

                  Was passiert, wenn dem Ordner "seg" ein anderes Gewerk zugewiesen wird?

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

                    @jwerlsdf sagte: Status vom "on" im Ordner "seg".

                    Man kann in der Schleife filtern.

                    Blockly_temp.JPG

                    ... das auch schon beim Erzeugen der ID-Liste:

                    Blockly_temp.JPG

                    ... oder als Ergänzung zu den CCU-Datenpunkten:

                    Blockly_temp.JPG

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

                      @paul53
                      auf das "nicht" hätte ich auch kommen können. Vielen Dank. Es hat wunderbar funktioniert.

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

                      Support us

                      ioBroker
                      Community Adapters
                      Donate

                      821
                      Online

                      31.9k
                      Users

                      80.3k
                      Topics

                      1.3m
                      Posts

                      2
                      9
                      350
                      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