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] Alexa macht mich wahnsinnig

    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

    [gelöst] Alexa macht mich wahnsinnig

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

      Bei dieser Steuerung wird ein Datenpunkt Schrankbeleuchtung geschaltet.
      Doch wenn man per Sprachbefehl oder per false setzen des Datenpunktes wiederholt Alexa Schrankbeleuchtung wurde ausgeschaltet mehrfach. Auch wenn nach einer Stunde die Schrankbeleuchtung abgeschaltet wird wiederholt Alexa diesen Text mehrfach. kann man das irgendwie unterbinden!?

      var timeout;
      
      
      on({id: "Aqua_Control.0.System.Schrankbeleuchtung"/*Schrankbeleuchtung*/, change: "any"}, function (obj) {
        var value = obj.state.val;
        var oldValue = obj.oldState.val;
        if (getState("Aqua_Control.0.System.Schrankbeleuchtung").val == true) {
          setState("sonoff.0.Aqua_Control.POWER6"/*Schrankbeleuchtung*/, true);
          sendTo("telegram.0", "send", {
              text: 'Schrankbeleuchtung wurde eingeschaltet'
          });
          setState("alexa2.0.Echo-Devices.G090LV0371040175.Commands.speak"/*speak*/, 'Schrankbeleuchtung wurde eingeschaltet');
        } else if (getState("Aqua_Control.0.System.Schrankbeleuchtung").val == false) {
          sendTo("telegram.0", "send", {
              text: 'Schrankbeleuchtung wurde ausgeschaltet'
          });
          setState("alexa2.0.Echo-Devices.G090LV0371040175.Commands.speak"/*speak*/, 'Schrankbeleuchtung wurde ausgeschaltet');
          setState("sonoff.0.Aqua_Control.POWER6"/*Schrankbeleuchtung*/, false);
        }
        timeout = setTimeout(function () {
          if (getState("Aqua_Control.0.System.Schrankbeleuchtung").val == true) {
            setState("sonoff.0.Aqua_Control.POWER6"/*Schrankbeleuchtung*/, false);
            sendTo("telegram.0", "send", {
                text: (['Schrankbeleuchtung wurde automatisch','\n','nach einer Std. abgeschaltet'].join(''))
            });
            setState("alexa2.0.Echo-Devices.G090LV0371040175.Commands.speak"/*speak*/, 'Schrankbeleuchtung,, wurde automatisch nach einer Stunde,, abgeschaltet');
          }
          setState("Aqua_Control.0.System.Schrankbeleuchtung"/*Schrankbeleuchtung*/, false);
        }, 10000);
      });
      
      <xml xmlns="http://www.w3.org/1999/xhtml">
        <variables>
          <variable type="undefined" id="timeout">timeout</variable>
        </variables>
        <block type="on" id="|x6mTJ]+Zxl!,OM|q7ge" x="-1137" y="-737">
          <field name="OID">Aqua_Control.0.System.Schrankbeleuchtung</field>
          <field name="CONDITION">any</field>
          <field name="ACK_CONDITION"></field>
          <statement name="STATEMENT">
            <block type="controls_if" id=".sar{vm)A!.F_mB:$PUV">
              <mutation elseif="1"></mutation>
              <value name="IF0">
                <block type="logic_compare" id="KZeJAd_Qr.G`XLrG/LP4">
                  <field name="OP">EQ</field>
                  <value name="A">
                    <block type="get_value" id="qoy7*RBYxyg-G@tIIcfZ">
                      <field name="ATTR">val</field>
                      <field name="OID">Aqua_Control.0.System.Schrankbeleuchtung</field>
                    </block>
                  </value>
                  <value name="B">
                    <block type="logic_boolean" id="@RAeF7-EnMt5+=RB*l2d">
                      <field name="BOOL">TRUE</field>
                    </block>
                  </value>
                </block>
              </value>
              <statement name="DO0">
                <block type="control" id="9rx~f?2G?hyN@cR$Xd|+">
                  <mutation delay_input="false"></mutation>
                  <field name="OID">sonoff.0.Aqua_Control.POWER6</field>
                  <field name="WITH_DELAY">FALSE</field>
                  <value name="VALUE">
                    <block type="logic_boolean" id="QzjlRO2ET0=qr#L{YdV1">
                      <field name="BOOL">TRUE</field>
                    </block>
                  </value>
                  <next>
                    <block type="telegram" id=",minZy~WQGSfX]Ox.t8x">
                      <field name="INSTANCE">.0</field>
                      <field name="LOG"></field>
                      <field name="SILENT">FALSE</field>
                      <field name="PARSEMODE">default</field>
                      <value name="MESSAGE">
                        <shadow type="text" id="_yXhRzz?RS5oUE{%*+x,">
                          <field name="TEXT">text</field>
                        </shadow>
                        <block type="text" id="$4{hx[if)fniLcc8U^,Q">
                          <field name="TEXT">Schrankbeleuchtung wurde eingeschaltet</field>
                        </block>
                      </value>
                      <next>
                        <block type="control" id="@~artz5udshdJ[`H}kx:">
                          <mutation delay_input="false"></mutation>
                          <field name="OID">alexa2.0.Echo-Devices.G090LV0371040175.Commands.speak</field>
                          <field name="WITH_DELAY">FALSE</field>
                          <value name="VALUE">
                            <block type="text" id="jf#VVyaKb7B(wuYtSes|">
                              <field name="TEXT">Schrankbeleuchtung wurde eingeschaltet</field>
                            </block>
                          </value>
                        </block>
                      </next>
                    </block>
                  </next>
                </block>
              </statement>
              <value name="IF1">
                <block type="logic_compare" id="o$dPqr$eM*FIY[g-TM1o">
                  <field name="OP">EQ</field>
                  <value name="A">
                    <block type="get_value" id="W|8I5djf$aWr:Dlfwtgm">
                      <field name="ATTR">val</field>
                      <field name="OID">Aqua_Control.0.System.Schrankbeleuchtung</field>
                    </block>
                  </value>
                  <value name="B">
                    <block type="logic_boolean" id="pM,GT481RZIhU1MSW+1m">
                      <field name="BOOL">FALSE</field>
                    </block>
                  </value>
                </block>
              </value>
              <statement name="DO1">
                <block type="control" id="j.129-fxbQ6j#.DC`dpR">
                  <mutation delay_input="false"></mutation>
                  <field name="OID">sonoff.0.Aqua_Control.POWER6</field>
                  <field name="WITH_DELAY">FALSE</field>
                  <value name="VALUE">
                    <block type="logic_boolean" id="e_`Q{CoC)OBvQ?Ds9NM@">
                      <field name="BOOL">FALSE</field>
                    </block>
                  </value>
                  <next>
                    <block type="telegram" id="ZCC!W3z)$`0ilvT7OSWF">
                      <field name="INSTANCE">.0</field>
                      <field name="LOG"></field>
                      <field name="SILENT">FALSE</field>
                      <field name="PARSEMODE">default</field>
                      <value name="MESSAGE">
                        <shadow type="text" id="_yXhRzz?RS5oUE{%*+x,">
                          <field name="TEXT">text</field>
                        </shadow>
                        <block type="text" id="`(ib%L`)6$RdQdFmCYKj">
                          <field name="TEXT">Schrankbeleuchtung wurde ausgeschaltet</field>
                        </block>
                      </value>
                      <next>
                        <block type="control" id="~C3B0*l+.5P[~oV=HWNm">
                          <mutation delay_input="false"></mutation>
                          <field name="OID">alexa2.0.Echo-Devices.G090LV0371040175.Commands.speak</field>
                          <field name="WITH_DELAY">FALSE</field>
                          <value name="VALUE">
                            <block type="text" id="3{*cD[U+i5$(=gw*HY/e">
                              <field name="TEXT">Schrankbeleuchtung wurde ausgeschaltet</field>
                            </block>
                          </value>
                        </block>
                      </next>
                    </block>
                  </next>
                </block>
              </statement>
              <next>
                <block type="timeouts_settimeout" id="Zg`NJ2}B5mZJRLbjeM1d">
                  <field name="NAME">timeout</field>
                  <field name="DELAY">60</field>
                  <field name="UNIT">min</field>
                  <statement name="STATEMENT">
                    <block type="controls_if" id="HW0f^PKW]urhf2:#L7@M">
                      <value name="IF0">
                        <block type="logic_compare" id="8k;Fvr0nedOY=mM;3L$9">
                          <field name="OP">EQ</field>
                          <value name="A">
                            <block type="get_value" id="D=Zl9)/k(1CkDFCCRZK;">
                              <field name="ATTR">val</field>
                              <field name="OID">Aqua_Control.0.System.Schrankbeleuchtung</field>
                            </block>
                          </value>
                          <value name="B">
                            <block type="logic_boolean" id="q0%]SWa3Nf.P?=1cAxUC">
                              <field name="BOOL">TRUE</field>
                            </block>
                          </value>
                        </block>
                      </value>
                      <statement name="DO0">
                        <block type="control" id="3al:Y^bQ7r9J7(7WN{oL">
                          <mutation delay_input="false"></mutation>
                          <field name="OID">sonoff.0.Aqua_Control.POWER6</field>
                          <field name="WITH_DELAY">FALSE</field>
                          <value name="VALUE">
                            <block type="logic_boolean" id="bMMeWs8*L,NAcf:)saj*">
                              <field name="BOOL">FALSE</field>
                            </block>
                          </value>
                          <next>
                            <block type="telegram" id="fD@]FODhh!C]Q^Cm1K@:">
                              <field name="INSTANCE">.0</field>
                              <field name="LOG"></field>
                              <field name="SILENT">FALSE</field>
                              <field name="PARSEMODE">default</field>
                              <value name="MESSAGE">
                                <shadow type="text" id="_yXhRzz?RS5oUE{%*+x,">
                                  <field name="TEXT">text</field>
                                </shadow>
                                <block type="text_join" id="QnQWlkWA@@Q1-s|d9.k`">
                                  <mutation items="3"></mutation>
                                  <value name="ADD0">
                                    <block type="text" id="KDLJ,Okx2%A+tBPaY?hf">
                                      <field name="TEXT">Schrankbeleuchtung wurde automatisch</field>
                                    </block>
                                  </value>
                                  <value name="ADD1">
                                    <block type="text_newline" id="0#F*+H0Pb#K!8;?HzR:]">
                                      <field name="Type">\n</field>
                                    </block>
                                  </value>
                                  <value name="ADD2">
                                    <block type="text" id="*=%-9jk_8Tk!uau)!16k">
                                      <field name="TEXT">nach einer Std. abgeschaltet</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <next>
                                <block type="control" id="W7thFpaoh[RX]9;umyun">
                                  <mutation delay_input="false"></mutation>
                                  <field name="OID">alexa2.0.Echo-Devices.G090LV0371040175.Commands.speak</field>
                                  <field name="WITH_DELAY">FALSE</field>
                                  <value name="VALUE">
                                    <block type="text" id="POdc`6BY0;?g,j(Td0.,">
                                      <field name="TEXT">Schrankbeleuchtung,, wurde automatisch nach einer Stunde,, abgeschaltet</field>
                                    </block>
                                  </value>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </statement>
                      <next>
                        <block type="control" id="[TWTAOS.96fLXosgsnWb">
                          <mutation delay_input="false"></mutation>
                          <field name="OID">Aqua_Control.0.System.Schrankbeleuchtung</field>
                          <field name="WITH_DELAY">FALSE</field>
                          <value name="VALUE">
                            <block type="logic_boolean" id="jz9wrE3.u6H4Qg`cpe1M">
                              <field name="BOOL">FALSE</field>
                            </block>
                          </value>
                        </block>
                      </next>
                    </block>
                  </statement>
                </block>
              </next>
            </block>
          </statement>
        </block>
      </xml>
      

      Bevorzugt als Blockly Script--- Danke

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

        @Aphofis
        Ändere mal den Trigger auf "wurde geändert". Wenn das nicht genügt, suche im Forum nach "entprellen".

        1 Reply Last reply Reply Quote 1
        • paul53
          paul53 @Aphofis last edited by paul53

          @Aphofis
          Versuche es mal hiermit.

          <xml xmlns="http://www.w3.org/1999/xhtml">
           <variables>
             <variable type="undefined" id="entprell">entprell</variable>
             <variable type="" id="OPw*XOin87RNH/Pj{~.8">text</variable>
             <variable type="undefined" id="timeout">timeout</variable>
           </variables>
           <block type="on" id="|x6mTJ]+Zxl!,OM|q7ge" x="-1137" y="-737">
             <field name="OID">Aqua_Control.0.System.Schrankbeleuchtung</field>
             <field name="CONDITION">ne</field>
             <field name="ACK_CONDITION"></field>
             <statement name="STATEMENT">
               <block type="controls_if" id="AR-GaAr2~#?{985Pqvj#">
                 <value name="IF0">
                   <block type="logic_negate" id="l.A}rS:LH]2YS;C4W3Ex">
                     <value name="BOOL">
                       <block type="variables_get" id="WJjML|%rzv0`YGu|bof0">
                         <field name="VAR" id="entprell" variabletype="undefined">entprell</field>
                       </block>
                     </value>
                   </block>
                 </value>
                 <statement name="DO0">
                   <block type="timeouts_settimeout" id="wm@#LT/h:qQP`M5O[yOH">
                     <field name="NAME">entprell</field>
                     <field name="DELAY">2</field>
                     <field name="UNIT">sec</field>
                     <statement name="STATEMENT">
                       <block type="variables_set" id="?q14f1Jehr#W@tr7/%=O">
                         <field name="VAR" id="entprell" variabletype="undefined">entprell</field>
                         <value name="VALUE">
                           <block type="logic_null" id="froqso,%gZZoVUi$G6b?"></block>
                         </value>
                       </block>
                     </statement>
                     <next>
                       <block type="control" id="j.129-fxbQ6j#.DC`dpR">
                         <mutation delay_input="false"></mutation>
                         <field name="OID">sonoff.0.Aqua_Control.POWER6</field>
                         <field name="WITH_DELAY">FALSE</field>
                         <value name="VALUE">
                           <block type="on_source" id="T,[[rmKa;!Iv$)!W@v.?">
                             <field name="ATTR">state.val</field>
                           </block>
                         </value>
                         <next>
                           <block type="controls_if" id=".sar{vm)A!.F_mB:$PUV">
                             <mutation else="1"></mutation>
                             <value name="IF0">
                               <block type="on_source" id="1P!e](^r5mJtd-v+m$vY">
                                 <field name="ATTR">state.val</field>
                               </block>
                             </value>
                             <statement name="DO0">
                               <block type="variables_set" id="4ot5W:BZx=K;S:M@2/k)">
                                 <field name="VAR" id="OPw*XOin87RNH/Pj{~.8" variabletype="">text</field>
                                 <value name="VALUE">
                                   <block type="text" id="$4{hx[if)fniLcc8U^,Q">
                                     <field name="TEXT">Schrankbeleuchtung wurde eingeschaltet</field>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="timeouts_settimeout" id="Zg`NJ2}B5mZJRLbjeM1d">
                                     <field name="NAME">timeout</field>
                                     <field name="DELAY">60</field>
                                     <field name="UNIT">min</field>
                                     <statement name="STATEMENT">
                                       <block type="control" id="[TWTAOS.96fLXosgsnWb">
                                         <mutation delay_input="false"></mutation>
                                         <field name="OID">Aqua_Control.0.System.Schrankbeleuchtung</field>
                                         <field name="WITH_DELAY">FALSE</field>
                                         <value name="VALUE">
                                           <block type="logic_boolean" id="jz9wrE3.u6H4Qg`cpe1M">
                                             <field name="BOOL">FALSE</field>
                                           </block>
                                         </value>
                                         <next>
                                           <block type="variables_set" id="eHP4zQUc^A(fuwet$Z?,">
                                             <field name="VAR" id="OPw*XOin87RNH/Pj{~.8" variabletype="">text</field>
                                             <value name="VALUE">
                                               <block type="text_join" id="QnQWlkWA@@Q1-s|d9.k`">
                                                 <mutation items="3"></mutation>
                                                 <value name="ADD0">
                                                   <block type="text" id="KDLJ,Okx2%A+tBPaY?hf">
                                                     <field name="TEXT">Schrankbeleuchtung wurde automatisch</field>
                                                   </block>
                                                 </value>
                                                 <value name="ADD1">
                                                   <block type="text_newline" id="0#F*+H0Pb#K!8;?HzR:]">
                                                     <field name="Type">\n</field>
                                                   </block>
                                                 </value>
                                                 <value name="ADD2">
                                                   <block type="text" id="*=%-9jk_8Tk!uau)!16k">
                                                     <field name="TEXT">nach einer Std. abgeschaltet</field>
                                                   </block>
                                                 </value>
                                               </block>
                                             </value>
                                           </block>
                                         </next>
                                       </block>
                                     </statement>
                                   </block>
                                 </next>
                               </block>
                             </statement>
                             <statement name="ELSE">
                               <block type="timeouts_cleartimeout" id="JBs#NzKVIGSpmR:ZaTa+">
                                 <field name="NAME">timeout</field>
                                 <next>
                                   <block type="controls_if" id="rjIx!:uZkh}a)@ATc^s*">
                                     <value name="IF0">
                                       <block type="logic_compare" id="F1y-DXH?,-o,km%n3F|)">
                                         <field name="OP">LT</field>
                                         <value name="A">
                                           <block type="text_length" id="gi1/Hvm]h*I*U4%Dn^l_">
                                             <value name="VALUE">
                                               <shadow type="text" id="-tqN4gO#ttweza5[CFkB">
                                                 <field name="TEXT">abc</field>
                                               </shadow>
                                               <block type="variables_get" id="PLL44*m:%^Z|$NN:DbU@">
                                                 <field name="VAR" id="OPw*XOin87RNH/Pj{~.8" variabletype="">text</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                         <value name="B">
                                           <block type="math_number" id="7NE.Xw+05U(YfCk@GG8!">
                                             <field name="NUM">50</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <statement name="DO0">
                                       <block type="variables_set" id="vO3xDN=59#0#;3cd$GE!">
                                         <field name="VAR" id="OPw*XOin87RNH/Pj{~.8" variabletype="">text</field>
                                         <value name="VALUE">
                                           <block type="text" id="`(ib%L`)6$RdQdFmCYKj">
                                             <field name="TEXT">Schrankbeleuchtung wurde ausgeschaltet</field>
                                           </block>
                                         </value>
                                       </block>
                                     </statement>
                                   </block>
                                 </next>
                               </block>
                             </statement>
                             <next>
                               <block type="telegram" id=",minZy~WQGSfX]Ox.t8x">
                                 <field name="INSTANCE">.0</field>
                                 <field name="LOG"></field>
                                 <field name="SILENT">FALSE</field>
                                 <field name="PARSEMODE">default</field>
                                 <value name="MESSAGE">
                                   <shadow type="text" id="_yXhRzz?RS5oUE{%*+x,">
                                     <field name="TEXT">text</field>
                                   </shadow>
                                   <block type="variables_get" id="`f4lQe/}klj%+NZQY{*7">
                                     <field name="VAR" id="OPw*XOin87RNH/Pj{~.8" variabletype="">text</field>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="control" id="@~artz5udshdJ[`H}kx:">
                                     <mutation delay_input="false"></mutation>
                                     <field name="OID">alexa2.0.Echo-Devices.G090LV0371040175.Commands.speak</field>
                                     <field name="WITH_DELAY">FALSE</field>
                                     <value name="VALUE">
                                       <block type="variables_get" id="=~/C5scq/Z*-22zo9xaX">
                                         <field name="VAR" id="OPw*XOin87RNH/Pj{~.8" variabletype="">text</field>
                                       </block>
                                     </value>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </next>
                   </block>
                 </statement>
               </block>
             </statement>
           </block>
          </xml>
          

          Blockly_temp.JPG

          Aphofis 1 Reply Last reply Reply Quote 1
          • Aphofis
            Aphofis @paul53 last edited by Aphofis

            @paul53
            gibt einen fehler in zeile 20 ziffer 16
            muss was mit der Text länge zu tun haben.

            var entpreller, entpreller, text, timeout;
            
            
            on({id: "Aqua_Control.0.System.Schrankbeleuchtung"/*Schrankbeleuchtung*/, change: "ne"}, function (obj) {
              var value = obj.state.val;
              var oldValue = obj.oldState.val;
              if (!entpreller) {
                entpreller = setTimeout(function () {
                  entpreller = null;
                }, 2000);
                setState("sonoff.0.Aqua_Control.POWER6"/*Schrankbeleuchtung*/, (obj.state ? obj.state.val : ""));
                if ((obj.state ? obj.state.val : "")) {
                  text = 'Schrankbeleuchtung wurde eingeschaltet';
                  timeout = setTimeout(function () {
                    setState("sonoff.0.Aqua_Control.POWER6"/*Schrankbeleuchtung*/, false);
                    text = ['Schrankbeleuchtung wurde automatisch','\n','nach einer Std. abgeschaltet'].join('');
                  }, 3600000);
                } else {
                  (function () {if (timeout) {clearTimeout(timeout); timeout = null;}})();
                  if (text.length < 50) {
                    text = 'Schrankbeleuchtung wurde ausgeschaltet';
                  }
                }
                sendTo("telegram.0", "send", {
                    text: text
                });
                setState("alexa2.0.Echo-Devices.G090LV0371040175.Commands.speak"/*speak*/, text);
              }
            });
            

            Datenpunkt wird nach ablauf der 60 min nicht abgeschaltet, da der Datenpunkt noch auf true steht.

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

              @Aphofis sagte:

              gibt einen fehler in zeile 20 ziffer 16

              Kann ich nicht nachvollziehen: Im Log ?

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

                @paul53
                Im Log steht bei mir nix!
                Datenpunkt wird nicht geschaltet nach ablauf des timeouts ich vermute weil auf true steht.
                Nur setze ich steuere Datenpunkt mit false geht die beleuchtung ja aus.
                Das ja blödsinn

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

                  @Aphofis sagte:

                  Nur setze ich steuere Datenpunkt mit false geht die beleuchtung ja aus.

                  Geht der Triggerdatenpunkt auf false, dann geht sie sofort aus. Bleibt der Trigger-Datenpunkt auf true, wird dieser Datenpunkt nach einer Stunde auf false gesetzt, was wiederum zum Triggern und Auschalten führen soll.

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

                    @paul53
                    OK klappt habe den Timeout auf 20 sek gestellt und Schrank geht nach 20 sek aus nur die Meldung per Alexa bleibt aus
                    Nach dem Ablauf bleibt der Datenpunkt auf true

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

                      @Aphofis sagte:

                      Nach dem Ablauf bleibt der Datenpunkt auf true

                      ?? Welcher ?

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

                        @Aphofis sagte:

                        nur die Meldung per Alexa bleibt aus

                        Verträgt Alexa den Zeilenumbruch (\n) nicht ?

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

                          @Aphofis
                          Zeile 1: 2 mal Variable entpreller ! Ist im Original nicht enthalten:

                          var entprell, text, timeout;
                          
                          
                          on({id: "Aqua_Control.0.System.Schrankbeleuchtung", change: "ne"}, function (obj) {
                            var value = obj.state.val;
                            var oldValue = obj.oldState.val;
                            if (!entprell) {
                              entprell = setTimeout(function () {
                                entprell = null;
                              }, 2000);
                              setState("sonoff.0.Aqua_Control.POWER6", (obj.state ? obj.state.val : ""));
                              if ((obj.state ? obj.state.val : "")) {
                                text = 'Schrankbeleuchtung wurde eingeschaltet';
                                timeout = setTimeout(function () {
                                  setState("Aqua_Control.0.System.Schrankbeleuchtung", false);
                                  text = ['Schrankbeleuchtung wurde automatisch','\n','nach einer Std. abgeschaltet'].join('');
                                }, 3600000);
                              } else {
                                (function () {if (timeout) {clearTimeout(timeout); timeout = null;}})();
                                if (text.length < 50) {
                                  text = 'Schrankbeleuchtung wurde ausgeschaltet';
                                }
                              }
                              sendTo("telegram.0", "send", {
                                  text: text
                              });
                              setState("alexa2.0.Echo-Devices.G090LV0371040175.Commands.speak", text);
                            }
                          });
                          
                          1 Reply Last reply Reply Quote 0
                          • Aphofis
                            Aphofis @paul53 last edited by

                            @paul53
                            Nach dem eigentlichen 60 min Timeout wird keine Alexa meldung ausgegeben. Ist aber auch nicht so wild.

                            1 Reply Last reply Reply Quote 0
                            • Aphofis
                              Aphofis last edited by Aphofis

                              @paul53
                              es waren schon wieder zwei variablen in der steuerung.
                              Habe jetzt eine gelöscht.
                              Mal sehen ob alexa nun die richtigen zustände ansagt.
                              wenn man den Datenpunkt Schrankbeleuchtung schaltet, sagt Alexa Schrankbeleuchtung automatisch nach einer Std abgeschaltet.
                              Wenn man den Datenpunkt auf false setzt geht die schrankbeleuchtung aus und Alexa sagt schrankbeleuchtung eingeschaltet.
                              Ist schon etwas komisch
                              Nachtrag:
                              Fehler gefunden: länge von Text fehlte.
                              Doch nach ablauf der 60 min sagt Alexa immer noch nix.

                              Fehler 20:16 besteht nach wie vor:
                              Bildschirmfoto 2019-09-14 um 14.02.47.png

                              var entpreller, text, timeout;
                              
                              
                              on({id: "Aqua_Control.0.System.Schrankbeleuchtung"/*Schrankbeleuchtung*/, change: "ne"}, function (obj) {
                                var value = obj.state.val;
                                var oldValue = obj.oldState.val;
                                if (!entpreller) {
                                  entpreller = setTimeout(function () {
                                    entpreller = null;
                                  }, 2000);
                                  setState("sonoff.0.Aqua_Control.POWER6"/*Schrankbeleuchtung*/, (obj.state ? obj.state.val : ""));
                                  if ((obj.state ? obj.state.val : "")) {
                                    text = 'Schrankbeleuchtung wurde eingeschaltet';
                                    timeout = setTimeout(function () {
                                      setState("sonoff.0.Aqua_Control.POWER6"/*Schrankbeleuchtung*/, false);
                                      text = 'Schrankbeleuchtung wurde automatisch' + 'nach einer Std. abgeschaltet ';
                                    }, 15000);
                                  } else {
                                    (function () {if (timeout) {clearTimeout(timeout); timeout = null;}})();
                                    if (text.length < 50) {
                                      setState("sonoff.0.Aqua_Control.POWER6"/*Schrankbeleuchtung*/, false);
                                      text = 'Schrankbeleuchtung wurde ausgeschaltet';
                                    }
                                  }
                                  sendTo("telegram.0", "send", {
                                      text: text
                                  });
                                  setState("alexa2.0.Echo-Devices.G090LV0371040175.Commands.speak"/*speak*/, text);
                                }
                              });
                              
                              paul53 1 Reply Last reply Reply Quote 0
                              • paul53
                                paul53 @Aphofis last edited by

                                @Aphofis sagte i:

                                Fehler 20:16 besteht nach wie vor:

                                Initialisiere mal die Variable text vor dem Trigger mit "Schrankbeleuchtung wurde ausgeschaltet".

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

                                  @paul53
                                  initialisiere???

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

                                    @Aphofis sagte:

                                    initialisiere???

                                    Oberhalb des Triggers: setze text auf "Schrankbeleuchtung wurde ausgeschaltet"

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

                                      @paul53
                                      eingeschaltet und ausgeschaltet klappt aber nach ablauf der zeit wenn die beleuchtung ausgeht,
                                      sagt alexa nix

                                      paul53 1 Reply Last reply Reply Quote 0
                                      • Aphofis
                                        Aphofis last edited by

                                        var text, entpreller, timeout;
                                        
                                        
                                        text = 'Schrankbeleuchtung wurde ausgeschaltet';
                                        on({id: "Aqua_Control.0.System.Schrankbeleuchtung"/*Schrankbeleuchtung*/, change: "ne"}, function (obj) {
                                          var value = obj.state.val;
                                          var oldValue = obj.oldState.val;
                                          if (!entpreller) {
                                            entpreller = setTimeout(function () {
                                              entpreller = null;
                                            }, 2000);
                                            setState("sonoff.0.Aqua_Control.POWER6"/*Schrankbeleuchtung*/, (obj.state ? obj.state.val : ""));
                                            if ((obj.state ? obj.state.val : "")) {
                                              text = 'Schrankbeleuchtung wurde eingeschaltet';
                                              timeout = setTimeout(function () {
                                                setState("sonoff.0.Aqua_Control.POWER6"/*Schrankbeleuchtung*/, false);
                                                text = 'Schrankbeleuchtung wurde automatisch' + 'nach einer Std. abgeschaltet ';
                                              }, 15000);
                                            } else {
                                              (function () {if (timeout) {clearTimeout(timeout); timeout = null;}})();
                                              if (text.length < 50) {
                                                setState("sonoff.0.Aqua_Control.POWER6"/*Schrankbeleuchtung*/, false);
                                                text = 'Schrankbeleuchtung wurde ausgeschaltet';
                                              }
                                            }
                                            sendTo("telegram.0", "send", {
                                                text: text
                                            });
                                            setState("alexa2.0.Echo-Devices.G090LV0371040175.Commands.speak"/*speak*/, text);
                                          }
                                        });
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • paul53
                                          paul53 @Aphofis last edited by paul53

                                          @Aphofis sagte:

                                          sagt alexa nix

                                          Du schaltest nach einer Stunde den falschen Datenpunkt auf false: Es muss der Triggerdatenpunkt sein !

                                          1568187945608-blockly_temp.jpg

                                          Aphofis 2 Replies Last reply Reply Quote 1
                                          • Aphofis
                                            Aphofis @paul53 last edited by Aphofis

                                            @paul53
                                            Ja bis auf nach einer std automatisch
                                            Das schmeisst telegram auch einfach mal so raus das automatisch nach einer std abgeschaltet wurde obwohl ich nur den Datenpunkt auf false gesetzt hatte.

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            775
                                            Online

                                            31.9k
                                            Users

                                            80.3k
                                            Topics

                                            1.3m
                                            Posts

                                            2
                                            22
                                            919
                                            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