Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. [Vorlage] Material Design Alerts (ohne Javascript)

    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

    [Vorlage] Material Design Alerts (ohne Javascript)

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

      Moin zusammen,

      da es rund um das Material Design Alert Widget immer wieder Fragen gibt, wie man das Einbinden kann, grade auch mit Blockly... und die meisten Lösungen doch irgendwie auf Javascript hinauslaufen (womit ich auch auf Kriegsfuß stehe), möchte ich hier mal meine reine Blockly-Lösung vorstellen.

      Benötigt werden:
      2 Datenpunke irgendwo unter Userdata: meine beiden heißen "alerts" und "newAlert".

      das Blockly siehe weiter unten

      und das Material Design Alert Widget irgendwo in euer Visu

      die fertigen Alarme sehen dann so aus...
      83646fb6-4354-4ede-900d-d4498c338d09-grafik.png

      ich habe ein paar Typen von Alarmen vordefiniert.
      (error, warning, info, message, accept, denied, tip, phone, heating)

      das Blockly erstellt das benötigte JSON selbstständig um die Benutzung möglichst einfach zu machen.

      aktiviert wird ein Alarm einfach in dem in den Datenpunkt "newAlert" ein neuer Wert eingetragen wird.

      "error:Das ist ein Error!"

      erzeugt sowas:
      ce22034d-7d2a-4e63-b6ed-2b85c563bd7c-grafik.png

      Der Alert kann von allem ausgelöst werden, was Daten in einen Datenpunkt schreiben kann.
      also ein einfacher Button:
      e0e67617-72cd-4a53-b0c2-0529a807090f-grafik.png

      oder ein anderes Script:
      d0dac986-53dd-4caf-8854-799355c3b9a2-grafik.png

      Die vordefinierten Typen lassen sich natürlich ohne Problem anpassen oder erweitern.
      Für den Fall, das ein unbekannter Typ oder gar kein Typ an den Datenpunkt gesendet wird, kommt ein default-Design mit der entspechenden Meldung.
      bc6baa49-1590-4a76-a843-64c15bfce8fc-grafik.png

      Das Blockly verfügt über einen 2ten Falls-Block, der die Nachrichten automatisch nach der eingestellten Zeit (default 5 Sekunden) wieder ausblendet... wer das nicht will, kann den Block einfach deaktivieren.

      Hier jetzt der Blockly-Code...

      <xml xmlns="https://developers.google.com/blockly/xml">
       <variables>
         <variable type="timeout" id="timeout">timeout</variable>
         <variable id="]XwsY;=tw[%:{?%f-irt">type</variable>
         <variable id="+VNO=pSk{,,E(Gh/yDUp">newAlert</variable>
         <variable id="2VPfN%TG%bnR{BGYks5b">message</variable>
         <variable id="gR8!KbB2WoS`LbznPcxD">backgroundColor</variable>
         <variable id="bp;Mwj*?85R$!$1shIJ}">new</variable>
         <variable id="6nQUI=e3;K|3rKnnkBI]">newList</variable>
         <variable id="Yri]Bw2G~pE4$}|.p]E9">icon</variable>
         <variable id="NiktQiA%r`TOz;Vi{Fku">list</variable>
         <variable id="Pc90O=5(V2G1t;v+b|![">iconColor</variable>
         <variable id="LXTn{bFJUx957Zg=bS,$">fontColor</variable>
       </variables>
       <block type="on_ext" id="l@P6!=VtnHYp=w4v8}g3" x="63" y="-87">
         <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=";=YkUCOMA!K1$w+s?MW9">
             <field name="oid">0_userdata.0.Test.newAlert</field>
           </shadow>
         </value>
         <statement name="STATEMENT">
           <block type="controls_if" id="qVDTNX.[_q},/kz^,(9=">
             <value name="IF0">
               <block type="logic_compare" id=".$NMb^c?;4/u3q%wjBc_">
                 <field name="OP">NEQ</field>
                 <value name="A">
                   <block type="on_source" id="i(Ox#-5|~qRXakvJV7Fn">
                     <field name="ATTR">state.val</field>
                   </block>
                 </value>
                 <value name="B">
                   <block type="math_number" id="rp`E0Ltgan~3FSP^7ku-">
                     <field name="NUM">0</field>
                   </block>
                 </value>
               </block>
             </value>
             <statement name="DO0">
               <block type="controls_if" id="l2(DPY@B)A?EyPX*NKzu">
                 <mutation else="1"></mutation>
                 <value name="IF0">
                   <block type="logic_compare" id="aw-eF:g/57+yr@;=F/r#">
                     <field name="OP">EQ</field>
                     <value name="A">
                       <block type="text_indexOf" id="xMin/mJ[3URVo@6W.F1y">
                         <field name="END">FIRST</field>
                         <value name="VALUE">
                           <block type="on_source" id="c3+hzNN;9gD6~v#V%V5o">
                             <field name="ATTR">state.val</field>
                           </block>
                         </value>
                         <value name="FIND">
                           <shadow type="text" id="2g6%JF3GBig.]F/@NM7Y">
                             <field name="TEXT">:</field>
                           </shadow>
                         </value>
                       </block>
                     </value>
                     <value name="B">
                       <block type="math_number" id="i-reAT!U?:t44t{`ug}X">
                         <field name="NUM">0</field>
                       </block>
                     </value>
                   </block>
                 </value>
                 <statement name="DO0">
                   <block type="variables_set" id="n]:dvh-Qq-|Q1~SCOmCF">
                     <field name="VAR" id="]XwsY;=tw[%:{?%f-irt">type</field>
                     <value name="VALUE">
                       <block type="text" id="dH`K,-v-%IlbKp[GZ4Pa">
                         <field name="TEXT">default</field>
                       </block>
                     </value>
                     <next>
                       <block type="variables_set" id="`VTjggguz~s1-SQqlNp;">
                         <field name="VAR" id="2VPfN%TG%bnR{BGYks5b">message</field>
                         <value name="VALUE">
                           <block type="on_source" id="zNd|#;LNpl,I=yIUFx@$">
                             <field name="ATTR">state.val</field>
                           </block>
                         </value>
                       </block>
                     </next>
                   </block>
                 </statement>
                 <statement name="ELSE">
                   <block type="variables_set" id="P0nCO[/RQMW?IrGn(Lu7">
                     <field name="VAR" id="+VNO=pSk{,,E(Gh/yDUp">newAlert</field>
                     <value name="VALUE">
                       <block type="lists_split" id="5a/JFM29|9hae++OxTM|">
                         <mutation mode="SPLIT"></mutation>
                         <field name="MODE">SPLIT</field>
                         <value name="INPUT">
                           <block type="on_source" id="$[EK(i$/JX{d2fp=Y-BU">
                             <field name="ATTR">state.val</field>
                           </block>
                         </value>
                         <value name="DELIM">
                           <shadow type="text" id="ysf!DN(Z?A07[k}EDkFM">
                             <field name="TEXT">:</field>
                           </shadow>
                         </value>
                       </block>
                     </value>
                     <next>
                       <block type="variables_set" id="|4/saybqgc:OHx6k{F~a">
                         <field name="VAR" id="]XwsY;=tw[%:{?%f-irt">type</field>
                         <value name="VALUE">
                           <block type="lists_getIndex" id="/SdjE(wr|DgvclK5Q8tR">
                             <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="=c=v=w8K/s{R2+gCV9A~">
                                 <field name="VAR" id="+VNO=pSk{,,E(Gh/yDUp">newAlert</field>
                               </block>
                             </value>
                             <value name="AT">
                               <block type="math_number" id="384JI_sn,~qf:qvzpIp+">
                                 <field name="NUM">1</field>
                               </block>
                             </value>
                           </block>
                         </value>
                         <next>
                           <block type="variables_set" id="G(Q!5#gd#qBC=,OcX+=y">
                             <field name="VAR" id="2VPfN%TG%bnR{BGYks5b">message</field>
                             <value name="VALUE">
                               <block type="lists_getIndex" id="k:xctzmu,+/Y.-KhT%^}">
                                 <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="J9i_Bm[/MJQS3)~xsGA6">
                                     <field name="VAR" id="+VNO=pSk{,,E(Gh/yDUp">newAlert</field>
                                   </block>
                                 </value>
                                 <value name="AT">
                                   <block type="math_number" id="n.#VtS/0]~sU*eJ~^Lz9">
                                     <field name="NUM">2</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                           </block>
                         </next>
                       </block>
                     </next>
                   </block>
                 </statement>
                 <next>
                   <block type="logic_switch_case" id="E9(rTBEAHyDjI{`3Eq#:" inline="false">
                     <mutation xmlns="http://www.w3.org/1999/xhtml" case="8" default="1"></mutation>
                     <value name="CONDITION">
                       <block type="variables_get" id="C$FKO~Lq$dzr6eP2aeoI">
                         <field name="VAR" id="]XwsY;=tw[%:{?%f-irt">type</field>
                       </block>
                     </value>
                     <value name="CASECONDITION0">
                       <block type="text" id="#K|8ck*.ec6v;U5W}@LU">
                         <field name="TEXT">error</field>
                       </block>
                     </value>
                     <statement name="CASE0">
                       <block type="variables_set" id="?l?QclKzo$F1V}5rmfmt">
                         <field name="VAR" id="gR8!KbB2WoS`LbznPcxD">backgroundColor</field>
                         <value name="VALUE">
                           <block type="text" id="gu=]uN(KK]?~[c51@~2w">
                             <field name="TEXT">red</field>
                           </block>
                         </value>
                         <next>
                           <block type="variables_set" id="it5xzirN[W9)NGgRt-QY">
                             <field name="VAR" id="Yri]Bw2G~pE4$}|.p]E9">icon</field>
                             <value name="VALUE">
                               <block type="text" id="f~vb+=e5|A#yOppHcGl{">
                                 <field name="TEXT">alert-octagon-outline</field>
                               </block>
                             </value>
                             <next>
                               <block type="variables_set" id="_T#HgZu|YL]}T;z?WT-(">
                                 <field name="VAR" id="Pc90O=5(V2G1t;v+b|![">iconColor</field>
                                 <value name="VALUE">
                                   <block type="text" id="y%7oEqtXRI=Tsnu0WtDF">
                                     <field name="TEXT">yellow</field>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="variables_set" id=".ae6DB,un#[ZEKbC4YGG">
                                     <field name="VAR" id="LXTn{bFJUx957Zg=bS,$">fontColor</field>
                                     <value name="VALUE">
                                       <block type="text" id="e98FYw$~22I-Q{dAUmrQ">
                                         <field name="TEXT">black</field>
                                       </block>
                                     </value>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </statement>
                     <value name="CASECONDITION1">
                       <block type="text" id="txlE(AV@_zWT$YGz[wb2">
                         <field name="TEXT">warning</field>
                       </block>
                     </value>
                     <statement name="CASE1">
                       <block type="variables_set" id="g`/-[1_]X!E!;]C6TJL~">
                         <field name="VAR" id="gR8!KbB2WoS`LbznPcxD">backgroundColor</field>
                         <value name="VALUE">
                           <block type="text" id="vAdb/ad|Zs{3SN%U;X!]">
                             <field name="TEXT">yellow</field>
                           </block>
                         </value>
                         <next>
                           <block type="variables_set" id="h-D^-rsI!KxZCKjC9mFo">
                             <field name="VAR" id="Yri]Bw2G~pE4$}|.p]E9">icon</field>
                             <value name="VALUE">
                               <block type="text" id="PRA8)QM3pOby^-Gx~bBD">
                                 <field name="TEXT">alert-outline</field>
                               </block>
                             </value>
                             <next>
                               <block type="variables_set" id="PH.Vp~.siMFZXw:QM+!L">
                                 <field name="VAR" id="Pc90O=5(V2G1t;v+b|![">iconColor</field>
                                 <value name="VALUE">
                                   <block type="text" id="VGxZI:A7G1J~wo0[QFve">
                                     <field name="TEXT">red</field>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="variables_set" id="a6z*rp7kZdNb**N3Gtkj">
                                     <field name="VAR" id="LXTn{bFJUx957Zg=bS,$">fontColor</field>
                                     <value name="VALUE">
                                       <block type="text" id="ykTIS.Xo~is:D3?B8.2_">
                                         <field name="TEXT">black</field>
                                       </block>
                                     </value>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </statement>
                     <value name="CASECONDITION2">
                       <block type="text" id="QY=sK]AMPC/gDY;-u.}!">
                         <field name="TEXT">info</field>
                       </block>
                     </value>
                     <statement name="CASE2">
                       <block type="variables_set" id="6vU73S;w(ML`_])j9X8_">
                         <field name="VAR" id="gR8!KbB2WoS`LbznPcxD">backgroundColor</field>
                         <value name="VALUE">
                           <block type="text" id="*d.*Mc+6A9BneVp#zo3y">
                             <field name="TEXT">lightblue</field>
                           </block>
                         </value>
                         <next>
                           <block type="variables_set" id="T9r@DE3Kz$qE?#RpMdtA">
                             <field name="VAR" id="Yri]Bw2G~pE4$}|.p]E9">icon</field>
                             <value name="VALUE">
                               <block type="text" id="F3IlWHMd,}3NiNp5)kIX">
                                 <field name="TEXT">information-outline</field>
                               </block>
                             </value>
                             <next>
                               <block type="variables_set" id="RaB]_in/[pcFe(dL+90B">
                                 <field name="VAR" id="Pc90O=5(V2G1t;v+b|![">iconColor</field>
                                 <value name="VALUE">
                                   <block type="text" id="_27u*A_-.rVyjm2B7GaG">
                                     <field name="TEXT">blue</field>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="variables_set" id="ye*A[Egs72@8!yWXvjuz">
                                     <field name="VAR" id="LXTn{bFJUx957Zg=bS,$">fontColor</field>
                                     <value name="VALUE">
                                       <block type="text" id="c)zpt,ZC(2=MtK%D*W`2">
                                         <field name="TEXT">black</field>
                                       </block>
                                     </value>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </statement>
                     <value name="CASECONDITION3">
                       <block type="text" id="Fc7$m-c(nidl=x1G1Gw!">
                         <field name="TEXT">message</field>
                       </block>
                     </value>
                     <statement name="CASE3">
                       <block type="variables_set" id="4n,O+%NY[;It0#*2LH_N">
                         <field name="VAR" id="gR8!KbB2WoS`LbznPcxD">backgroundColor</field>
                         <value name="VALUE">
                           <block type="text" id="s}s6`Ebhb,br{uXNr|Zq">
                             <field name="TEXT">lightblue</field>
                           </block>
                         </value>
                         <next>
                           <block type="variables_set" id=".F4Dl!XJ9PdHz?S*eCiW">
                             <field name="VAR" id="Yri]Bw2G~pE4$}|.p]E9">icon</field>
                             <value name="VALUE">
                               <block type="text" id="*r/@)VX]x;NIZ4PlFcAp">
                                 <field name="TEXT">message-text-outline</field>
                               </block>
                             </value>
                             <next>
                               <block type="variables_set" id="IJPFtiN|$UrHc`U;!TbB">
                                 <field name="VAR" id="Pc90O=5(V2G1t;v+b|![">iconColor</field>
                                 <value name="VALUE">
                                   <block type="text" id="}.wlo!WY`~5J)rQQ;}F~">
                                     <field name="TEXT">blue</field>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="variables_set" id="L9IV:=]NlXbccn-E,9u+">
                                     <field name="VAR" id="LXTn{bFJUx957Zg=bS,$">fontColor</field>
                                     <value name="VALUE">
                                       <block type="text" id="_qmY7|wyfe!Ddi+Z`9)1">
                                         <field name="TEXT">black</field>
                                       </block>
                                     </value>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </statement>
                     <value name="CASECONDITION4">
                       <block type="text" id="KjQH:QuY1:0-t,7m#)En">
                         <field name="TEXT">accept</field>
                       </block>
                     </value>
                     <statement name="CASE4">
                       <block type="variables_set" id="lB?1Y!FV[id|9h_:!)Rn">
                         <field name="VAR" id="gR8!KbB2WoS`LbznPcxD">backgroundColor</field>
                         <value name="VALUE">
                           <block type="text" id="!7!Nb`gezUM}~tgSZ0dU">
                             <field name="TEXT">green</field>
                           </block>
                         </value>
                         <next>
                           <block type="variables_set" id="Up1jUg_1wG7jRtZX20f?">
                             <field name="VAR" id="Yri]Bw2G~pE4$}|.p]E9">icon</field>
                             <value name="VALUE">
                               <block type="text" id="uq69C)!~O#AoDd|,4PkQ">
                                 <field name="TEXT">check-circle-outline</field>
                               </block>
                             </value>
                             <next>
                               <block type="variables_set" id="K([%/BxNE2D7]-8U:%;b">
                                 <field name="VAR" id="Pc90O=5(V2G1t;v+b|![">iconColor</field>
                                 <value name="VALUE">
                                   <block type="text" id="5f*T{9rq`Fqksig.v;tw">
                                     <field name="TEXT">lime</field>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="variables_set" id="~1^+#@6`cPc:ji;EvIH4">
                                     <field name="VAR" id="LXTn{bFJUx957Zg=bS,$">fontColor</field>
                                     <value name="VALUE">
                                       <block type="text" id="m6Aq`Hoi^Z:O_KMImuG+">
                                         <field name="TEXT">white</field>
                                       </block>
                                     </value>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </statement>
                     <value name="CASECONDITION5">
                       <block type="text" id="]h~DqA`)KP;k}bf$=[q|">
                         <field name="TEXT">denied</field>
                       </block>
                     </value>
                     <statement name="CASE5">
                       <block type="variables_set" id="9EFb(7d7{`OnZ$D%;g}D">
                         <field name="VAR" id="gR8!KbB2WoS`LbznPcxD">backgroundColor</field>
                         <value name="VALUE">
                           <block type="text" id="{+y$3]MWh^).EBJlK|q5">
                             <field name="TEXT">darkred</field>
                           </block>
                         </value>
                         <next>
                           <block type="variables_set" id="I/Jzb/L}L,{n4yw-3E[d">
                             <field name="VAR" id="Yri]Bw2G~pE4$}|.p]E9">icon</field>
                             <value name="VALUE">
                               <block type="text" id="T~Z=PayGijWhf*`+G!el">
                                 <field name="TEXT">cancel</field>
                               </block>
                             </value>
                             <next>
                               <block type="variables_set" id="9wA$1Yd)auKjGuV28U7~">
                                 <field name="VAR" id="Pc90O=5(V2G1t;v+b|![">iconColor</field>
                                 <value name="VALUE">
                                   <block type="text" id="uCm6SLi,?R!SLNL`FMg2">
                                     <field name="TEXT">red</field>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="variables_set" id="UcpJ4%+7D.W.QC%%kv:5">
                                     <field name="VAR" id="LXTn{bFJUx957Zg=bS,$">fontColor</field>
                                     <value name="VALUE">
                                       <block type="text" id="OEsR;em-_g)dQ]/%-CLO">
                                         <field name="TEXT">white</field>
                                       </block>
                                     </value>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </statement>
                     <value name="CASECONDITION6">
                       <block type="text" id="]/fjBm9^+s_7)zw+K@N%">
                         <field name="TEXT">tip</field>
                       </block>
                     </value>
                     <statement name="CASE6">
                       <block type="variables_set" id="0(NRRn||Jhga5O0Z/+]x">
                         <field name="VAR" id="gR8!KbB2WoS`LbznPcxD">backgroundColor</field>
                         <value name="VALUE">
                           <block type="text" id="D!prIR6n7W_/JLg#|ySZ">
                             <field name="TEXT">lightblue</field>
                           </block>
                         </value>
                         <next>
                           <block type="variables_set" id="s)kfZ_pH^H{M_};{]?Fo">
                             <field name="VAR" id="Yri]Bw2G~pE4$}|.p]E9">icon</field>
                             <value name="VALUE">
                               <block type="text" id="5~~gkWdVvebt)bTG0UCB">
                                 <field name="TEXT">lightbulb-on-outline</field>
                               </block>
                             </value>
                             <next>
                               <block type="variables_set" id="JW/jesJ}01J;(OKG}J7i">
                                 <field name="VAR" id="Pc90O=5(V2G1t;v+b|![">iconColor</field>
                                 <value name="VALUE">
                                   <block type="text" id=",+#Njo4OxizYu!c+^ZSa">
                                     <field name="TEXT">yellow</field>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="variables_set" id="$;vQIRadDljdB`UO;lab">
                                     <field name="VAR" id="LXTn{bFJUx957Zg=bS,$">fontColor</field>
                                     <value name="VALUE">
                                       <block type="text" id="|Tq`t8:MEzk~5vLx?w~V">
                                         <field name="TEXT">black</field>
                                       </block>
                                     </value>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </statement>
                     <value name="CASECONDITION7">
                       <block type="text" id="$)J^*XP53J[;XBk_C33N">
                         <field name="TEXT">phone</field>
                       </block>
                     </value>
                     <statement name="CASE7">
                       <block type="variables_set" id="h?iRG$X!THDQ5/9uq8$e">
                         <field name="VAR" id="gR8!KbB2WoS`LbznPcxD">backgroundColor</field>
                         <value name="VALUE">
                           <block type="text" id="}Ho}H%Br)D,SemO6}F4.">
                             <field name="TEXT">lightblue</field>
                           </block>
                         </value>
                         <next>
                           <block type="variables_set" id="Ou)zkGEr|/cl_xE;qBbm">
                             <field name="VAR" id="Yri]Bw2G~pE4$}|.p]E9">icon</field>
                             <value name="VALUE">
                               <block type="text" id="72hO##x4rvcS}r]l3(JG">
                                 <field name="TEXT">phone</field>
                               </block>
                             </value>
                             <next>
                               <block type="variables_set" id=";4iUU7Mr%Vbqa7m[ZGNK">
                                 <field name="VAR" id="Pc90O=5(V2G1t;v+b|![">iconColor</field>
                                 <value name="VALUE">
                                   <block type="text" id="Rp@U_J4U*bHH[Q^SOKsM">
                                     <field name="TEXT">blue</field>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="variables_set" id=";I^DSOc1.4y#;}W?Q;i!">
                                     <field name="VAR" id="LXTn{bFJUx957Zg=bS,$">fontColor</field>
                                     <value name="VALUE">
                                       <block type="text" id="yQ=W#BCITc2N#b.2S3W?">
                                         <field name="TEXT">black</field>
                                       </block>
                                     </value>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </statement>
                     <value name="CASECONDITION8">
                       <block type="text" id="4+-OacwdDhAJc_E6(zh;">
                         <field name="TEXT">heating</field>
                       </block>
                     </value>
                     <statement name="CASE8">
                       <block type="variables_set" id="J:{;oZ+d=e90L^a4b|7M">
                         <field name="VAR" id="gR8!KbB2WoS`LbznPcxD">backgroundColor</field>
                         <value name="VALUE">
                           <block type="text" id="mjQ}`Qa|@GG2mz}T#?Y[">
                             <field name="TEXT">lightblue</field>
                           </block>
                         </value>
                         <next>
                           <block type="variables_set" id=")zlPW%XK@dsqEi4X?p2X">
                             <field name="VAR" id="Yri]Bw2G~pE4$}|.p]E9">icon</field>
                             <value name="VALUE">
                               <block type="text" id="115{Hv,+6JAtL(Yq5D4/">
                                 <field name="TEXT">radiator</field>
                               </block>
                             </value>
                             <next>
                               <block type="variables_set" id=",XR3LIS80~.^z*R^Q!oY">
                                 <field name="VAR" id="Pc90O=5(V2G1t;v+b|![">iconColor</field>
                                 <value name="VALUE">
                                   <block type="text" id="GO7K63uHt%@5qU$pHK0*">
                                     <field name="TEXT">darkred</field>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="variables_set" id="`oaSuUOtA0bd0^/1~Q[E">
                                     <field name="VAR" id="LXTn{bFJUx957Zg=bS,$">fontColor</field>
                                     <value name="VALUE">
                                       <block type="text" id="0tf5fn*,yB^q9u:3KJ$1">
                                         <field name="TEXT">black</field>
                                       </block>
                                     </value>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </statement>
                     <statement name="ONDEFAULT">
                       <block type="variables_set" id="NjLcO2/zPFbFiFv?|T[#">
                         <field name="VAR" id="gR8!KbB2WoS`LbznPcxD">backgroundColor</field>
                         <value name="VALUE">
                           <block type="text" id="$O!0[[-:JK9Xqt+8^il8">
                             <field name="TEXT">white</field>
                           </block>
                         </value>
                         <next>
                           <block type="variables_set" id="vFTp1oi_A`(Wp9DG1`;D">
                             <field name="VAR" id="Yri]Bw2G~pE4$}|.p]E9">icon</field>
                             <value name="VALUE">
                               <block type="text" id="c)W5isp1YHu1We-$`_y_">
                                 <field name="TEXT">adjust</field>
                               </block>
                             </value>
                             <next>
                               <block type="variables_set" id="r$3{nDZkb`.El0kJe@y_">
                                 <field name="VAR" id="Pc90O=5(V2G1t;v+b|![">iconColor</field>
                                 <value name="VALUE">
                                   <block type="text" id="u*@P7Yi=x]kZ]RRyA)08">
                                     <field name="TEXT">black</field>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="variables_set" id="FBnz{sR#C93O*pXs#nai">
                                     <field name="VAR" id="LXTn{bFJUx957Zg=bS,$">fontColor</field>
                                     <value name="VALUE">
                                       <block type="text" id="acU;E5`aknY[O2x6QVVN">
                                         <field name="TEXT">black</field>
                                       </block>
                                     </value>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </statement>
                     <next>
                       <block type="variables_set" id="pI0%OD;W3n!kqEyh*o`2">
                         <field name="VAR" id="bp;Mwj*?85R$!$1shIJ}">new</field>
                         <value name="VALUE">
                           <block type="text_join" id="yHOyqY{,=K$h:rNc{A-e" inline="false">
                             <mutation items="6"></mutation>
                             <value name="ADD0">
                               <block type="text_join" id="`]6sb9bzcznAr7!,Io?O" inline="true">
                                 <mutation items="3"></mutation>
                                 <value name="ADD0">
                                   <block type="text" id="-?S?@/gJpkGeY/L?zQ:H">
                                     <field name="TEXT">{"text": "</field>
                                   </block>
                                 </value>
                                 <value name="ADD1">
                                   <block type="variables_get" id="}lJ94CU$|2d^ZsPf*rCR">
                                     <field name="VAR" id="2VPfN%TG%bnR{BGYks5b">message</field>
                                   </block>
                                 </value>
                                 <value name="ADD2">
                                   <block type="text" id="lQpi8(_?(`*Nqfq~G4l)">
                                     <field name="TEXT">",</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                             <value name="ADD1">
                               <block type="text_join" id="/+%.W~j.ejAu}zp_/|fK" inline="true">
                                 <mutation items="3"></mutation>
                                 <value name="ADD0">
                                   <block type="text" id="(5GifDiRtr$Qi(2JM/xB">
                                     <field name="TEXT">"backgroundColor": "</field>
                                   </block>
                                 </value>
                                 <value name="ADD1">
                                   <block type="variables_get" id="8U681kDbT%S4[iMC?aR(">
                                     <field name="VAR" id="gR8!KbB2WoS`LbznPcxD">backgroundColor</field>
                                   </block>
                                 </value>
                                 <value name="ADD2">
                                   <block type="text" id="#A$t4_,qF1:e7O2l[6/}">
                                     <field name="TEXT">",</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                             <value name="ADD2">
                               <block type="text_join" id="LB8y0MHJcEY/Fn)s)4Y)" inline="true">
                                 <mutation items="1"></mutation>
                                 <value name="ADD0">
                                   <block type="text" id="Di*8c{eQ2XKG(lMc0tIU">
                                     <field name="TEXT">"borderColor": "black",</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                             <value name="ADD3">
                               <block type="text_join" id="?x|OhH2wFf28dVp8+9dr" inline="true">
                                 <mutation items="3"></mutation>
                                 <value name="ADD0">
                                   <block type="text" id="2hT9HG%-n_#w,Fz8NLg%">
                                     <field name="TEXT">"icon": "</field>
                                   </block>
                                 </value>
                                 <value name="ADD1">
                                   <block type="variables_get" id="*)=Za,)ed(8-g1O9LK/=">
                                     <field name="VAR" id="Yri]Bw2G~pE4$}|.p]E9">icon</field>
                                   </block>
                                 </value>
                                 <value name="ADD2">
                                   <block type="text" id=":pf33k8cGFvr,W@S^[O+">
                                     <field name="TEXT">",</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                             <value name="ADD4">
                               <block type="text_join" id="kN1AMNjaaVU3{`?!OyI_" inline="true">
                                 <mutation items="3"></mutation>
                                 <value name="ADD0">
                                   <block type="text" id="JOP~@t#zLS4Hmnq@zgzs">
                                     <field name="TEXT">"iconColor": "</field>
                                   </block>
                                 </value>
                                 <value name="ADD1">
                                   <block type="variables_get" id=")=e1)WT=6Q?HWjbrVsp3">
                                     <field name="VAR" id="Pc90O=5(V2G1t;v+b|![">iconColor</field>
                                   </block>
                                 </value>
                                 <value name="ADD2">
                                   <block type="text" id=")/cPCSq7auU92pf%P7qJ">
                                     <field name="TEXT">",</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                             <value name="ADD5">
                               <block type="text_join" id="qC|]`wQi9a5g|c`am2c#" inline="true">
                                 <mutation items="3"></mutation>
                                 <value name="ADD0">
                                   <block type="text" id="k{J`f86?;{Dn9lqBknwX">
                                     <field name="TEXT">"fontColor": "</field>
                                   </block>
                                 </value>
                                 <value name="ADD1">
                                   <block type="variables_get" id="7I5b*Vhegr`e~4_5iAHh">
                                     <field name="VAR" id="LXTn{bFJUx957Zg=bS,$">fontColor</field>
                                   </block>
                                 </value>
                                 <value name="ADD2">
                                   <block type="text" id="u;gG$8L8B09!KI};O#yp">
                                     <field name="TEXT">"}</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                           </block>
                         </value>
                         <next>
                           <block type="variables_set" id="?j17cfr:xr$IYlzd}JxA">
                             <field name="VAR" id="NiktQiA%r`TOz;Vi{Fku">list</field>
                             <value name="VALUE">
                               <block type="convert_json2object" id="OZ.Vg3BLY|K`7YG*H!Hz">
                                 <value name="VALUE">
                                   <block type="get_value" id="Eg`K3Vu9hj69Dd^MA)|r">
                                     <field name="ATTR">val</field>
                                     <field name="OID">0_userdata.0.Test.alerts</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                             <next>
                               <block type="lists_setIndex" id="i0p]uWn%Ax/|Q?jUj^hQ">
                                 <mutation at="false"></mutation>
                                 <field name="MODE">INSERT</field>
                                 <field name="WHERE">LAST</field>
                                 <value name="LIST">
                                   <block type="variables_get" id="USOKTf[tBdOgCP%iwlnD">
                                     <field name="VAR" id="NiktQiA%r`TOz;Vi{Fku">list</field>
                                   </block>
                                 </value>
                                 <value name="TO">
                                   <block type="convert_json2object" id="Ldo?PVrW])vQ%W?7v}ym">
                                     <value name="VALUE">
                                       <block type="variables_get" id="1mpajE,CPmnYh]Su~a[3">
                                         <field name="VAR" id="bp;Mwj*?85R$!$1shIJ}">new</field>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="control" id=",sZLd2(_hg1|JyY}.j1*">
                                     <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                     <field name="OID">0_userdata.0.Test.alerts</field>
                                     <field name="WITH_DELAY">FALSE</field>
                                     <value name="VALUE">
                                       <block type="convert_object2json" id="?;mg*I78wR8Wq3$*$ZK$">
                                         <field name="PRETTIFY">FALSE</field>
                                         <value name="VALUE">
                                           <block type="variables_get" id="Hsy^~Hv|6)VHtD.!{tMJ">
                                             <field name="VAR" id="NiktQiA%r`TOz;Vi{Fku">list</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <next>
                                       <block type="control" id="V/,:KzB98WQgbfD=_)(H">
                                         <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                         <field name="OID">0_userdata.0.Test.newAlert</field>
                                         <field name="WITH_DELAY">FALSE</field>
                                         <value name="VALUE">
                                           <block type="math_number" id="5G8vh%RX1P=NgxZt6P{1">
                                             <field name="NUM">0</field>
                                           </block>
                                         </value>
                                       </block>
                                     </next>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </next>
                   </block>
                 </next>
               </block>
             </statement>
           </block>
         </statement>
         <next>
           <block type="on_ext" id="dpOr5cW$BNzLZ#7`7qC8">
             <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="pSz%d1)8{rDtX|xY!*xT">
                 <field name="oid">0_userdata.0.Test.alerts</field>
               </shadow>
             </value>
             <statement name="STATEMENT">
               <block type="timeouts_settimeout" id=",XJpaFd=ZW_(StqZeZr(">
                 <field name="NAME">timeout</field>
                 <field name="DELAY">5000</field>
                 <field name="UNIT">ms</field>
                 <statement name="STATEMENT">
                   <block type="controls_if" id="Hta`ZS3}OFA:7L(]E{8O">
                     <value name="IF0">
                       <block type="logic_compare" id="o$H}^nMq@TO8I(ktfE(u">
                         <field name="OP">NEQ</field>
                         <value name="A">
                           <block type="on_source" id="KAiFCe4*@Qz^nhA}fL/q">
                             <field name="ATTR">state.val</field>
                           </block>
                         </value>
                         <value name="B">
                           <block type="text" id="Ba7PJpetRF{^c.LMl22O">
                             <field name="TEXT">[]</field>
                           </block>
                         </value>
                       </block>
                     </value>
                     <statement name="DO0">
                       <block type="variables_set" id="e~$tF;Rk^KcD,_pCu%I]">
                         <field name="VAR" id="6nQUI=e3;K|3rKnnkBI]">newList</field>
                         <value name="VALUE">
                           <block type="convert_json2object" id="t9FZmS$h=b=nB^GA.El5">
                             <value name="VALUE">
                               <block type="get_value" id="3DGdn08D06}=y[gj=Xn6">
                                 <field name="ATTR">val</field>
                                 <field name="OID">0_userdata.0.Test.alerts</field>
                               </block>
                             </value>
                           </block>
                         </value>
                         <next>
                           <block type="lists_getIndex" id="4;y:4jc*?G^RvhqQMsKF">
                             <mutation statement="true" at="true"></mutation>
                             <field name="MODE">REMOVE</field>
                             <field name="WHERE">FROM_START</field>
                             <value name="VALUE">
                               <block type="variables_get" id="oeL{JK;b~EG`2|~nAm[:">
                                 <field name="VAR" id="6nQUI=e3;K|3rKnnkBI]">newList</field>
                               </block>
                             </value>
                             <value name="AT">
                               <block type="math_number" id="^+0c7(jt3#c#+Wlb25bb">
                                 <field name="NUM">1</field>
                               </block>
                             </value>
                             <next>
                               <block type="control" id="qy,:ea4m%3wW-9YAL`nB">
                                 <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                 <field name="OID">0_userdata.0.Test.alerts</field>
                                 <field name="WITH_DELAY">FALSE</field>
                                 <value name="VALUE">
                                   <block type="convert_object2json" id="c#p2BWlikF?,HHAkXc^[">
                                     <field name="PRETTIFY">FALSE</field>
                                     <value name="VALUE">
                                       <block type="variables_get" id="xb?gu*%.=g}rE[5]AeMS">
                                         <field name="VAR" id="6nQUI=e3;K|3rKnnkBI]">newList</field>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </statement>
                     <next>
                       <block type="timeouts_cleartimeout" id=")YfppwB`YuCYEz#XrL9O">
                         <field name="NAME">timeout</field>
                       </block>
                     </next>
                   </block>
                 </statement>
               </block>
             </statement>
           </block>
         </next>
       </block>
      </xml>
      

      Ich hoffe, der ein oder andere kann es gebrauchen, ich baue es derzeit in immer mehr Funktionen ein um bessere Rückmeldungen zu bekommen...

      Wenn ihr es gebrauchen könnt, gebt gerne ein bischen Feedback

      S 1 Reply Last reply Reply Quote 1
      • S
        stockics6 @Supermicha last edited by

        @supermicha

        Hi,

        die Idee finde ich gut und ich könnte es auch sehr gut gebrauchen aber leider bekomme ich immer eine Fehlermeldung.
        Fehler.JPG


        9.9.2023, 06:58:45.218 [error]: javascript.0 (1547) script.js.1_0_Zentralsteuerung.Alerts.Alerts: TypeError: list.push is not a function
        9.9.2023, 06:58:45.218 [error]: javascript.0 (1547) at Object.<anonymous> (script.js.1_0_Zentralsteuerung.Alerts.Alerts:91:10)
        9.9.2023, 07:00:52.601 [error]: javascript.0 (1547) script.js.1_0_Zentralsteuerung.Alerts.Alerts: TypeError: list.push is not a function
        9.9.2023, 07:00:52.601 [error]: javascript.0 (1547) at Object.<anonymous> (script.js.1_0_Zentralsteuerung.Alerts.Alerts:91:10)

        Woran liegt das?

        SG

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

        Support us

        ioBroker
        Community Adapters
        Donate

        820
        Online

        31.9k
        Users

        80.1k
        Topics

        1.3m
        Posts

        2
        2
        242
        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