Navigation

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

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Zufallstext wiedergeben

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

      Hallo Leute,

      ist es möglich mit Blockly auf einfache art und weise einen Zufallstext ausgeben zu lassen?

      z.B. Die Klingel wird betätigt und Alexa sagt "Es hat geklingelt" jetzt möchte ich dass nicht jedes mal "Es hat geklingelt" gesagt wird sondern aus mehreren Sätze per zufall einer ausgesucht wird.

      Hoffe Ihr versteht was ich meine. Ist sowas mit Blockly auf einfache art und weise zu lösen oder wird das komplizierterß

      Danke

      paul53 dslraser Dr. Bakterius 3 Replies Last reply Reply Quote 0
      • paul53
        paul53 @KhaosRipper last edited by

        @KhaosRipper
        Prinzip:

        Blockly_temp.JPG

        1 Reply Last reply Reply Quote 1
        • dslraser
          dslraser Forum Testing Most Active @KhaosRipper last edited by dslraser

          @KhaosRipper

          Du hast ja schon von @paul53 das richtige bekommen.
          Da ich aber zeitgleich am raussuchen war und auch das Blockly gefunden habe, hier noch was ähnliches. Hier wird zufallsgeneriert Licht unterschiedlich lang geschaltet. Das Blockly habe ich auch hier irgendwo im Forum gefunden. Kann man ganz gut zur Anwesenheitssimmulation nutzen, oder eben für verschiedene Texte umbauen.

          Bildschirmfoto 2019-09-13 um 15.05.38.png

          <xml xmlns="http://www.w3.org/1999/xhtml">
           <variables>
             <variable type="" id="hzy54MUcB;q+eVDWN_g:">TimerAktiv1</variable>
             <variable type="" id="pTtoT34%;7XTFEuGLn/f">TimerAktiv2</variable>
             <variable type="" id="/iB)b``3}l_R=}}4=4A2">TimerAktiv3</variable>
             <variable type="undefined" id="timeout">timeout</variable>
             <variable type="undefined" id="timeout2">timeout2</variable>
             <variable type="" id=")^z0DLi;YgCH4QWO8A6.">valZufall</variable>
             <variable type="undefined" id="timeout3">timeout3</variable>
           </variables>
           <block type="procedures_defnoreturn" id="]aih=G55?HS]7lpb*vSc" x="13" y="13">
             <field name="NAME">ZufallEins</field>
             <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
             <statement name="STACK">
               <block type="comment" id="UD8iI_FNE6Pa0}07og*[">
                 <field name="COMMENT">Schalte etwas ein</field>
                 <next>
                   <block type="control" id="ED=cN8;vC^#@G{/Ar}X9">
                     <mutation delay_input="false"></mutation>
                     <field name="OID">hue.0.HueBridge.Fernsehlampe_links.on</field>
                     <field name="WITH_DELAY">FALSE</field>
                     <value name="VALUE">
                       <block type="logic_boolean" id="QbwuRS!E)91vs04SFhcx">
                         <field name="BOOL">TRUE</field>
                       </block>
                     </value>
                     <next>
                       <block type="variables_set" id="gc%||Eu?4a-GR[lV#V+9">
                         <field name="VAR" id="hzy54MUcB;q+eVDWN_g:" variabletype="">TimerAktiv1</field>
                         <value name="VALUE">
                           <block type="logic_boolean" id=".f:;9;bHuW@Q8uTIM7cx">
                             <field name="BOOL">TRUE</field>
                           </block>
                         </value>
                         <next>
                           <block type="timeouts_settimeout" id="KUky=Au9Hf42KvR*saZi">
                             <field name="NAME">timeout</field>
                             <field name="DELAY">4</field>
                             <field name="UNIT">min</field>
                             <statement name="STATEMENT">
                               <block type="comment" id="!/W#E)^phCi/#d:rZ11M">
                                 <field name="COMMENT">Schalte etwas wieder aus</field>
                                 <next>
                                   <block type="control" id="J97f}9hq6rb2=*.3;mt5">
                                     <mutation delay_input="false"></mutation>
                                     <field name="OID">hue.0.HueBridge.Fernsehlampe_links.on</field>
                                     <field name="WITH_DELAY">FALSE</field>
                                     <value name="VALUE">
                                       <block type="logic_boolean" id="!~cb-+ln/td1zDut0#O!">
                                         <field name="BOOL">FALSE</field>
                                       </block>
                                     </value>
                                     <next>
                                       <block type="variables_set" id="45qLb@}f0E5vBYwGUs,H">
                                         <field name="VAR" id="hzy54MUcB;q+eVDWN_g:" variabletype="">TimerAktiv1</field>
                                         <value name="VALUE">
                                           <block type="logic_boolean" id="M69l1/uK.(zT^%3mbA|@">
                                             <field name="BOOL">FALSE</field>
                                           </block>
                                         </value>
                                       </block>
                                     </next>
                                   </block>
                                 </next>
                               </block>
                             </statement>
                           </block>
                         </next>
                       </block>
                     </next>
                   </block>
                 </next>
               </block>
             </statement>
           </block>
           <block type="procedures_defnoreturn" id="j6lr*@jITsr]ms8yhUh0" x="13" y="288">
             <field name="NAME">ZufallZwei</field>
             <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
             <statement name="STACK">
               <block type="comment" id="(K~gPu|WTF3rn%_]Wu|p">
                 <field name="COMMENT">Schalte etwas ein</field>
                 <next>
                   <block type="control" id="hF)HlaS*VSz}`sd3u(K*">
                     <mutation delay_input="false"></mutation>
                     <field name="OID">hue.0.HueBridge.Fernsehlampe_rechts.on</field>
                     <field name="WITH_DELAY">FALSE</field>
                     <value name="VALUE">
                       <block type="logic_boolean" id="VEqZzRpfd`LSx-UGb(Yp">
                         <field name="BOOL">TRUE</field>
                       </block>
                     </value>
                     <next>
                       <block type="variables_set" id="{(kXy~N;Z`.QRt}v*r3I">
                         <field name="VAR" id="pTtoT34%;7XTFEuGLn/f" variabletype="">TimerAktiv2</field>
                         <value name="VALUE">
                           <block type="logic_boolean" id="G6@Xxm=)a-dD[j{I=Yfv">
                             <field name="BOOL">TRUE</field>
                           </block>
                         </value>
                         <next>
                           <block type="timeouts_settimeout" id="xefMj,DIwtkW*2@Phw1Q">
                             <field name="NAME">timeout2</field>
                             <field name="DELAY">3</field>
                             <field name="UNIT">min</field>
                             <statement name="STATEMENT">
                               <block type="comment" id="A[?425Oyazos+*y8;Y2:">
                                 <field name="COMMENT">Schalte etwas wieder aus</field>
                                 <next>
                                   <block type="control" id=")u;,dqM7ph}ThmI^d%]_">
                                     <mutation delay_input="false"></mutation>
                                     <field name="OID">hue.0.HueBridge.Fernsehlampe_rechts.on</field>
                                     <field name="WITH_DELAY">FALSE</field>
                                     <value name="VALUE">
                                       <block type="logic_boolean" id="Vk8^EBNG^g8LdOV)VAEU">
                                         <field name="BOOL">FALSE</field>
                                       </block>
                                     </value>
                                     <next>
                                       <block type="variables_set" id="W,)iWjtj;*J1`9I8rbs8">
                                         <field name="VAR" id="pTtoT34%;7XTFEuGLn/f" variabletype="">TimerAktiv2</field>
                                         <value name="VALUE">
                                           <block type="logic_boolean" id="P=PZWs~Sdnb/7A_g1IMp">
                                             <field name="BOOL">FALSE</field>
                                           </block>
                                         </value>
                                       </block>
                                     </next>
                                   </block>
                                 </next>
                               </block>
                             </statement>
                           </block>
                         </next>
                       </block>
                     </next>
                   </block>
                 </next>
               </block>
             </statement>
           </block>
           <block type="procedures_defnoreturn" id=",%sXx)neL(hBuOH~l%%9" x="13" y="563">
             <field name="NAME">ZufallDrei</field>
             <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
             <statement name="STACK">
               <block type="comment" id="|;jKXPh/w,O.!TE~)5y6">
                 <field name="COMMENT">Schalte etwas ein</field>
                 <next>
                   <block type="control" id="m4+CXk,T|or#|aW{.i+T">
                     <mutation delay_input="false"></mutation>
                     <field name="OID">hue.0.HueBridge.Deckenlampe.on</field>
                     <field name="WITH_DELAY">FALSE</field>
                     <value name="VALUE">
                       <block type="logic_boolean" id="Q(S#(BE#-.9p9oL,hK5N">
                         <field name="BOOL">TRUE</field>
                       </block>
                     </value>
                     <next>
                       <block type="variables_set" id="WDYnD=%[7`Ot3b94P*cl">
                         <field name="VAR" id="/iB)b``3}l_R=}}4=4A2" variabletype="">TimerAktiv3</field>
                         <value name="VALUE">
                           <block type="logic_boolean" id="m{t-glCB~U:?~U6VhWvj">
                             <field name="BOOL">TRUE</field>
                           </block>
                         </value>
                         <next>
                           <block type="timeouts_settimeout" id="TX2ufws`26#AES|*Hmty">
                             <field name="NAME">timeout3</field>
                             <field name="DELAY">2</field>
                             <field name="UNIT">min</field>
                             <statement name="STATEMENT">
                               <block type="comment" id=";6|h5I,9xy=NsXaK6Pv{">
                                 <field name="COMMENT">Schalte etwas wieder aus</field>
                                 <next>
                                   <block type="control" id="!jhRkjpNWwMSGP@^rT2.">
                                     <mutation delay_input="false"></mutation>
                                     <field name="OID">hue.0.HueBridge.Deckenlampe.on</field>
                                     <field name="WITH_DELAY">FALSE</field>
                                     <value name="VALUE">
                                       <block type="logic_boolean" id="Ejqj;h))SCTnq(A_hjDJ">
                                         <field name="BOOL">FALSE</field>
                                       </block>
                                     </value>
                                     <next>
                                       <block type="variables_set" id="q7GtkJVZ!-R+JVdai^K(">
                                         <field name="VAR" id="/iB)b``3}l_R=}}4=4A2" variabletype="">TimerAktiv3</field>
                                         <value name="VALUE">
                                           <block type="logic_boolean" id="p!%n^3t8Q}JFG!y8~NPI">
                                             <field name="BOOL">FALSE</field>
                                           </block>
                                         </value>
                                       </block>
                                     </next>
                                   </block>
                                 </next>
                               </block>
                             </statement>
                           </block>
                         </next>
                       </block>
                     </next>
                   </block>
                 </next>
               </block>
             </statement>
           </block>
           <block type="variables_set" id="L=H_~o5VJkgoTi5YY.KE" x="13" y="838">
             <field name="VAR" id="hzy54MUcB;q+eVDWN_g:" variabletype="">TimerAktiv1</field>
             <value name="VALUE">
               <block type="logic_boolean" id="T64er+a{R[{{6+Z@@6!!">
                 <field name="BOOL">FALSE</field>
               </block>
             </value>
             <next>
               <block type="variables_set" id="+Y.ZBubE:0,Z~~m#zd_i">
                 <field name="VAR" id="pTtoT34%;7XTFEuGLn/f" variabletype="">TimerAktiv2</field>
                 <value name="VALUE">
                   <block type="logic_boolean" id="s]|Rj?9}`jI*Cml4FQS(">
                     <field name="BOOL">FALSE</field>
                   </block>
                 </value>
                 <next>
                   <block type="variables_set" id="@;[d)Qzp=M.C#V9E2N,}">
                     <field name="VAR" id="/iB)b``3}l_R=}}4=4A2" variabletype="">TimerAktiv3</field>
                     <value name="VALUE">
                       <block type="logic_boolean" id="(ojjvgRwq=qEW~jHwy)n">
                         <field name="BOOL">FALSE</field>
                       </block>
                     </value>
                     <next>
                       <block type="schedule" id="#q]X?XA6,T#oVG0~p2-k">
                         <field name="SCHEDULE">*/2 * * * *</field>
                         <statement name="STATEMENT">
                           <block type="variables_set" id="}.-BM_s!1lz.V*hvU@AY">
                             <field name="VAR" id=")^z0DLi;YgCH4QWO8A6." variabletype="">valZufall</field>
                             <value name="VALUE">
                               <block type="math_random_int" id="3Q/HHpL~EpbBr^HE~1df">
                                 <value name="FROM">
                                   <shadow type="math_number" id="A.LJ5W.UeB`qK(Tl2GvZ">
                                     <field name="NUM">1</field>
                                   </shadow>
                                 </value>
                                 <value name="TO">
                                   <shadow type="math_number" id="T{/dDJqQ1%YlMESV9(Nv">
                                     <field name="NUM">3</field>
                                   </shadow>
                                 </value>
                               </block>
                             </value>
                             <next>
                               <block type="controls_if" id="kGg5uFcR8[gxXgSzVl5n">
                                 <mutation elseif="2"></mutation>
                                 <value name="IF0">
                                   <block type="logic_operation" id="xjiFi#7YQNI7]`z,33Mu">
                                     <field name="OP">AND</field>
                                     <value name="A">
                                       <block type="logic_compare" id="?nV9axQ.ztUS+?mvR:^v">
                                         <field name="OP">EQ</field>
                                         <value name="A">
                                           <block type="variables_get" id="eGQClh}yINaaminM]h@M">
                                             <field name="VAR" id=")^z0DLi;YgCH4QWO8A6." variabletype="">valZufall</field>
                                           </block>
                                         </value>
                                         <value name="B">
                                           <block type="math_number" id="w)p6@Kl(M%rZZC2w[fk^">
                                             <field name="NUM">1</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <value name="B">
                                       <block type="logic_compare" id="NzT3W6+2/WT;2uey(k24">
                                         <field name="OP">EQ</field>
                                         <value name="A">
                                           <block type="variables_get" id="d71W,pX%p`J72;8{kfdS">
                                             <field name="VAR" id="hzy54MUcB;q+eVDWN_g:" variabletype="">TimerAktiv1</field>
                                           </block>
                                         </value>
                                         <value name="B">
                                           <block type="logic_boolean" id="(%,AB0sDN!#y4ic_{VjS">
                                             <field name="BOOL">FALSE</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                                 <statement name="DO0">
                                   <block type="procedures_callnoreturn" id="K0BT]GJP:#6Le6RdwqF8">
                                     <mutation name="ZufallEins"></mutation>
                                   </block>
                                 </statement>
                                 <value name="IF1">
                                   <block type="logic_operation" id="3I.%g:o.nI/5~#DJ.hzt">
                                     <field name="OP">AND</field>
                                     <value name="A">
                                       <block type="logic_compare" id="M0[QB+35R8YTEh=5Xge*">
                                         <field name="OP">EQ</field>
                                         <value name="A">
                                           <block type="variables_get" id="(tpMntf[RTlhk6nXF#Xk">
                                             <field name="VAR" id=")^z0DLi;YgCH4QWO8A6." variabletype="">valZufall</field>
                                           </block>
                                         </value>
                                         <value name="B">
                                           <block type="math_number" id="Nc.|J~M;eYEIWS|Q!J;l">
                                             <field name="NUM">2</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <value name="B">
                                       <block type="logic_compare" id=")hk;+S;aGF4(LrZFiBGg">
                                         <field name="OP">EQ</field>
                                         <value name="A">
                                           <block type="variables_get" id="2lHQKNO*mK.%;jMHNz,R">
                                             <field name="VAR" id="pTtoT34%;7XTFEuGLn/f" variabletype="">TimerAktiv2</field>
                                           </block>
                                         </value>
                                         <value name="B">
                                           <block type="logic_boolean" id="*5::xUcUsAP(GD7FbIP7">
                                             <field name="BOOL">FALSE</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                                 <statement name="DO1">
                                   <block type="procedures_callnoreturn" id="W87g2nl8jprwJXB]J[hw">
                                     <mutation name="ZufallZwei"></mutation>
                                   </block>
                                 </statement>
                                 <value name="IF2">
                                   <block type="logic_operation" id="gKdCsn^p71oA=GfsuDQF">
                                     <field name="OP">AND</field>
                                     <value name="A">
                                       <block type="logic_compare" id="g*j}gnPUy#/5aHdoBnr@">
                                         <field name="OP">EQ</field>
                                         <value name="A">
                                           <block type="variables_get" id="leS?FhGaeYN^U_eW=UC@">
                                             <field name="VAR" id=")^z0DLi;YgCH4QWO8A6." variabletype="">valZufall</field>
                                           </block>
                                         </value>
                                         <value name="B">
                                           <block type="math_number" id="L+jsa(J@;}6M8Rr%a}Yd">
                                             <field name="NUM">3</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <value name="B">
                                       <block type="logic_compare" id="V.0UinW/HOMtzsSO~vfn">
                                         <field name="OP">EQ</field>
                                         <value name="A">
                                           <block type="variables_get" id="eAK,rKQ|x[!;:KUE3;Tq">
                                             <field name="VAR" id="/iB)b``3}l_R=}}4=4A2" variabletype="">TimerAktiv3</field>
                                           </block>
                                         </value>
                                         <value name="B">
                                           <block type="logic_boolean" id="Fc6Bpci,#--yqGe0==Jt">
                                             <field name="BOOL">FALSE</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                                 <statement name="DO2">
                                   <block type="procedures_callnoreturn" id="{;AN3#fKQQ0kBms}=oDy">
                                     <mutation name="ZufallDrei"></mutation>
                                   </block>
                                 </statement>
                               </block>
                             </next>
                           </block>
                         </statement>
                       </block>
                     </next>
                   </block>
                 </next>
               </block>
             </next>
           </block>
          </xml>
          

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

            @KhaosRipper ich mache das mit einer Liste. Ist einfacher als die bisher gezeigten Möglichkeiten:
            blockly.jpg

            K 1 Reply Last reply Reply Quote 4
            • K
              KhaosRipper @Dr. Bakterius last edited by

              Super, danke für die ganzen Lösungen. Geht ja doch recht einfach.

              Ich habe mich für das von @Dr-Bakterius entschieden, da es doch am übersichtlichsten und einfachsten ist.

              Danke euch.

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

              Support us

              ioBroker
              Community Adapters
              Donate

              572
              Online

              31.7k
              Users

              79.7k
              Topics

              1.3m
              Posts

              4
              5
              576
              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