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]Türenabfrage Hilfe

    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]Türenabfrage Hilfe

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

      @kuessel25 sagte: wenn das licht vorher schon an war möchte ich auch das sich das licht nicht durch das blockly ausschaltet wenn die türe geschlossen wird.

      Bild_2021-01-24_155732.png

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

        @paul53
        so habs mal nachgebaut aber irgenwie klappts noch nicht ganz,kannst du bitte nochmal drüber schauen wo ich einen Fehler eingebaut habe

        licht ist aus balkontür wird geöffnet = licht geht an (klappt) 👍

        balkontür wird geschlossen = licht geht leider nicht aus ,hier sollte es ausgehen 👎

        licht ist an balkontüre wird geöffnet und geschlossen = keine lichtsteuerung(so wie gewünscht)👍

        <xml xmlns="https://developers.google.com/blockly/xml">
          <variables>
            <variable id="Jgx}Uo]|)`]qL]]Vs.M3">manuell_ein</variable>
            <variable id="ab}EYSQ+h$QV@^IsPFg$">urspung</variable>
          </variables>
          <block type="comment" id="#RhA$;TwFmjX_6S+m5P2" x="362" y="188">
            <field name="COMMENT">Balkontür</field>
            <next>
              <block type="on_ext" id="=XrcLs#9F|dOr(~yJ)ZQ">
                <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="N{6a=8^g8lb^;;$k+UdG">
                    <field name="oid">zigbee.0.00158d0003d08254.opened</field>
                  </shadow>
                </value>
                <statement name="STATEMENT">
                  <block type="controls_if" id="uUb*rPJ@7HKh}ePQ3+xD">
                    <value name="IF0">
                      <block type="logic_negate" id="zyl4Zcnu_xbM[v@Zd5RM">
                        <value name="BOOL">
                          <block type="variables_get" id="BW0,yyG3`QdHS[L4wlqX">
                            <field name="VAR" id="Jgx}Uo]|)`]qL]]Vs.M3">manuell_ein</field>
                          </block>
                        </value>
                      </block>
                    </value>
                    <statement name="DO0">
                      <block type="control" id="p,,XTU`6Jdn+y:`k#dt1">
                        <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                        <field name="OID">sonoff.0.Küche Licht.POWER</field>
                        <field name="WITH_DELAY">FALSE</field>
                        <value name="VALUE">
                          <block type="on_source" id="Tf6L/nv9R/H)ZTt=9V$e">
                            <field name="ATTR">state.val</field>
                          </block>
                        </value>
                      </block>
                    </statement>
                  </block>
                </statement>
                <next>
                  <block type="comment" id="x?AK=5B8AdQ},}Mxukdr">
                    <field name="COMMENT">licht</field>
                    <next>
                      <block type="on_ext" id="@r$eP`sbs0{,PL!|m;5D">
                        <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="qT1RXo6F*|^$jtr^Yv6U">
                            <field name="oid">sonoff.0.Küche Licht.POWER</field>
                          </shadow>
                        </value>
                        <statement name="STATEMENT">
                          <block type="variables_set" id="!]8t5(L*PiH)r+(Bj-#z">
                            <field name="VAR" id="Jgx}Uo]|)`]qL]]Vs.M3">manuell_ein</field>
                            <value name="VALUE">
                              <block type="logic_operation" id="rLOKk==CX,Tg.n5wKQ{2" inline="false">
                                <field name="OP">AND</field>
                                <value name="A">
                                  <block type="on_source" id=":A14~8y%)G)E?n{_^m+$">
                                    <field name="ATTR">state.val</field>
                                  </block>
                                </value>
                                <value name="B">
                                  <block type="logic_compare" id="vQwA^K*~+n4JQ-AvIi4f">
                                    <field name="OP">NEQ</field>
                                    <value name="A">
                                      <block type="variables_get" id="9/AXWZ{q.V1|l*YkAwQW">
                                        <field name="VAR" id="ab}EYSQ+h$QV@^IsPFg$">urspung</field>
                                      </block>
                                    </value>
                                    <value name="B">
                                      <block type="text" id="1PB*GEO1qU=wc3x[2y@!">
                                        <field name="TEXT">javascript.0.scriptEnabled.verbrauchsmessung+kosten.licht_tür_test</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                              </block>
                            </value>
                          </block>
                        </statement>
                      </block>
                    </next>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </xml>
        
        
        
        paul53 1 Reply Last reply Reply Quote 0
        • paul53
          paul53 @kuessel25 last edited by

          @kuessel25 sagte so habs mal nachgebaut aber irgenwie klappts noch nicht

          Nicht wirklich im letzten Block.

          <xml xmlns="https://developers.google.com/blockly/xml">
           <variables>
             <variable id="Jgx}Uo]|)`]qL]]Vs.M3">manuell_ein</variable>
           </variables>
           <block type="comment" id="#RhA$;TwFmjX_6S+m5P2" x="362" y="188">
             <field name="COMMENT">Balkontür</field>
             <next>
               <block type="on_ext" id="=XrcLs#9F|dOr(~yJ)ZQ">
                 <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="N{6a=8^g8lb^;;$k+UdG">
                     <field name="oid">zigbee.0.00158d0003d08254.opened</field>
                   </shadow>
                 </value>
                 <statement name="STATEMENT">
                   <block type="controls_if" id="uUb*rPJ@7HKh}ePQ3+xD">
                     <value name="IF0">
                       <block type="logic_negate" id="zyl4Zcnu_xbM[v@Zd5RM">
                         <value name="BOOL">
                           <block type="variables_get" id="BW0,yyG3`QdHS[L4wlqX">
                             <field name="VAR" id="Jgx}Uo]|)`]qL]]Vs.M3">manuell_ein</field>
                           </block>
                         </value>
                       </block>
                     </value>
                     <statement name="DO0">
                       <block type="control" id="p,,XTU`6Jdn+y:`k#dt1">
                         <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                         <field name="OID">sonoff.0.Küche Licht.POWER</field>
                         <field name="WITH_DELAY">FALSE</field>
                         <value name="VALUE">
                           <block type="on_source" id="Tf6L/nv9R/H)ZTt=9V$e">
                             <field name="ATTR">state.val</field>
                           </block>
                         </value>
                       </block>
                     </statement>
                   </block>
                 </statement>
                 <next>
                   <block type="comment" id="x?AK=5B8AdQ},}Mxukdr">
                     <field name="COMMENT">licht</field>
                     <next>
                       <block type="on_ext" id="@r$eP`sbs0{,PL!|m;5D">
                         <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="qT1RXo6F*|^$jtr^Yv6U">
                             <field name="oid">sonoff.0.Küche Licht.POWER</field>
                           </shadow>
                         </value>
                         <statement name="STATEMENT">
                           <block type="variables_set" id="!]8t5(L*PiH)r+(Bj-#z">
                             <field name="VAR" id="Jgx}Uo]|)`]qL]]Vs.M3">manuell_ein</field>
                             <value name="VALUE">
                               <block type="logic_operation" id="rLOKk==CX,Tg.n5wKQ{2" inline="false">
                                 <field name="OP">AND</field>
                                 <value name="A">
                                   <block type="on_source" id=":A14~8y%)G)E?n{_^m+$">
                                     <field name="ATTR">state.val</field>
                                   </block>
                                 </value>
                                 <value name="B">
                                   <block type="logic_compare" id="vQwA^K*~+n4JQ-AvIi4f">
                                     <field name="OP">NEQ</field>
                                     <value name="A">
                                       <block type="on_source" id="?`Ai_Zrwsb||L=WLn,.9">
                                         <field name="ATTR">state.from</field>
                                       </block>
                                     </value>
                                     <value name="B">
                                       <block type="text" id="1PB*GEO1qU=wc3x[2y@!">
                                         <field name="TEXT">system.adapter.javascript.0</field>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                               </block>
                             </value>
                           </block>
                         </statement>
                       </block>
                     </next>
                   </block>
                 </next>
               </block>
             </next>
           </block>
          </xml>
          

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

            @paul53 said in Türenabfrage Hilfe:

            <xml xmlns="https://developers.google.com/blockly/xml">

            leider keine änderung😢

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

              @paul53
              mit dem script funktioniert es noch nicht ganz.
              nach dem script läuft es so

              (licht ist vorher aus)
              öffne ich die Tür = Licht geht an(richtig) 👍
              schließe ich die Tür = Licht bleibt an(falsch sollte ausgehen) 👎

              (licht war vorher an)
              öffne ich die Tür = Licht bleibt an (richtig) 👍
              schließe ich die Tür = licht bleibt an (richtig) 👍

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

                @kuessel25 sagte: schließe ich die Tür = Licht bleibt an(falsch sollte ausgehen)

                Dann muss manuell_ein auf true sein, was nicht sein sollte. Bei anderen Nutzern funktioniert es so. Bau mal im unteren Trigger einen Debug-Block ein, der den Wert und Ursprung ausgibt.

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

                  @paul53
                  Hallo Paul,hab ein wenig gedult mit mir 😊
                  du müsstet mir das genauer erklären mit Debug-Block
                  hab es jetzt mal so versucht

                  Unbenannt1.PNG

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

                    @kuessel25 sagte: hab es jetzt mal so versucht

                    Ja, in etwa. Besser:

                    Bild_2021-01-25_111101.png

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

                      @paul53
                      beim öffnen der tür (licht war aus) :

                      javascript.0 2021-01-25 11:17:22.719 info (3715) script.js.verbrauchsmessung+kosten.licht_tür_test: Licht:trueUrsprung:system.adapter.javascript.0
                      javascript.0 2021-01-25 11:17:22.705 info (3715) script.js.verbrauchsmessung+kosten.licht_tür_test: Tür:true

                      beim schliessen der tür (licht war angegangen) :

                      javascript.0 2021-01-25 11:18:32.842 info (3715) script.js.verbrauchsmessung+kosten.licht_tür_test: Tür:false

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

                        @kuessel25 sagte: Ursprung:system.adapter.javascript.0

                        Log-Ausgaben bitte in Code tags posten. Erweitere mal den oberen Debug.

                        Bild_2021-01-25_114036.png

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

                          @paul53

                          
                          25.1.2021, 11:42:04.088	[info ]: javascript.0 (3715) Stop script script.js.verbrauchsmessung+kosten.licht_tür_test
                          25.1.2021, 11:42:04.097	[info ]: javascript.0 (3715) Start javascript script.js.verbrauchsmessung+kosten.licht_tür_test
                          25.1.2021, 11:42:04.108	[info ]: javascript.0 (3715) script.js.verbrauchsmessung+kosten.licht_tür_test: registered 3 subscriptions and 0 schedules
                          25.1.2021, 11:42:12.247	[info ]: javascript.0 (3715) script.js.verbrauchsmessung+kosten.licht_tür_test: Tür:trueManuell:
                          25.1.2021, 11:42:12.252	[info ]: javascript.0 (3715) script.js.verbrauchsmessung+kosten.licht_tür_test: Licht:trueUrsprung:system.adapter.javascript.0
                          25.1.2021, 11:42:20.792	[info ]: javascript.0 (3715) script.js.verbrauchsmessung+kosten.licht_tür_test: Tür:falseManuell:true
                          
                          paul53 1 Reply Last reply Reply Quote 0
                          • paul53
                            paul53 @kuessel25 last edited by paul53

                            @kuessel25: Tür:falseManuell:true

                            manuell_ein geht auf true, was nicht sein dürfte. Poste bitte den von Blockly erzeugten Javascript-Code ohne die letzte Zeile in Code tags.

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

                              @paul53 sagte in Türenabfrage Hilfe:

                              Blockly erzeugten Javascript-Code

                              ich weiß jetzt nicht ob ich das richtig verstanden habe,

                              
                              var manuell_ein, urspung;
                              
                              
                              on({id: 'zigbee.0.00158d0003d08254.opened', change: "ne"}, async function (obj) {
                                var value = obj.state.val;
                                var oldValue = obj.oldState.val;
                                console.log((['Tür:',(obj.state ? obj.state.val : ""),'Manuell:',manuell_ein].join('')));
                                if (!manuell_ein) {
                                  setState("sonoff.0.Küche Licht.POWER"/*Küche Licht POWER*/, (obj.state ? obj.state.val : ""));
                                }
                              });
                              // licht
                              on({id: 'sonoff.0.Küche Licht.POWER', change: "ne"}, async function (obj) {
                                var value = obj.state.val;
                                var oldValue = obj.oldState.val;
                                console.log((['Licht:',(obj.state ? obj.state.val : ""),'Ursprung:',(obj.state ? obj.state.from : "")].join('')));
                                manuell_ein = (obj.state ? obj.state.val : "") && (obj.state ? obj.state.from : "") != 'system.adapter.javascript.0';
                              });
                              
                              on({id: 'sonoff.0.Küche Licht.POWER', change: "ne"}, async function (obj) {
                                var value = obj.state.val;
                                var oldValue = obj.oldState.val;
                                manuell_ein = (obj.state ? obj.state.val : "") && urspung != 'javascript.0.scriptEnabled.verbrauchsmessung+kosten.licht_tür_test';
                              });
                              
                              paul53 1 Reply Last reply Reply Quote 0
                              • paul53
                                paul53 @kuessel25 last edited by paul53

                                @kuessel25 sagte: manuell_ein = (obj.state ? obj.state.val : "") && urspung != javascript.0.scriptEnabled.verbrauchsmessung+kosten.licht_tür_test';

                                So kann es nicht funktionieren ! Lösche den Trigger-Block rechts unten.

                                Bild_2021-01-25_115912.png

                                K 1 Reply Last reply Reply Quote 1
                                • K
                                  kuessel25 @paul53 last edited by

                                  @paul53
                                  Peinlich 😰

                                  hatte ich nicht gesehen,danke! jetzt gehts

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

                                    @kuessel25 sagte: hatte ich nicht gesehen,danke!

                                    Vor einem Import alles löschen!

                                    @kuessel25 sagte in Türenabfrage Hilfe:

                                    jetzt gehts

                                    Dann markiere das Thema in der Überschrift des ersten Beitrags als [gelöst].

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

                                      @paul53
                                      hätte noch ne kleine frage,und zwar wäre es jetzt noch möglich eine verzögerung einzubauen falls ich die türe schließe und das licht zb noch 5min an bleiben soll?

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

                                        @kuessel25 sagte: verzögerung einzubauen falls ich die türe schließe und das licht zb noch 5min an bleiben soll?

                                        Bild_2021-01-25_143736.png

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

                                        Support us

                                        ioBroker
                                        Community Adapters
                                        Donate

                                        689
                                        Online

                                        31.9k
                                        Users

                                        80.1k
                                        Topics

                                        1.3m
                                        Posts

                                        2
                                        26
                                        1137
                                        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