Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. [gelöst] Werte abschneiden im Blockly

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    [gelöst] Werte abschneiden im Blockly

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

      Hallo Zusammen,

      Ich erstelle meine Aliase nach folgendem Schema
      Gerätename:State

      Ich lasse mir mit diesem Blockly eine Tabelle mit Lampen, welche an snd, erstellen

      blockly_lampen.png

      Nun sieht das Ergebnis so aus
      ergebnis_lampen.png

      Ist es möglich und wenn ja Wie alles nach dem ":" abzuschneiden?

      Vielen Dank im Voraus

      Gruß
      Marcel

      LÖSUNG:
      https://forum.iobroker.net/post/824819

      Dr. Bakterius 1 Reply Last reply Reply Quote 0
      • Dr. Bakterius
        Dr. Bakterius Most Active @Wszene last edited by

        @wszene Du kannst den Namen in eine weitere Liste mit Trennzeichen packen und da dann nur den ersten Teil verwenden.

        blockly.png

        Wszene 1 Reply Last reply Reply Quote 0
        • Wszene
          Wszene @Dr. Bakterius last edited by

          @dr-bakterius

          Danke für deine Antwort
          Leider weiß ich nicht wo und wie ich das einbauen soll

          Hier mal mein komplettes Blockly

          <xml xmlns="https://developers.google.com/blockly/xml">
           <variables>
             <variable id="Fwt*3`3ScyT(qDt?gf(T">ObjectID</variable>
             <variable id="./q,SFeGV,;)[@g=ERgm">Liste</variable>
             <variable id="K@h0-NY5VaI|@t!5/iJh">Wert</variable>
             <variable type="timeout" id="start">start</variable>
             <variable id="cTIvd#0frb]}?DN^7oUd">Liste-komplett</variable>
             <variable id="MLrrG!H:mqglsc.Y_Ljh">Liste-offen</variable>
             <variable id="9sl@{VQ/amrd~ZTB}e/O">i</variable>
             <variable id="}7$%uuGc-M*ZU6ZQ%SJ[">j</variable>
           </variables>
           <block type="procedures_defcustomnoreturn" id="D:0E=~0D8*EFnn8f|sd." x="-112" y="-937">
             <mutation statements="false"></mutation>
             <field name="NAME">Datenpunkte_erstellen</field>
             <field name="SCRIPT">Y3JlYXRlU3RhdGUoJzBfdXNlcmRhdGEuMC4wMDJfbnVyVklTLjIwX0luZm8uVGFiZWxsZS1MYW1wZW4nLCB7J25hbWUnOidBYmZyYWdlIExhbXBlbicsICd0eXBlJzonc3RyaW5nJywgJ3JlYWQnOnRydWUsICd3cml0ZSc6dHJ1ZSwgJ3JvbGUnOicnLCAnZGVmJzonQWJmcmFnZSBMYW1wZW4nLCAic21hcnROYW1lIjogZmFsc2UgfSk7</field>
             <comment pinned="false" h="80" w="160">Datenpunkte erstellen</comment>
           </block>
           <block type="procedures_defcustomreturn" id="]lQM=r`L^2M}s^@n(USH" x="-112" y="-887">
             <mutation statements="false">
               <arg name="ObjectID" varid="Fwt*3`3ScyT(qDt?gf(T"></arg>
             </mutation>
             <field name="NAME">Name</field>
             <field name="SCRIPT">bGV0IG5hbWUgPSBnZXRPYmplY3QoT2JqZWN0SUQpLmNvbW1vbi5uYW1lOwovL2lmKHR5cGVvZiByb29tID09ICdvYmplY3QnKSByZXR1cm4gcm9vbS5kZTsKcmV0dXJuICI8Yj4iK25hbWUrIjwvYj4iOw==</field>
             <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
           </block>
           <block type="procedures_defcustomreturn" id="v;YxDy}cJ+i39]iq7oim" x="-112" y="-862">
             <mutation statements="false">
               <arg name="ObjectID" varid="Fwt*3`3ScyT(qDt?gf(T"></arg>
             </mutation>
             <field name="NAME">Raum</field>
             <field name="SCRIPT">bGV0IHJvb20gPSBnZXRPYmplY3QoT2JqZWN0SUQsICdyb29tcycpLmVudW1OYW1lc1swXTsKaWYodHlwZW9mIHJvb20gPT0gJ29iamVjdCcpIHJvb20gPSByb29tLmRlOwpyZXR1cm4gIjxicj48c3BhbiBjbGFzcz0nJz48c21hbGw+Iityb29tKyI8L3NtYWxsPjwvc3Bhbj4iOwo=</field>
             <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
           </block>
           <block type="procedures_defcustomreturn" id="!t;U0AgoNU@W*^{W;)1~" x="-112" y="-837">
             <mutation statements="false">
               <arg name="Liste" varid="./q,SFeGV,;)[@g=ERgm"></arg>
               <arg name="Wert" varid="K@h0-NY5VaI|@t!5/iJh"></arg>
             </mutation>
             <field name="NAME">Multisort</field>
             <field name="SCRIPT">dmFyIFdlcnQgPSBXZXJ0IC0gMTsgCkxpc3RlLnNvcnQoZnVuY3Rpb24oYSwgYil7CiAgICByZXR1cm4gYltXZXJ0XSAtIGFbV2VydF07Cn0pOwpyZXR1cm4gTGlzdGU7</field>
             <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
           </block>
           <block type="comment" id="Wz9q30m1O=#@OImAQUHc" x="-112" y="-788">
             <field name="COMMENT">Funktion ausführen</field>
             <next>
               <block type="timeouts_settimeout" id="8FQd(trxfKDt`(FG0(?=">
                 <field name="NAME">start</field>
                 <field name="DELAY">1000</field>
                 <field name="UNIT">ms</field>
                 <statement name="STATEMENT">
                   <block type="procedures_callcustomnoreturn" id="}{A#y;jy-Pl_)n6[of`b">
                     <mutation name="Datenpunkte_erstellen"></mutation>
                   </block>
                 </statement>
                 <next>
                   <block type="on_ext" id="RT3@Kxqxg#w3f=(kzwCu">
                     <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="0)0sp$I1ccfm%4Sde-mT">
                         <field name="oid">default</field>
                       </shadow>
                       <block type="selector" id=",lvP%A]1J?Mf^@0s2D%[">
                         <field name="TEXT">state[id=*](functions=lampen_state)</field>
                       </block>
                     </value>
                     <statement name="STATEMENT">
                       <block type="variables_set" id="EaZb.Nmx4%jg9Z;%%B!-">
                         <field name="VAR" id="cTIvd#0frb]}?DN^7oUd">Liste-komplett</field>
                         <value name="VALUE">
                           <block type="text" id="Wh^sL0z$W-HIc=.KAWpS">
                             <field name="TEXT"></field>
                           </block>
                         </value>
                         <next>
                           <block type="variables_set" id="SS-}=kJy|nP`aiAV1-xb">
                             <field name="VAR" id="MLrrG!H:mqglsc.Y_Ljh">Liste-offen</field>
                             <value name="VALUE">
                               <block type="lists_create_with" id="$AFtq:sq?.LYHWTSs$x|">
                                 <mutation items="0"></mutation>
                               </block>
                             </value>
                             <next>
                               <block type="controls_forEach" id="~PaFX`X@5n{TM9K^{Jw6">
                                 <field name="VAR" id="9sl@{VQ/amrd~ZTB}e/O">i</field>
                                 <value name="LIST">
                                   <block type="selector" id="xQ^Q5{h5V@5PLI+YO@i.">
                                     <field name="TEXT">state[id=*](functions=lampen_state)</field>
                                   </block>
                                 </value>
                                 <statement name="DO">
                                   <block type="controls_if" id="-3J;6~}7Ac!D}IR`/Dr1">
                                     <value name="IF0">
                                       <block type="get_value_var" id=")kSAuROX6lA-U2N,FJ1Q">
                                         <field name="ATTR">val</field>
                                         <value name="OID">
                                           <shadow type="text" id="e+?Z+-m0_DLYGl{zT3ix">
                                             <field name="TEXT"></field>
                                           </shadow>
                                           <block type="variables_get" id="!fALmmY3PSF+?rGHUXQ,">
                                             <field name="VAR" id="9sl@{VQ/amrd~ZTB}e/O">i</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <statement name="DO0">
                                       <block type="lists_setIndex" id="-zUiNM(}BsoQ].Hu.|mx">
                                         <mutation at="false"></mutation>
                                         <field name="MODE">INSERT</field>
                                         <field name="WHERE">FIRST</field>
                                         <value name="LIST">
                                           <block type="variables_get" id="Q0Hct8=ken4m!!W]js)U">
                                             <field name="VAR" id="MLrrG!H:mqglsc.Y_Ljh">Liste-offen</field>
                                           </block>
                                         </value>
                                         <value name="TO">
                                           <block type="lists_create_with" id="6a@[p]s)BEL%k0#L3dY#">
                                             <mutation items="3"></mutation>
                                             <value name="ADD0">
                                               <block type="procedures_callcustomreturn" id="2fUjFt9g8rVF/XheoN.x">
                                                 <mutation name="Name">
                                                   <arg name="ObjectID"></arg>
                                                 </mutation>
                                                 <value name="ARG0">
                                                   <block type="variables_get" id="k:Is?gkGPl/=r1X^,k3K">
                                                     <field name="VAR" id="9sl@{VQ/amrd~ZTB}e/O">i</field>
                                                   </block>
                                                 </value>
                                               </block>
                                             </value>
                                             <value name="ADD1">
                                               <block type="procedures_callcustomreturn" id="}$wVs/^YVcjh{n/kS,q!">
                                                 <mutation name="Raum">
                                                   <arg name="ObjectID"></arg>
                                                 </mutation>
                                                 <value name="ARG0">
                                                   <block type="variables_get" id="E+iVny-H8b?jxnc3eZ/_">
                                                     <field name="VAR" id="9sl@{VQ/amrd~ZTB}e/O">i</field>
                                                   </block>
                                                 </value>
                                               </block>
                                             </value>
                                             <value name="ADD2">
                                               <block type="get_value_var" id="ZH.h{PJzN,EeXI-)JVDH">
                                                 <field name="ATTR">lc</field>
                                                 <value name="OID">
                                                   <shadow type="text">
                                                     <field name="TEXT"></field>
                                                   </shadow>
                                                   <block type="variables_get" id="!@Z.|vd8M+75I$7U.crR">
                                                     <field name="VAR" id="9sl@{VQ/amrd~ZTB}e/O">i</field>
                                                   </block>
                                                 </value>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                       </block>
                                     </statement>
                                   </block>
                                 </statement>
                                 <next>
                                   <block type="controls_if" id="%xroGCihVu8$~$xQ{]ke">
                                     <mutation else="1"></mutation>
                                     <value name="IF0">
                                       <block type="logic_negate" id="u(+LUZ2=D}K8JRKt()tg">
                                         <value name="BOOL">
                                           <block type="lists_isEmpty" id="zS,AjUzHt0uWh$(li$,h">
                                             <value name="VALUE">
                                               <block type="variables_get" id="b),0*5k:oMF~4H^Xx.Hw">
                                                 <field name="VAR" id="MLrrG!H:mqglsc.Y_Ljh">Liste-offen</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <statement name="DO0">
                                       <block type="text_append" id="+f`#OFcL{@YyO@sI#uCn">
                                         <field name="VAR" id="cTIvd#0frb]}?DN^7oUd">Liste-komplett</field>
                                         <value name="TEXT">
                                           <shadow type="text" id="H4$;I?/CC4T`*O7*UONY">
                                             <field name="TEXT"></field>
                                           </shadow>
                                           <block type="text" id="_u=h#j1gG^*i^j^JZqD6">
                                             <field name="TEXT">&lt;div class="table-status-headline"&gt;diese Lampen sind an&lt;/div&gt;&lt;table class="table-status"&gt;&lt;tbody&gt;</field>
                                           </block>
                                         </value>
                                         <next>
                                           <block type="controls_forEach" id="eWuU?Rt40RRVcn@?$@eq">
                                             <field name="VAR" id="}7$%uuGc-M*ZU6ZQ%SJ[">j</field>
                                             <value name="LIST">
                                               <block type="procedures_callcustomreturn" id="(AShS`,jO5uhez@2%ZNO">
                                                 <mutation name="Multisort">
                                                   <arg name="Liste"></arg>
                                                   <arg name="Wert"></arg>
                                                 </mutation>
                                                 <value name="ARG0">
                                                   <block type="variables_get" id="a;$8#B,;I75h-Hy}~}q3">
                                                     <field name="VAR" id="MLrrG!H:mqglsc.Y_Ljh">Liste-offen</field>
                                                   </block>
                                                 </value>
                                                 <value name="ARG1">
                                                   <block type="math_number" id="y28xQ%[n;@7Wa:a77wl!">
                                                     <field name="NUM">3</field>
                                                   </block>
                                                 </value>
                                               </block>
                                             </value>
                                             <statement name="DO">
                                               <block type="text_append" id="gf^b8UA.=3P(K5[$j)Bj">
                                                 <field name="VAR" id="cTIvd#0frb]}?DN^7oUd">Liste-komplett</field>
                                                 <value name="TEXT">
                                                   <shadow type="text">
                                                     <field name="TEXT"></field>
                                                   </shadow>
                                                   <block type="text_join" id=";7`[nwtLmM9SXh2[VePK">
                                                     <mutation items="8"></mutation>
                                                     <value name="ADD0">
                                                       <block type="text" id="j?`NI/7Gacv}dFN.+$PE">
                                                         <field name="TEXT">&lt;tr&gt;&lt;td class="table-status-icon"&gt;&lt;img src="/0_userdata.0/WS-Icons/Lampen/bulb-on.png"&gt;&lt;/td&gt;&lt;td class="table-status-device"&gt;</field>
                                                       </block>
                                                     </value>
                                                     <value name="ADD1">
                                                       <block type="lists_getIndex" id="@5OV65,;$.kv#!TecfHZ">
                                                         <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="EWa-I_dccB@]^nQe/W^d">
                                                             <field name="VAR" id="}7$%uuGc-M*ZU6ZQ%SJ[">j</field>
                                                           </block>
                                                         </value>
                                                         <value name="AT">
                                                           <block type="math_number" id="g}BE:?b{VIm/+ZX2V0__">
                                                             <field name="NUM">1</field>
                                                           </block>
                                                         </value>
                                                       </block>
                                                     </value>
                                                     <value name="ADD2">
                                                       <block type="lists_getIndex" id="q)iY@.m/$og@3$~)uH,K">
                                                         <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="g@zqTh)Ok*(KS$Z@eyc2">
                                                             <field name="VAR" id="}7$%uuGc-M*ZU6ZQ%SJ[">j</field>
                                                           </block>
                                                         </value>
                                                         <value name="AT">
                                                           <block type="math_number" id="xcqlR!$Dwpu}DNdHJgy5">
                                                             <field name="NUM">2</field>
                                                           </block>
                                                         </value>
                                                       </block>
                                                     </value>
                                                     <value name="ADD3">
                                                       <block type="text" id=",FstDM5*y1X5@,$t;^[k">
                                                         <field name="TEXT">&lt;/td&gt;&lt;td class="table-status-time"&gt;&lt;span class=""&gt;&lt;i&gt;Letzte Änderung:&lt;/i&gt;&lt;br&gt;</field>
                                                       </block>
                                                     </value>
                                                     <value name="ADD4">
                                                       <block type="convert_from_date" id="jhQmJJ_|F9dP%V#G7f2(">
                                                         <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                         <field name="OPTION">DD.MM.YYYY</field>
                                                         <value name="VALUE">
                                                           <block type="lists_getIndex" id="P3nC5W6:Y!7hvvwb[W4(">
                                                             <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="J]=7|JP6XXE0=iPV#!cV">
                                                                 <field name="VAR" id="}7$%uuGc-M*ZU6ZQ%SJ[">j</field>
                                                               </block>
                                                             </value>
                                                             <value name="AT">
                                                               <block type="math_number" id=",;WKYc]epU}2fK^CNY~Q">
                                                                 <field name="NUM">3</field>
                                                               </block>
                                                             </value>
                                                           </block>
                                                         </value>
                                                       </block>
                                                     </value>
                                                     <value name="ADD5">
                                                       <block type="text" id="@n3wTEG3`D{hPv(e[Wr)">
                                                         <field name="TEXT">, </field>
                                                       </block>
                                                     </value>
                                                     <value name="ADD6">
                                                       <block type="convert_from_date" id="XCt-c7RmMEAIAg:,hF]Y">
                                                         <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                         <field name="OPTION">hh:mm</field>
                                                         <value name="VALUE">
                                                           <block type="lists_getIndex" id="[aoz%*sr^}=m)|rI2a(t">
                                                             <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="{#={{3Gtp:2fb/o-ure(">
                                                                 <field name="VAR" id="}7$%uuGc-M*ZU6ZQ%SJ[">j</field>
                                                               </block>
                                                             </value>
                                                             <value name="AT">
                                                               <block type="math_number" id="2k8J6XGU%Y%uqN%8q5H|">
                                                                 <field name="NUM">3</field>
                                                               </block>
                                                             </value>
                                                           </block>
                                                         </value>
                                                       </block>
                                                     </value>
                                                     <value name="ADD7">
                                                       <block type="text" id="w]zt{}A*8rLlwGa7H=Ty">
                                                         <field name="TEXT"> Uhr&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;</field>
                                                       </block>
                                                     </value>
                                                   </block>
                                                 </value>
                                               </block>
                                             </statement>
                                             <next>
                                               <block type="text_append" id="yrfmMVllibE1D[1,T-8c">
                                                 <field name="VAR" id="cTIvd#0frb]}?DN^7oUd">Liste-komplett</field>
                                                 <value name="TEXT">
                                                   <shadow type="text">
                                                     <field name="TEXT"></field>
                                                   </shadow>
                                                   <block type="text" id="^^w-UuG$rGsR==gG(FoC">
                                                     <field name="TEXT">&lt;/tbody&gt;&lt;/table&gt;</field>
                                                   </block>
                                                 </value>
                                               </block>
                                             </next>
                                           </block>
                                         </next>
                                       </block>
                                     </statement>
                                     <statement name="ELSE">
                                       <block type="text_append" id="b8j0,y*t!!Yit@B8ZDu3">
                                         <field name="VAR" id="cTIvd#0frb]}?DN^7oUd">Liste-komplett</field>
                                         <value name="TEXT">
                                           <shadow type="text" id="nm)]Xdp_nV?LQWuQ:ElF">
                                             <field name="TEXT"></field>
                                           </shadow>
                                           <block type="text" id="Ce$MOG)(RZ9G-P`-x)P)">
                                             <field name="TEXT">&lt;div class="table-status-headline"&gt;alle Lampen sind aus&lt;/div&gt;</field>
                                           </block>
                                         </value>
                                       </block>
                                     </statement>
                                     <next>
                                       <block type="control" id="dI4yke%zrI0vqI$=7|!P">
                                         <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                         <field name="OID">0_userdata.0.002_nurVIS.20_Info.Tabelle-Lampen</field>
                                         <field name="WITH_DELAY">FALSE</field>
                                         <value name="VALUE">
                                           <block type="variables_get" id="1Q0Efv^4i*zZNN~`bBg,">
                                             <field name="VAR" id="cTIvd#0frb]}?DN^7oUd">Liste-komplett</field>
                                           </block>
                                         </value>
                                       </block>
                                     </next>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </statement>
                   </block>
                 </next>
               </block>
             </next>
           </block>
          </xml>
          

          Kannst du mir das evtl. einbauen damit ich mir das mal ansehen kann und auf die anderen Blocklys übertragen kann

          Danke imm Voraus

          Gruß
          Marcel

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

            @wszene sagte: Leider weiß ich nicht wo und wie ich das einbauen soll

            Am einfachsten in die Funktion Name(ObjectID):

            let name = getObject(ObjectID).common.name.split(':')[0];
            //if(typeof room == 'object') return room.de;
            return "<b>"+name+"</b>";
            
            Wszene 1 Reply Last reply Reply Quote 1
            • Wszene
              Wszene @paul53 last edited by

              @paul53

              Vielen Dank
              Genau so wollte ich das haben

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

              Support us

              ioBroker
              Community Adapters
              Donate

              788
              Online

              32.0k
              Users

              80.5k
              Topics

              1.3m
              Posts

              blockly
              3
              5
              185
              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