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] Aufzählung Fensterstatus - Anzeige in VIS

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    [gelöst] Aufzählung Fensterstatus - Anzeige in VIS

    This topic has been deleted. Only users with topic management privileges can see it.
    • FredF
      FredF Most Active Forum Testing last edited by

      Ändere Objekt ID in Wert und vereinfache falls-mache:
      ea7c5339-0feb-4d4e-a6ff-b51bf855c005-grafik.png

      Schmakus 1 Reply Last reply Reply Quote 0
      • Schmakus
        Schmakus Developer @FredF last edited by

        @fredf Wird nicht funktionieren, da wenn mehrere Fenster auf "true" sind und nur ein Fenster geschlossen wird, der Status auf "false" wechselt, obwohl noch andere Fenster offen sind.
        Man muss hier Schleife durch den Selektor machen mit einer Falls Abfrage darin.

        I 1 Reply Last reply Reply Quote 1
        • B
          badsnoopy667 @IceD112 last edited by badsnoopy667

          @iced112
          Ich hab irgendwo im Internet dieses Blockly gefunden, das funktioniert bei mir einwandfrei:

          fenster.png

          <xml xmlns="https://developers.google.com/blockly/xml">
            <variables>
              <variable id="(hHr_ae4nAyqkCl/QX*w">x</variable>
              <variable id="9sl@{VQ/amrd~ZTB}e/O">i</variable>
            </variables>
            <block type="comment" id="bP#C[SIFZAwjrGNLRvfJ" x="-288" y="-812">
              <field name="COMMENT">Offene Fenster zählen</field>
              <next>
                <block type="on_ext" id="RT3@Kxqxg#w3f=(kzwCu">
                  <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="0)0sp$I1ccfm%4Sde-mT">
                      <field name="oid">default</field>
                    </shadow>
                    <block type="selector" id=",lvP%A]1J?Mf^@0s2D%[">
                      <field name="TEXT">state[id=*](functions=fenster)</field>
                    </block>
                  </value>
                  <statement name="STATEMENT">
                    <block type="variables_set" id=":2U;X]t,z4J/+D;%yb~b">
                      <field name="VAR" id="(hHr_ae4nAyqkCl/QX*w">x</field>
                      <value name="VALUE">
                        <block type="math_number" id="B}eHQ9lDdZMCn@UJ*jG8">
                          <field name="NUM">0</field>
                        </block>
                      </value>
                      <next>
                        <block type="controls_forEach" id="~PaFX`X@5n{TM9K^{Jw6">
                          <field name="VAR" id="9sl@{VQ/amrd~ZTB}e/O">i</field>
                          <value name="LIST">
                            <block type="selector" id="xQ^Q5{h5V@5PLI+YO@i.">
                              <field name="TEXT">state[id=*](functions=fenster)</field>
                            </block>
                          </value>
                          <statement name="DO">
                            <block type="debug" id="Gp!N0hA7W!TGCT3a9N%V" disabled="true">
                              <field name="Severity">log</field>
                              <value name="TEXT">
                                <shadow type="text" id="CJho*HNjjn$3y:!Oja%t">
                                  <field name="TEXT">test</field>
                                </shadow>
                                <block type="get_value_var" id="ImnfsS.z0#2sv|o:l_W~">
                                  <field name="ATTR">val</field>
                                  <value name="OID">
                                    <shadow type="text">
                                      <field name="TEXT"></field>
                                    </shadow>
                                    <block type="variables_get" id=",_1rcOfB$)xpC!9|Lgmy">
                                      <field name="VAR" id="9sl@{VQ/amrd~ZTB}e/O">i</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <next>
                                <block type="controls_if" id="-3J;6~}7Ac!D}IR`/Dr1">
                                  <value name="IF0">
                                    <block type="get_value_var" id=")kSAuROX6lA-U2N,FJ1Q">
                                      <field name="ATTR">val</field>
                                      <value name="OID">
                                        <shadow type="text">
                                          <field name="TEXT"></field>
                                        </shadow>
                                        <block type="variables_get" id="!fALmmY3PSF+?rGHUXQ,">
                                          <field name="VAR" id="9sl@{VQ/amrd~ZTB}e/O">i</field>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <statement name="DO0">
                                    <block type="math_change" id="8cRG{Bp7_Q*vW0eisWuM">
                                      <field name="VAR" id="(hHr_ae4nAyqkCl/QX*w">x</field>
                                      <value name="DELTA">
                                        <shadow type="math_number" id="qgm5bBhk_!IL{kHE51bJ">
                                          <field name="NUM">1</field>
                                        </shadow>
                                      </value>
                                    </block>
                                  </statement>
                                </block>
                              </next>
                            </block>
                          </statement>
                          <next>
                            <block type="control" id=".:1)R,@*mq_#zuTK(H4E">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                              <field name="OID">0_userdata.0.offene_fenster_count</field>
                              <field name="WITH_DELAY">FALSE</field>
                              <value name="VALUE">
                                <block type="variables_get" id="xkO0oZvoGwB3u_2u#+n]">
                                  <field name="VAR" id="(hHr_ae4nAyqkCl/QX*w">x</field>
                                </block>
                              </value>
                            </block>
                          </next>
                        </block>
                      </next>
                    </block>
                  </statement>
                </block>
              </next>
            </block>
          </xml>
          

          Das Blockly gibt die Anzahl offener Fenster aus. Damit kann man dann ja leicht ein "Alle Fenster zu wenn Anzahl offen = 0 ist" basteln.

          1 Reply Last reply Reply Quote 1
          • I
            IceD112 @Schmakus last edited by

            @schmakus
            Richtig, das funktioniert leider nicht.

            1 Reply Last reply Reply Quote 0
            • amg_666
              amg_666 @IceD112 last edited by

              @iced112 im Blockly hast du id "window" aber deine Aufzählung heißt Fenster, ich glaube nicht, dass das passt

              I 1 Reply Last reply Reply Quote 0
              • I
                IceD112 @amg_666 last edited by

                @amg_666
                Das ist, bzw sollte korrekt sein. window ist ja die ID und Fenster der Name
                Screenshot 2022-03-15 at 16-21-12 enums - ioBroker.png

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

                  @iced112 sagte: Dazu habe ich zunächst einen Datenpunkt "Fenster_Status" erstellt

                  Der muss vom Typ "Logikwert" sein.

                  common_Fenster.JPG

                  @iced112 sagte in Aufzählung Fensterstatus - Anzeige in VIS:

                  folgendes Script erstellt

                  Man benötigt eine ODER-Verknüpfung aller Datenpunktwerte, um festzustellen, ob mindestens ein Fenster offen ist. Das kann man mit einer Schleife erledigen.

                  Bild_2022-03-15_191153.png

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

                    @paul53
                    Ich habe bisher noch nie mit Variablen gearbeitet. Ich gehe mal davon aus, dass das Erstellen der Variablen "id", "ids" und "offen" alleine nicht aussreicht?

                    Hab nämlich mal versucht dein Blockly nach zu bauen aber so funktioniert es noch nicht

                    B paul53 2 Replies Last reply Reply Quote 0
                    • B
                      badsnoopy667 @IceD112 last edited by

                      @iced112
                      Nimm doch einfach meinen Export von oben, der sollte funktionieren. Da musst du dann ggf. nur noch ein: Wenn Anzahl Fenster = 0 Dann Fenster Status = geschlossen einfügen am Ende. Fertig

                      amg_666 I 2 Replies Last reply Reply Quote 0
                      • paul53
                        paul53 @IceD112 last edited by

                        @iced112 sagte: versucht dein Blockly nach zu bauen aber so funktioniert es noch nicht

                        Datenpunkt "Fenster Status" austauschen!

                        <xml xmlns="https://developers.google.com/blockly/xml">
                         <variables>
                           <variable id="sa{l1~ORe0j$HLuZ5N%!">ids</variable>
                           <variable id="kT%nX!]Jo^`}k%/`k?Gq">offen</variable>
                           <variable id=":nd$CvGxF5#~Ll%,n#b2">id</variable>
                         </variables>
                         <block type="variables_set" id="i(tPYLv;RbKHg~i@a0{/" x="38" y="38">
                           <field name="VAR" id="sa{l1~ORe0j$HLuZ5N%!">ids</field>
                           <value name="VALUE">
                             <block type="selector" id="}ukVNv/ei7Qs4LavaT+0">
                               <field name="TEXT">*(functions=window)</field>
                             </block>
                           </value>
                           <next>
                             <block type="on_ext" id="Yr}xw(F4N,5fxKcZ:vaA">
                               <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="H6rjU$rO8@g6Lgk:jv9f">
                                   <field name="oid">default</field>
                                 </shadow>
                                 <block type="variables_get" id="WDNWJnP.L:dRO2.H3gFM">
                                   <field name="VAR" id="sa{l1~ORe0j$HLuZ5N%!">ids</field>
                                 </block>
                               </value>
                               <statement name="STATEMENT">
                                 <block type="variables_set" id="fiT;40M9XwH-IB;dai$*">
                                   <field name="VAR" id="kT%nX!]Jo^`}k%/`k?Gq">offen</field>
                                   <value name="VALUE">
                                     <block type="logic_boolean" id="D}!bGj=1]X5!.KmIss,#">
                                       <field name="BOOL">FALSE</field>
                                     </block>
                                   </value>
                                   <next>
                                     <block type="controls_forEach" id="hZm%QED(q{qqF9Qt_4zV">
                                       <field name="VAR" id=":nd$CvGxF5#~Ll%,n#b2">id</field>
                                       <value name="LIST">
                                         <block type="variables_get" id="W?h4_#I[DjCw!DD`F47g">
                                           <field name="VAR" id="sa{l1~ORe0j$HLuZ5N%!">ids</field>
                                         </block>
                                       </value>
                                       <statement name="DO">
                                         <block type="controls_if" id="z})86Cf$,3q!)/4/%c_V">
                                           <value name="IF0">
                                             <block type="get_value_var" id="A4]d*E-i6@qDI3SUpZqx">
                                               <field name="ATTR">val</field>
                                               <value name="OID">
                                                 <shadow type="text" id="iJar`blbRA6G?|%Gx#Po">
                                                   <field name="TEXT"></field>
                                                 </shadow>
                                                 <block type="variables_get" id="*JdI$y).=mPIbq)_%f@?">
                                                   <field name="VAR" id=":nd$CvGxF5#~Ll%,n#b2">id</field>
                                                 </block>
                                               </value>
                                             </block>
                                           </value>
                                           <statement name="DO0">
                                             <block type="variables_set" id="Fq.`IT_ELmfwRP@:9=fo">
                                               <field name="VAR" id="kT%nX!]Jo^`}k%/`k?Gq">offen</field>
                                               <value name="VALUE">
                                                 <block type="logic_boolean" id="XAR!D%*in|Fp8/pJ/8x?">
                                                   <field name="BOOL">TRUE</field>
                                                 </block>
                                               </value>
                                               <next>
                                                 <block type="controls_flow_statements" id=":b34uz=#:?=ZHl=pLEUL">
                                                   <field name="FLOW">BREAK</field>
                                                 </block>
                                               </next>
                                             </block>
                                           </statement>
                                         </block>
                                       </statement>
                                       <next>
                                         <block type="update" id="QKP7Y`XWPrhAR@*2qMM`">
                                           <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                           <field name="OID">0_userdata.0.Blockly.Fenster</field>
                                           <field name="WITH_DELAY">FALSE</field>
                                           <value name="VALUE">
                                             <block type="variables_get" id="nxH}!Z]j_(5pFwh+`utV">
                                               <field name="VAR" id="kT%nX!]Jo^`}k%/`k?Gq">offen</field>
                                             </block>
                                           </value>
                                         </block>
                                       </next>
                                     </block>
                                   </next>
                                 </block>
                               </statement>
                             </block>
                           </next>
                         </block>
                        </xml>
                        

                        1 Reply Last reply Reply Quote 0
                        • amg_666
                          amg_666 @badsnoopy667 last edited by

                          @badsnoopy667 sagte in Aufzählung Fensterstatus - Anzeige in VIS:

                          @iced112
                          Nimm doch einfach meinen Export von oben

                          Den hab ich eben auch mal zum Testen genommen, läuft ohne Probleme 🙂 👍 Und Anzahl offene Fenster finde ich auch besser, man kann das nutzen aber eben auch bei ungleich Null mit "Logikwerten" arbeiten.

                          1 Reply Last reply Reply Quote 1
                          • I
                            IceD112 @badsnoopy667 last edited by

                            @badsnoopy667 said in Aufzählung Fensterstatus - Anzeige in VIS:

                            @iced112
                            Da musst du dann ggf. nur noch ein: Wenn Anzahl Fenster = 0 Dann Fenster Status = geschlossen einfügen am Ende. Fertig

                            Ok, dein Export alleine funktioniert noch nicht. Helf mir mal bitte auf die Sprünge was du mit dem letzten Satz meintest? Das raff ich grade nicht😲

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

                              @iced112 sagte: was du mit dem letzten Satz meintest?

                              Wandlung der Anzahl offener Fenster in Logikwert "mind. ein Fenster offen".

                              Bild_2022-03-16_114045.png

                              B 1 Reply Last reply Reply Quote 1
                              • B
                                badsnoopy667 @paul53 last edited by

                                @paul53 Danke, so schnell war ich nicht 😉

                                1 Reply Last reply Reply Quote 0
                                • amg_666
                                  amg_666 @IceD112 last edited by

                                  @iced112 sagte in Aufzählung Fensterstatus - Anzeige in VIS:

                                  ein Export alleine funktioniert noch nicht

                                  Also bei mir läuft das einwandfrei mit dem Blockly von @badsnoopy667
                                  Kann es sein, dass du in deiner Aufzählung die Objekte (also z.B. einen Sensor mit Bezeichnung Wohnzimmer1) gezogen hast? Ich hab bei mir in der Aufzählung nur den Datenpunkt des jeweiligen Sensors aufgenommen, z.B. "state" (bei Homematic) bzw "is_open" (bei zigbee).
                                  Bei dem Blockly muss die Variable vom Typ Zahl sein. Oder du passt das wie von @paul53 beschrieben ein, dann muss es eine Logik-Variable sein

                                  I 1 Reply Last reply Reply Quote 0
                                  • I
                                    IceD112 @amg_666 last edited by

                                    @amg_666
                                    Meine Aufzählung schaut so aus
                                    Screenshot 2022-03-16 at 11-57-06 enums - ioBroker.png

                                    Hab ich da ggf ein Fehler? Also der Name in der Aufzählung kommt vom State door

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

                                      @iced112 sagte: Hab ich da ggf ein Fehler? Also der Name in der Aufzählung kommt vom State door

                                      Nein, das ist so in Ordnung. Es sind 12 Datenpunkte "door" zu functions=window zugeordnet.

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

                                        @paul53 ok, Datenpunkt "door" sagte mir nix. Bei mir sieht das so aus und läuft wie gesagt:
                                        7beb8432-7eb8-42c5-b4c6-520a04c12b82-grafik.png

                                        und in der Aufzählung dann nur DP "State"
                                        7faa3f37-53a6-4072-b696-8237663db49e-grafik.png

                                        I 1 Reply Last reply Reply Quote 0
                                        • I
                                          IceD112 @amg_666 last edited by

                                          @amg_666
                                          Das sind Sensoren von Shelly. Der Datenpunkt door gibt true oder flase aus wenn offen oder geschlossen.

                                          Ja, was mach ich denn falsch?

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

                                            @iced112 dann poste doch mal bitte dein blockly, hast du da irgendwas modifiziert?

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            497
                                            Online

                                            32.0k
                                            Users

                                            80.4k
                                            Topics

                                            1.3m
                                            Posts

                                            7
                                            31
                                            2083
                                            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