Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Blockly Skript HILFE!

    NEWS

    • Neues Video "KI im Smart Home" - ioBroker plus n8n

    • Neues Video über Aliase, virtuelle Geräte und Kategorien

    • Wir empfehlen: Node.js 22.x

    Blockly Skript HILFE!

    This topic has been deleted. Only users with topic management privileges can see it.
    • marcuskl
      marcuskl @Homoran last edited by

      @Homoran Ist fix

      Homoran 1 Reply Last reply Reply Quote 0
      • Homoran
        Homoran Global Moderator Administrators @marcuskl last edited by

        @marcuskl
        Jetzt lehne ich mich mal gaaanz weit aus dem fenster:
        MAC_finden.png

        Habe keine Ahnung ob das klappt

        <xml xmlns="http://www.w3.org/1999/xhtml">
         <variables>
           <variable type="" id="Gq+hJ(]M`1q4wk?WuJ31">Vorhanden</variable>
           <variable type="" id="Fy9)NJ*Ri:E`D+MB6J*f">MAC</variable>
           <variable type="undefined" id="timeout">timeout</variable>
         </variables>
         <block type="variables_set" id="b?BSL:ogTW]j@@}IXTdy" x="137" y="213">
           <field name="VAR" id="Gq+hJ(]M`1q4wk?WuJ31" variabletype="">Vorhanden</field>
           <value name="VALUE">
             <block type="math_number" id="(25wfY#Z(sP6%O=*7e)V">
               <field name="NUM">0</field>
             </block>
           </value>
           <next>
             <block type="variables_set" id="9$1@9m;7SV$`bj)P@X=U">
               <field name="VAR" id="Fy9)NJ*Ri:E`D+MB6J*f" variabletype="">MAC</field>
               <value name="VALUE">
                 <block type="text" id="[4IW*L=|_Zw4,CpyWGs`">
                   <field name="TEXT">AA:BB:CC:DD:EE</field>
                 </block>
               </value>
               <next>
                 <block type="on_ext" id="xc-DsF{ac!rVre7_uoQi">
                   <mutation items="1"></mutation>
                   <field name="CONDITION">ne</field>
                   <field name="ACK_CONDITION"></field>
                   <value name="OID0">
                     <shadow type="field_oid" id="Fr:Ep{+?+wkP4]a#}3rG">
                       <field name="oid">default</field>
                     </shadow>
                     <block type="get_value" id="Hiwj!G,5TU(CPs+auE85">
                       <field name="ATTR">val</field>
                       <field name="OID">ID auswählen</field>
                     </block>
                   </value>
                   <statement name="STATEMENT">
                     <block type="variables_set" id="VG?0Zr#Q@]7+#w:Fad!d">
                       <field name="VAR" id="Gq+hJ(]M`1q4wk?WuJ31" variabletype="">Vorhanden</field>
                       <value name="VALUE">
                         <block type="text_indexOf" id="sgIH(vOqM{-sQocl]GMW">
                           <field name="END">FIRST</field>
                           <value name="VALUE">
                             <block type="get_value" id=")2|@peC4tY9(sYh~Zw#X">
                               <field name="ATTR">val</field>
                               <field name="OID">ID auswählen</field>
                             </block>
                           </value>
                           <value name="FIND">
                             <shadow type="text" id="Ua3tgy@JGu7#jTxWWB0H">
                               <field name="TEXT">abc</field>
                             </shadow>
                             <block type="variables_get" id="}=oG^:2Vj|=n9T.Si;sA">
                               <field name="VAR" id="Fy9)NJ*Ri:E`D+MB6J*f" variabletype="">MAC</field>
                             </block>
                           </value>
                         </block>
                       </value>
                       <next>
                         <block type="controls_if" id="e,kKh-V[.9j(3h=JmJ5+">
                           <value name="IF0">
                             <block type="logic_compare" id="-{OAcLsNe,2NFlOO{w;5">
                               <field name="OP">GT</field>
                               <value name="A">
                                 <block type="variables_get" id="GBqZ^Tv3@`LFJU`VSdM?">
                                   <field name="VAR" id="Gq+hJ(]M`1q4wk?WuJ31" variabletype="">Vorhanden</field>
                                 </block>
                               </value>
                               <value name="B">
                                 <block type="math_number" id="K5C$+Wno;s50BbSzv3PY">
                                   <field name="NUM">0</field>
                                 </block>
                               </value>
                             </block>
                           </value>
                           <statement name="DO0">
                             <block type="update" id=")w,I?.Zz+a/v5GJ@%UnW">
                               <mutation delay_input="false"></mutation>
                               <field name="OID">Object ID</field>
                               <field name="WITH_DELAY">FALSE</field>
                               <value name="VALUE">
                                 <block type="logic_boolean" id="1S3p5gnIHm7I4_-rZ02P">
                                   <field name="BOOL">TRUE</field>
                                 </block>
                               </value>
                               <next>
                                 <block type="timeouts_settimeout" id="~3N1n$a0ZpSz%6bVFYIN">
                                   <field name="NAME">timeout</field>
                                   <field name="DELAY">1000</field>
                                   <field name="UNIT">ms</field>
                                   <statement name="STATEMENT">
                                     <block type="variables_set" id="b)QCrh-hDu--U0l[1Lih">
                                       <field name="VAR" id="Gq+hJ(]M`1q4wk?WuJ31" variabletype="">Vorhanden</field>
                                       <value name="VALUE">
                                         <block type="math_number" id="1k,HkrQ5b8xH2T=J~rs+">
                                           <field name="NUM">0</field>
                                         </block>
                                       </value>
                                     </block>
                                   </statement>
                                 </block>
                               </next>
                             </block>
                           </statement>
                         </block>
                       </next>
                     </block>
                   </statement>
                 </block>
               </next>
             </block>
           </next>
         </block>
         <block type="comment" id="%=d[,A+5G-[+dy/E)3^e" x="463" y="237">
           <field name="COMMENT">Datenpunkt</field>
         </block>
         <block type="comment" id="iERPrzZexHT(|#FH*d[[" x="588" y="312">
           <field name="COMMENT">Datenpunkt</field>
         </block>
        </xml>
        

        @paul53 wird mir schon die Leviten lesen 😉

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

          @Homoran sagte):

          @paul53 wird mir schon die Leviten lesen

          Ja, für einen Fehler, der Dir nicht mehr passieren sollte: Trigger auf einen Wert ?

          Homoran 1 Reply Last reply Reply Quote 0
          • Homoran
            Homoran Global Moderator Administrators @paul53 last edited by Homoran

            @paul53 sagte in Blockly Skript HILFE!:

            Trigger auf einen Wert ?

            Ääähm
            Was ist denn da passiert

            nee, so war das wirklich nicht gemeint - Sorry!

            Dämliches C&P
            MAC_finden_02.png
            so muss es

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

              @Homoran funktioniert danke 🙂

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

                @Homoran sagte in Blockly Skript HILFE!:

                so muss es

                Ich gehe mal davon aus, dass der Datenpunkt einen JSON-String enthält. Dann kann man es so ähnlich machen, wie @Homoran vorgeschlagen hat.

                Blockly_temp.JPG

                Zur Erläuterung:
                Die Variable Vorhanden ist 0 bei "nicht gefunden" und > 0 bei "gefunden"
                nicht nicht Vorhanden wandelt alle Werte <> 0 nach true und den Wert 0 nach false.

                <xml xmlns="http://www.w3.org/1999/xhtml">
                 <variables>
                   <variable type="" id="Fy9)NJ*Ri:E`D+MB6J*f">MAC</variable>
                   <variable type="" id="Gq+hJ(]M`1q4wk?WuJ31">Vorhanden</variable>
                 </variables>
                 <block type="variables_set" id="9$1@9m;7SV$`bj)P@X=U" x="137" y="239">
                   <field name="VAR" id="Fy9)NJ*Ri:E`D+MB6J*f" variabletype="">MAC</field>
                   <value name="VALUE">
                     <block type="text" id="[4IW*L=|_Zw4,CpyWGs`">
                       <field name="TEXT">7e:82:14:a7:67:64</field>
                     </block>
                   </value>
                   <next>
                     <block type="on_ext" id="xc-DsF{ac!rVre7_uoQi">
                       <mutation items="1"></mutation>
                       <field name="CONDITION">ne</field>
                       <field name="ACK_CONDITION"></field>
                       <value name="OID0">
                         <shadow type="field_oid" id="Fr:Ep{+?+wkP4]a#}3rG">
                           <field name="oid">default</field>
                         </shadow>
                       </value>
                       <statement name="STATEMENT">
                         <block type="variables_set" id="VG?0Zr#Q@]7+#w:Fad!d">
                           <field name="VAR" id="Gq+hJ(]M`1q4wk?WuJ31" variabletype="">Vorhanden</field>
                           <value name="VALUE">
                             <block type="text_indexOf" id="sgIH(vOqM{-sQocl]GMW">
                               <field name="END">FIRST</field>
                               <value name="VALUE">
                                 <block type="on_source" id="5./8v/8wMV{yFATu)oNK">
                                   <field name="ATTR">state.val</field>
                                 </block>
                               </value>
                               <value name="FIND">
                                 <shadow type="text" id="Ua3tgy@JGu7#jTxWWB0H">
                                   <field name="TEXT">abc</field>
                                 </shadow>
                                 <block type="variables_get" id="}=oG^:2Vj|=n9T.Si;sA">
                                   <field name="VAR" id="Fy9)NJ*Ri:E`D+MB6J*f" variabletype="">MAC</field>
                                 </block>
                               </value>
                             </block>
                           </value>
                           <next>
                             <block type="update" id=")w,I?.Zz+a/v5GJ@%UnW">
                               <mutation delay_input="false"></mutation>
                               <field name="OID">Object ID</field>
                               <field name="WITH_DELAY">FALSE</field>
                               <value name="VALUE">
                                 <block type="logic_negate" id="7*{{jb}$p/`G!G$WSj^j">
                                   <value name="BOOL">
                                     <block type="logic_negate" id="/]MSH9:MdQx=N,h$G]6v">
                                       <value name="BOOL">
                                         <block type="variables_get" id="GBqZ^Tv3@`LFJU`VSdM?">
                                           <field name="VAR" id="Gq+hJ(]M`1q4wk?WuJ31" variabletype="">Vorhanden</field>
                                         </block>
                                       </value>
                                     </block>
                                   </value>
                                 </block>
                               </value>
                             </block>
                           </next>
                         </block>
                       </statement>
                     </block>
                   </next>
                 </block>
                 <block type="comment" id="%=d[,A+5G-[+dy/E)3^e" x="363" y="263">
                   <field name="COMMENT">Datenpunkt</field>
                 </block>
                </xml>
                

                Homoran 1 Reply Last reply Reply Quote 0
                • Homoran
                  Homoran Global Moderator Administrators @paul53 last edited by

                  @paul53 sagte in Blockly Skript HILFE!:

                  Zur Erläuterung:
                  Die Variable Vorhanden ist 0 bei "nicht gefunden" und > 0 bei "gefunden"
                  nicht nicht Vorhanden wandelt alle Werte <> 0 nach true und den Wert 0 nach false.

                  und die muss nicht zur Sicherheit wieder auf 0 gesetzt werden, damit beim nächsten Durchlauf auch alles stimmt?

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

                    @Homoran sagte:

                    die muss nicht zur Sicherheit wieder auf 0 gesetzt werden, damit beim nächsten Durchlauf auch alles stimmt?

                    Nein, die Position im String wird jedesmal wieder neu ermittelt und wird bei "nicht vorhanden" automatisch zu 0.

                    Homoran 1 Reply Last reply Reply Quote 0
                    • Homoran
                      Homoran Global Moderator Administrators @paul53 last edited by

                      @paul53 Danke!

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

                        @marcuskl sagte:

                        @Homoran funktioniert danke

                        Im Script von @Homoran bleibt der Datenpunkt-Wert immer auf true, wenn er einmal auf true gesetzt wurde.

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

                          @Homoran habe ein sonst setze objelt auf false gemacht.
                          So setzt es wenn nicht vorhanden auf false.

                          1 Reply Last reply Reply Quote 0
                          • Homoran
                            Homoran Global Moderator Administrators @paul53 last edited by

                            @paul53 sagte in Blockly Skript HILFE!:

                            Im Script von @Homoran bleibt der Datenpunkt-Wert immer auf true, wenn er einmal auf true gesetzt wurde.

                            so was hatte ich befürchtet - auch hier Danke!

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

                            Support us

                            ioBroker
                            Community Adapters
                            Donate

                            456
                            Online

                            32.1k
                            Users

                            80.7k
                            Topics

                            1.3m
                            Posts

                            blockly javascript
                            3
                            16
                            670
                            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