Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Hilfe bei Stromverbrauchs script

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    Hilfe bei Stromverbrauchs script

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

      @paul53
      dein script kapier ich gerade nicht, sorry 😞
      Wie legst du den Zeitrahmen fest? Die Takte kommen ja je nach Stromverbrauch unterschiedlich schnell. Ich will erkennen wenn gerade viel Strom verbraucht wird und viele Takte in einem bestimmtem Zeitrahmen (bsp: pro 5min) kommen. Was ich schon habe ist ein Zähler Datenpunkt der seit Einbau des Zählers bei jeder S0 Änderung einen Takt drauf zählt.

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

        @root_ sagte:

        Die Takte kommen ja je nach Stromverbrauch unterschiedlich schnell. Ich will erkennen wenn gerade viel Strom verbraucht wird

        Genau das macht das Skript: Wenn der Abstand zwischen 2 Impulsen < 30 s ist (entspricht 10 Impulsen in 5 Minuten), ist die Leistung zu hoch.

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

          @paul53
          Danke, funktioniert prima.
          Nur die letzte Zeile im script ist vertauscht oder?

          thx

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

            @root_ sagte:

            Nur die letzte Zeile im script ist vertauscht oder?

            Nein. Es wird sich der Zeitstempel für die Differenzbildung beim nächsten Impuls gemerkt.

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

              @paul53
              Irgendwie stell ich mich zu blöd an.
              Hier mal mein Blockly:
              Bildschirmfoto 2021-01-10 um 16.07.00.png

              Wenn ich jetzt den Wert von S0_counter innerhalb von 30s um 2 erhöhe, sollte doch der Wert von laedt true werden oder? Das funktioniert aber irgendwie nicht.
              Mit dem Timeout setze ich den laedt wieder auf false falls 60s keine Werterhöhung 30s/2 erfolgt.

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

                @root_ sagte:

                S0_counter innerhalb von 30s um 2 erhöhe, sollte doch der wert von laedt auf true werden oder?

                Ja.
                Ist der Trigger nicht der S0-Impuls, sondern ein Zählwert?

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

                  @paul53
                  Ich habe es aber gerade mal mit einem anderen Trigger probiert und das funktioniert auch nicht.
                  Der Trigger ist der S0-Wert welcher ein Zähler ist.

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

                    @root_ sagte in Hilfe bei Stromverbrauchs script:

                    Der Trigger ist der S0-Wert welcher ein Zähler ist.

                    Bei einem Zählwert wird die Variable letzter_Impuls nicht benötigt. Stattdessen kann "vorherige letzte Änderung" für die Differenzbildung verwendet werden.

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

                      @paul53
                      Ich hoffe ich nerv nicht langsam aber ich komme nicht weiter.
                      Ich hab jetzt einen Example State (Logikwert) benutzt zum triggern.
                      Es funktioniert aber nicht. Der zu schaltende Datenpunkt bleibt immer false.
                      Könntest du dir das bitte noch mal anschauen?
                      Was ich auch noch nicht verstehe, wie wird
                      Bildschirmfoto 2021-01-13 um 19.15.57.png
                      getriggert?

                      Bildschirmfoto 2021-01-13 um 19.11.40.png

                      Danke dir!!

                      <xml xmlns="https://developers.google.com/blockly/xml">
                        <variables>
                          <variable id="~=hw)O*}Z$q85KTM{Iiz">letzter_Impuls</variable>
                          <variable type="timeout" id="timeout">timeout</variable>
                          <variable id="{ntQ$h}nsUTjnCi3$YST">letzte_Änderung</variable>
                        </variables>
                        <block type="variables_set" id="C;u0:uyCs,@G22k*|ktC" x="113" y="88">
                          <field name="VAR" id="~=hw)O*}Z$q85KTM{Iiz">letzter_Impuls</field>
                          <value name="VALUE">
                            <block type="get_value" id="ouQ,~BK)f`L);Q[YhBJU">
                              <field name="ATTR">lc</field>
                              <field name="OID">0_userdata.0.example_state</field>
                            </block>
                          </value>
                          <next>
                            <block type="comment" id="5~p?.PVPll([Omdnl+,[">
                              <field name="COMMENT">2 S0 Impulse in 30sek</field>
                              <next>
                                <block type="on_ext" id="RsKK`dP9zA7*m0(1nRlD">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
                                  <field name="CONDITION">gt</field>
                                  <field name="ACK_CONDITION"></field>
                                  <value name="OID0">
                                    <shadow type="field_oid" id=".QKGE}a}]wk2,jrmOYdu">
                                      <field name="oid">0_userdata.0.example_state</field>
                                    </shadow>
                                  </value>
                                  <statement name="STATEMENT">
                                    <block type="update" id="|EW.5~g2GwkDY;~6Nh1b">
                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                      <field name="OID">0_userdata.0.Auto.laedt</field>
                                      <field name="WITH_DELAY">FALSE</field>
                                      <value name="VALUE">
                                        <block type="logic_compare" id="JR0[L~dWg+dES{KSnHfx">
                                          <field name="OP">LT</field>
                                          <value name="A">
                                            <block type="math_arithmetic" id="8@aDpD`@[!@7+iD{f/AK">
                                              <field name="OP">MINUS</field>
                                              <value name="A">
                                                <shadow type="math_number" id="nbBZ7J6I6zACS1L9$8b.">
                                                  <field name="NUM">1</field>
                                                </shadow>
                                                <block type="variables_get" id="Pd)s6c@g|4:eTo)B$3fh">
                                                  <field name="VAR" id="{ntQ$h}nsUTjnCi3$YST">letzte_Änderung</field>
                                                </block>
                                              </value>
                                              <value name="B">
                                                <shadow type="math_number" id="}TRTr6Jqvdcm]~h_gMil">
                                                  <field name="NUM">1</field>
                                                </shadow>
                                                <block type="variables_get" id="g7$0dNClc)j}J~WW.I4B">
                                                  <field name="VAR" id="~=hw)O*}Z$q85KTM{Iiz">letzter_Impuls</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <block type="math_number" id="P|e*9qL))DKL#LH!W9`/">
                                              <field name="NUM">30000</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="variables_set" id="*9NVtJFSTi)4Ui1FwLgS">
                                          <field name="VAR" id="~=hw)O*}Z$q85KTM{Iiz">letzter_Impuls</field>
                                          <value name="VALUE">
                                            <block type="variables_get" id="Z0d/Jh,mecOGU,jN3c^Y">
                                              <field name="VAR" id="{ntQ$h}nsUTjnCi3$YST">letzte_Änderung</field>
                                            </block>
                                          </value>
                                          <next>
                                            <block type="timeouts_cleartimeout" id="y;o(hkS#;,)Y2a9a!oTF">
                                              <field name="NAME">timeout</field>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </statement>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                        <block type="on" id="iq:~Y//(UT5G;O/tFEAE" x="113" y="413">
                          <field name="OID">0_userdata.0.Auto.laedt</field>
                          <field name="CONDITION">true</field>
                          <field name="ACK_CONDITION"></field>
                          <statement name="STATEMENT">
                            <block type="timeouts_settimeout" id="|mi+g}:NFA1g:~Aei8%~">
                              <field name="NAME">timeout</field>
                              <field name="DELAY">30</field>
                              <field name="UNIT">sec</field>
                              <statement name="STATEMENT">
                                <block type="update" id="`YE-9rjUnFQo7z4IGQ/x">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                  <field name="OID">0_userdata.0.Auto.laedt</field>
                                  <field name="WITH_DELAY">FALSE</field>
                                  <value name="VALUE">
                                    <block type="logic_boolean" id="1:^xEM/1?D+-k.W-/m$=">
                                      <field name="BOOL">FALSE</field>
                                    </block>
                                  </value>
                                </block>
                              </statement>
                            </block>
                          </statement>
                        </block>
                      </xml>
                      
                      paul53 1 Reply Last reply Reply Quote 0
                      • paul53
                        paul53 @root_ last edited by

                        @root_
                        Du verwendest eine selbst erstellte Variable "letzte_Änderung". Es muss die "letzte Änderung" aus dem Trigger-Datenpunkt verwendet werden:

                        Blockly_DP_Props.JPG

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

                          @paul53
                          Funktioniert jetzt perfekt. Danke dir für deine Gedult.

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

                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          748
                          Online

                          32.0k
                          Users

                          80.4k
                          Topics

                          1.3m
                          Posts

                          3
                          17
                          942
                          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