Hi,
Ich habe mir vor einer Weile den Spass gemacht, Witze über mein Sonos ausgeben zu lassen. Manchmal funktioniert die Ausgabe vermutlich wegen Sonderzeichen oder zu langem Text nicht.
Ich habe einen DP über den ich steuere, ob wir anwesend sind. Der muss entfernt oder durch eigenes ersetzt werden.
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="P,wQo^[Fz~%|pG;Df/}i">Ansage</variable>
<variable id="}^BHBb-J~Vzn`-G`]^:{">Witz</variable>
</variables>
<block type="schedule" id="ljxvq=y5RRyq4E#oc@14" x="148" y="215">
<field name="SCHEDULE">{"time":{"exactTime":true,"start":"08:00"},"period":{"days":1},"valid":{"from":"23.08.2024","to":""}}</field>
<statement name="STATEMENT">
<block type="controls_if" id=":s|$k_r9s*M$HiKzi{xP">
<value name="IF0">
<block type="get_value" id="(BVw01Ypb:pBZnhpncR5">
<field name="ATTR">val</field>
<field name="OID">hm-rega.1.950</field>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="g4wQ(3q?9mA1+0T30$E/">
<field name="VAR" id="P,wQo^[Fz~%|pG;Df/}i">Ansage</field>
<value name="VALUE">
<block type="text" id="P-;Lj,+ZDjrub{D%d1kw">
<field name="TEXT">Hier kommt der Witz zum Morgen!</field>
</block>
</value>
<next>
<block type="procedures_callnoreturn" id="k1K_euAkjg4lHz![7H0a">
<mutation name="Witz sagen"></mutation>
</block>
</next>
</block>
</statement>
</block>
</statement>
<next>
<block type="schedule" id="oSR-(|%lIv)M8^ovjq~B">
<field name="SCHEDULE">{"time":{"exactTime":true,"start":"12:00"},"period":{"days":1}}</field>
<statement name="STATEMENT">
<block type="controls_if" id="jF`6Ft,ly}1mn~-X{H]q">
<value name="IF0">
<block type="get_value" id="x(iQ7R{p9=^K|t9*6l~C">
<field name="ATTR">val</field>
<field name="OID">hm-rega.1.950</field>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="}mb4C$yGEvtzmsh0EW[*">
<field name="VAR" id="P,wQo^[Fz~%|pG;Df/}i">Ansage</field>
<value name="VALUE">
<block type="text" id="_%YH!L~`kJR:XDTZHGoo">
<field name="TEXT">Hier kommt der Witz zum Mittag!</field>
</block>
</value>
<next>
<block type="procedures_callnoreturn" id="CL}UcU`i?qIT}dr}L36b">
<mutation name="Witz sagen"></mutation>
</block>
</next>
</block>
</statement>
</block>
</statement>
<next>
<block type="schedule" id="F9PaQ7/I(s2HW}RgS0~9">
<field name="SCHEDULE">{"time":{"exactTime":true,"start":"18:35"},"period":{"days":1}}</field>
<statement name="STATEMENT">
<block type="controls_if" id=",ThPG_,Hfamul_KU$b34">
<value name="IF0">
<block type="get_value" id="{FNkgz*c].#lAG;D(0lQ">
<field name="ATTR">val</field>
<field name="OID">hm-rega.1.950</field>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="}H@W%H_y5R#;N+eeseT?">
<field name="VAR" id="P,wQo^[Fz~%|pG;Df/}i">Ansage</field>
<value name="VALUE">
<block type="text" id="2pg/[4X;=[bmW`xVho.X">
<field name="TEXT">Hier kommt der Witz zum Abend!</field>
</block>
</value>
<next>
<block type="procedures_callnoreturn" id="VWrT|R010T~@q9o0U7XC">
<mutation name="Witz sagen"></mutation>
</block>
</next>
</block>
</statement>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
<block type="procedures_defnoreturn" id="v2FV%/pOb4+){|To3cd+" x="738" y="213">
<field name="NAME">Witz sagen</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
<statement name="STACK">
<block type="comment" id="mb:4c})9P`htk]Id(!eQ">
<field name="COMMENT">https://witzapi.de/api-docs/</field>
<next>
<block type="comment" id="`cLCJ-V|OzT,YcGpObuA">
<field name="COMMENT">[&#10; {&#10; "name": "flachwitze",&#10; "language": "de"&#10; },&#10; {&#10; "name": "lehrerwitze",&#10; "language": "de"&#10; },&#10; {&#10; "name": "programmierwitze",&#10; "language": "de"&#10; },&#10; {&#10; "name": "scherzfragen",&#10; "language": "de"&#10; },&#10; {&#10; "name": "chuck-norris-witze",&#10; "language": "de"&#10; },&#10; {&#10; "name": "antiwitze",&#10; "language": "de"&#10; },&#10; {&#10; "name": "blondinenwitze",&#10; "language": "de"&#10; },&#10; {&#10; "name": "schulwitze",&#10; "language": "de"&#10; },&#10; {&#10; "name": "ddr-witze",&#10; "language": "de"&#10; },&#10; {&#10; "name": "arztwitze",&#10; "language": "de"&#10; }&#10;]</field>
<next>
<block type="http_get" id="XHG[{k+/c[l!v6)[NK+H">
<field name="TIMEOUT">2000</field>
<field name="UNIT">ms</field>
<field name="TYPE">text</field>
<value name="URL">
<shadow type="text" id="p8Ny1!yk#3$NRa]R8Z*1">
<field name="TEXT">https://witzapi.de/api/joke/?limit=1&category=schulwitze&language=de</field>
</shadow>
</value>
<statement name="STATEMENT">
<block type="variables_set" id=";,od]o$IzyXFN(i5(Q4L">
<field name="VAR" id="}^BHBb-J~Vzn`-G`]^:{">Witz</field>
<value name="VALUE">
<block type="convert_tostring" id="BFN;$`/faL_mp@Pi#~j2">
<value name="VALUE">
<block type="get_attr" id="IQO+JQ6QUfg+;es}ZP/+">
<value name="PATH">
<shadow type="text" id="9-jqimo~u0fA~v0Jt4Cr">
<field name="TEXT">0.text</field>
</shadow>
</value>
<value name="OBJECT">
<shadow type="get_object" id="$EnRO2FFbUxt_~X75;fp">
<field name="OID">Object ID</field>
</shadow>
<block type="convert_json2object" id="lvYLow:%3sUWvo}TOk8!">
<value name="VALUE">
<block type="http_response" id="9XHdEi|Wb0p@-}D64N(,">
<field name="ATTR">response.data</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" id="~FpNRA[pg2AJ2QLDx{hd">
<field name="VAR" id="}^BHBb-J~Vzn`-G`]^:{">Witz</field>
<value name="VALUE">
<block type="text_replace" id=":t,An_hwLCH*ANR6KBz:">
<value name="FROM">
<shadow type="text" id="xMdT5Zp;}n~B}tOr1F|z">
<field name="TEXT">x</field>
</shadow>
<block type="text_newline" id="q;p,msQv72*xS*num9=]">
<field name="Type">\n</field>
</block>
</value>
<value name="TO">
<shadow type="text" id="Xv4kT#2E4n{aUA,99$`9">
<field name="TEXT"></field>
</shadow>
</value>
<value name="TEXT">
<shadow type="text" id="wvBmlE[RAP,JvcuxX-Wo">
<field name="TEXT">text</field>
</shadow>
<block type="variables_get" id="~{D`u1d1mL[D,B^CBV;U">
<field name="VAR" id="}^BHBb-J~Vzn`-G`]^:{">Witz</field>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" id="@_eDGs`TCY#qI%eHt%Hf">
<field name="VAR" id="}^BHBb-J~Vzn`-G`]^:{">Witz</field>
<value name="VALUE">
<block type="text_replace" id="S(aBIO;:z[Gs.);kHQof">
<value name="FROM">
<shadow type="text" id="4Uh6r:((ykn}GR)PNB6s">
<field name="TEXT">\n-\</field>
</shadow>
</value>
<value name="TO">
<shadow type="text" id="4v+`$Iqfz/tWKu5r/?7~">
<field name="TEXT"></field>
</shadow>
</value>
<value name="TEXT">
<shadow type="text" id="wvBmlE[RAP,JvcuxX-Wo">
<field name="TEXT">text</field>
</shadow>
<block type="variables_get" id="!,R.G6vZR@[nXum,Udu5">
<field name="VAR" id="}^BHBb-J~Vzn`-G`]^:{">Witz</field>
</block>
</value>
</block>
</value>
<next>
<block type="control" id="-4P_6Z9rDY|i7H_1C58g">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">sayit.0.tts.clearQueue</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="logic_boolean" id=".)R3EA4NfIIE6TOOQrDX">
<field name="BOOL">TRUE</field>
</block>
</value>
<next>
<block type="controls_if" id=".[%c+!Tgq+(+#fkXIo02">
<value name="IF0">
<block type="logic_compare" id=":cLG33T0lAx3c{7AD`|5">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get" id="U!L4#N,Ukt[DH1.AlNlK">
<field name="VAR" id="P,wQo^[Fz~%|pG;Df/}i">Ansage</field>
</block>
</value>
<value name="B">
<block type="logic_null" id="pLjr;K3vS?Bw%ifB-/IE"></block>
</value>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="a5BTpG@od~O8D;zy]_d4">
<field name="VAR" id="P,wQo^[Fz~%|pG;Df/}i">Ansage</field>
<value name="VALUE">
<block type="text" id="?b)Aq.t%;h:x{Lm$DdQn">
<field name="TEXT">Hier kommt der nächste Witz:</field>
</block>
</value>
</block>
</statement>
<next>
<block type="sayit" id="{ZV3AK9Hw|lPHFe3XmlQ">
<field name="INSTANCE"></field>
<field name="LANGUAGE">de</field>
<field name="LOG"></field>
<value name="MESSAGE">
<shadow type="text" id="tlay}tEJ8w9%u]ijh%^8">
<field name="TEXT">text</field>
</shadow>
<block type="convert_tostring" id="`C3a1M3xnk+C(jvIw2V=">
<value name="VALUE">
<block type="variables_get" id="XiVLH/!opPlt!(qK-#sW">
<field name="VAR" id="P,wQo^[Fz~%|pG;Df/}i">Ansage</field>
</block>
</value>
</block>
</value>
<next>
<block type="control" id="BB`M3lIkw@M4?(Zha$a}">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">sayit.0.tts.clearQueue</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="logic_boolean" id=":7FtPeXJ-A6*,No_]eYj">
<field name="BOOL">TRUE</field>
</block>
</value>
<next>
<block type="timeouts_wait" id="[Ll`Dgv#I0*rf%%CDfP)">
<field name="DELAY">2</field>
<field name="UNIT">sec</field>
<next>
<block type="sayit" id="ZW_4bQ0`,.RRfy_pA-:H">
<field name="INSTANCE"></field>
<field name="LANGUAGE">de</field>
<field name="LOG">debug</field>
<value name="MESSAGE">
<shadow type="text" id="tlay}tEJ8w9%u]ijh%^8">
<field name="TEXT">text</field>
</shadow>
<block type="convert_tostring" id="3TKy-8zfbGNY|^hKb3f0">
<value name="VALUE">
<block type="variables_get" id="mmueqo/{z,VUaXFE^-_X">
<field name="VAR" id="}^BHBb-J~Vzn`-G`]^:{">Witz</field>
</block>
</value>
</block>
</value>
<next>
<block type="debug" id="_~XE!X,2OQENkRL_vsNr">
<field name="Severity">info</field>
<value name="TEXT">
<shadow type="text" id="-?0XWp6z0#OW{K|DJB[)">
<field name="TEXT">test</field>
</shadow>
<block type="text_join" id="fDytc36a_qf6$qECoar#">
<mutation items="4"></mutation>
<value name="ADD0">
<block type="text" id="P|M:Zc`9wXFC@:(DPZPI">
<field name="TEXT">-HausInfos- </field>
</block>
</value>
<value name="ADD1">
<block type="variables_get" id="2Z^)45I!W}HCpm?B9-5E">
<field name="VAR" id="P,wQo^[Fz~%|pG;Df/}i">Ansage</field>
</block>
</value>
<value name="ADD2">
<block type="text" id="fX4$v!W8BdNNFMN8r$dC">
<field name="TEXT">: </field>
</block>
</value>
<value name="ADD3">
<block type="variables_get" id="me]]zg9A$O8*e+7b,W(s">
<field name="VAR" id="}^BHBb-J~Vzn`-G`]^:{">Witz</field>
</block>
</value>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</xml>