Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Berechnung der Liter in der Zisterne

    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

    Berechnung der Liter in der Zisterne

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

      Es ist doch nur eine Zeile notwendig, dann braucht man keine Zeitverzögerung.
      😎

      steuere Füllstand: [Formel von oben]

      und: besser wäre aktualisiere anstatt steuere, denn es handelt sich ja nicht um einen Aktor, der geschaltet werden soll, sondern eine Liter-Angabe zwischen 0 und 2000, oder ?

      SC1.png

      liv-in-sky 1 Reply Last reply Reply Quote 0
      • liv-in-sky
        liv-in-sky @umbm last edited by

        @umbm stimmt auch wieder 😞

        liv-in-sky 1 Reply Last reply Reply Quote 0
        • Amnesia1211
          Amnesia1211 last edited by

          Keine Ahnung warum aber bei mir steht immer nur 100l
          Was mache ich Falsch ?

          1.jpg

          2.jpg

          <xml xmlns="http://www.w3.org/1999/xhtml">
            <variables>
              <variable type="" id="%Uq5Ax[r/t,)3]fd-Z}q">FüllstandRechnen</variable>
            </variables>
            <block type="on_ext" id="sX3dvX;d5IBF}aD{Ckir" x="-312" y="138">
              <mutation items="1"></mutation>
              <field name="CONDITION">any</field>
              <field name="ACK_CONDITION"></field>
              <value name="OID0">
                <shadow type="field_oid" id="_Kq3@0ZHkP@`1mt/TuQx">
                  <field name="oid">hm-rpc.0.NEQ1012859.1.FILLING_LEVEL</field>
                </shadow>
              </value>
              <statement name="STATEMENT">
                <block type="update" id="og}!7jZ2T%G_GX2]]:x=">
                  <mutation delay_input="false"></mutation>
                  <field name="OID">Schalter.0.Garten.Füllstand</field>
                  <field name="WITH_DELAY">FALSE</field>
                  <value name="VALUE">
                    <block type="math_arithmetic" id="*pBe$b=5^cWL@F^jNIoi">
                      <field name="OP">MULTIPLY</field>
                      <value name="A">
                        <shadow type="math_number" id="CH,=mu:d`U1||]kT=jV)">
                          <field name="NUM">0</field>
                        </shadow>
                        <block type="get_value" id="|4_+=|FhhOV_WBLlVh{q">
                          <field name="ATTR">val</field>
                          <field name="OID">hm-rpc.0.NEQ1012859.1.FILLING_LEVEL</field>
                        </block>
                      </value>
                      <value name="B">
                        <shadow type="math_number" id="oF~)w#,ED/Dn=*@O9m-$">
                          <field name="NUM">20</field>
                        </shadow>
                        <block type="math_number" id="3=ixf}+o}{$yklNo5/!#">
                          <field name="NUM">20</field>
                        </block>
                      </value>
                    </block>
                  </value>
                </block>
              </statement>
            </block>
            <block type="variables_set" id="12nbU}U93s)JH(HgC}vP" disabled="true" x="-262" y="388">
              <field name="VAR" id="%Uq5Ax[r/t,)3]fd-Z}q" variabletype="">FüllstandRechnen</field>
              <value name="VALUE">
                <block type="math_arithmetic" id="_-P..:vIuH[_5KFJWVOL">
                  <field name="OP">MULTIPLY</field>
                  <value name="A">
                    <shadow type="math_number" id="eiu8z)}P5e?5EbTz`+.*">
                      <field name="NUM">2042</field>
                    </shadow>
                    <block type="get_value" id="V7B.u1}aXHA-~_pl}]Fy">
                      <field name="ATTR">val</field>
                      <field name="OID">hm-rpc.0.NEQ1012859.1.FILLING_LEVEL</field>
                    </block>
                  </value>
                  <value name="B">
                    <shadow type="math_number" id="Z/t@gA(#a0:y1QTGw/DS">
                      <field name="NUM">2042</field>
                    </shadow>
                  </value>
                </block>
              </value>
              <next>
                <block type="control" id="uPOmsadx{V_/0hs$@Tp?" disabled="true">
                  <mutation delay_input="true"></mutation>
                  <field name="OID">Schalter.0.Garten.Füllstand</field>
                  <field name="WITH_DELAY">TRUE</field>
                  <field name="DELAY_MS">1</field>
                  <field name="UNIT">sec</field>
                  <field name="CLEAR_RUNNING">FALSE</field>
                  <value name="VALUE">
                    <block type="math_arithmetic" id="eArBci*jtBD35*3tOEvU">
                      <field name="OP">DIVIDE</field>
                      <value name="A">
                        <shadow type="math_number" id=".O;Nlluw|}7+C8aM6-(X">
                          <field name="NUM">2042</field>
                        </shadow>
                        <block type="variables_get" id="e]8WC[/PSND?1lBufupf">
                          <field name="VAR" id="%Uq5Ax[r/t,)3]fd-Z}q" variabletype="">FüllstandRechnen</field>
                        </block>
                      </value>
                      <value name="B">
                        <shadow type="math_number" id="wtN@v=!0#|F/4Wl2o{9+">
                          <field name="NUM">100</field>
                        </shadow>
                      </value>
                    </block>
                  </value>
                </block>
              </next>
            </block>
            <block type="control" id="`TP-xTQe93CL|T^`Uj?H" disabled="true" x="488" y="363">
              <mutation delay_input="true"></mutation>
              <field name="OID">Schalter.0.Garten.Füllstand</field>
              <field name="WITH_DELAY">TRUE</field>
              <field name="DELAY_MS">2</field>
              <field name="UNIT">sec</field>
              <field name="CLEAR_RUNNING">FALSE</field>
            </block>
            <block type="get_value" id="S@%V`//TSU9KV2bf-Z!)" disabled="true" x="463" y="513">
              <field name="ATTR">val</field>
              <field name="OID">hm-rpc.0.NEQ1012859.1.FILLING_LEVEL</field>
            </block>
            <block type="field_oid" id=";9+f_SHT2.H|xetAx$lT" disabled="true" x="-237" y="563">
              <field name="oid">Schalter.0.Garten.Füllstand_Akualisieren</field>
            </block>
          </xml>
          
          1 Reply Last reply Reply Quote 0
          • umbm
            umbm last edited by

            Was steht denn im Datenpunkt "Erdtank_Filling_Level" genau drin?
            Zahl oder Zahl mit %... oder?

            Amnesia1211 1 Reply Last reply Reply Quote 0
            • liv-in-sky
              liv-in-sky @liv-in-sky last edited by

              @liv-in-sky du hast das script auch aktiviert ? sorry für diese frage

              1 Reply Last reply Reply Quote 0
              • Amnesia1211
                Amnesia1211 @umbm last edited by Amnesia1211

                @umbm Eine Zahl mit %
                1.jpg

                2.jpg

                @liv-in-sky Ja klar habe ich das 😉 kein Problem bin über jede Hilfe Dankbar !!

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

                  Dann musst du die Zeichenkette erst um das % (und ggf Leerzeichen) bereinigen, so dass nur eine Zahl übrig bleibt.
                  Erst dann mit 20 multiplizieren.

                  Die Blockly-Befehle findest du im Text-Bereich... (habe ich nicht im Kopf und bin nicht am PC)

                  Korrektur, jetzt wo ich deine Screenshots sehe:
                  Ist nicht nötig, denn der Datenpunkt ist als Zahl definiert.

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

                    Bist du sicher, dass eine Aktualisierung der 100 % stattfindet, damit dein Trigger auslöst?

                    Setze mal den % Wert in den Objekten manuell auf 90 und schau, ob sich was ändert.

                    Amnesia1211 1 Reply Last reply Reply Quote 0
                    • Amnesia1211
                      Amnesia1211 @umbm last edited by

                      @umbm
                      Habe das mal beides getestet. Es bleibt bei 100 L egal was ich mache. Wenn ich die 100 L raus lösche
                      und von zB 100% auf 80% den Füllstand setze kommen die 100L bei dem Füllstand wieder. Die Aktualisierung der % (Füllhöhe Tank) wird von der CCU aktualisiert im Zyklus glaube ich aber sicher bin ich mir da nicht, als ich die Sensorleitung Kalibriert habe hat sich der Wert auf jeden Fall schön verändert.

                      Die Konvertierung von % nach Zahl habe ich auch getestet aber es hat leider nichts gebracht.

                      1.jpg

                      2.jpg

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

                        Ändere mal den Namen des Ziel-Datenpunktes

                        Schalter.0.Garten.Füllstand
                        

                        auf

                        Schalter.0.Garten.Fuellstand
                        

                        also den Umlaut entfernen, ich glaube in der ID der Objekte dürfen keine Sonderzeichen vorkommen, nur im Namen.

                        Wenn das nichts bringt erstmal ein

                        debug output
                        

                        vor aktualisiere, um im Log zu prüfen, ob der Trigger überhaut auslöst.

                        Amnesia1211 1 Reply Last reply Reply Quote 0
                        • Amnesia1211
                          Amnesia1211 @umbm last edited by

                          @umbm
                          Also glaube ich habe es gelöst, mit dem Sonderzeichen war eine super Idee aber leider kein erfolg gehabt.
                          Habe ein Objekt angelegt was gemischt ist, warum es jetzt geht keine Ahnung aber wenn ich den Prozent wert änder
                          Rechnet er die Liter Richtig aus "Juppi "
                          Die Sonderzeichen habe ich vorsichtshalber auch weg gelassen.

                          Herzlichen Dank für die tolle Hilfe !!!!!!!

                          3.jpg
                          1.jpg
                          2.jpg
                          4.jpg
                          5.jpg

                          <xml xmlns="http://www.w3.org/1999/xhtml">
                            <variables>
                              <variable type="" id="%Uq5Ax[r/t,)3]fd-Z}q">FüllstandRechnen</variable>
                            </variables>
                            <block type="on_ext" id="sX3dvX;d5IBF}aD{Ckir" x="-312" y="113">
                              <mutation items="1"></mutation>
                              <field name="CONDITION">any</field>
                              <field name="ACK_CONDITION"></field>
                              <value name="OID0">
                                <shadow type="field_oid" id="_Kq3@0ZHkP@`1mt/TuQx">
                                  <field name="oid">hm-rpc.0.NEQ1012859.1.FILLING_LEVEL</field>
                                </shadow>
                              </value>
                              <statement name="STATEMENT">
                                <block type="controls_if" id="0CrUZF#mi5sy@3x*4CAX">
                                  <value name="IF0">
                                    <block type="logic_operation" id="=*?(#q-crM!E`,$@/-ZN" inline="false">
                                      <field name="OP">OR</field>
                                      <value name="A">
                                        <block type="get_value" id="oefjwsl`@Z@!wccDC0aS">
                                          <field name="ATTR">val</field>
                                          <field name="OID">Schalter.0.Garten.Füllstand_Akualisieren</field>
                                        </block>
                                      </value>
                                      <value name="B">
                                        <block type="get_value" id="S@%V`//TSU9KV2bf-Z!)">
                                          <field name="ATTR">val</field>
                                          <field name="OID">hm-rpc.0.NEQ1012859.1.FILLING_LEVEL</field>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <statement name="DO0">
                                    <block type="update" id="og}!7jZ2T%G_GX2]]:x=">
                                      <mutation delay_input="false"></mutation>
                                      <field name="OID">Schalter.0.Garten.FuellstandTank</field>
                                      <field name="WITH_DELAY">FALSE</field>
                                      <value name="VALUE">
                                        <block type="math_arithmetic" id="*pBe$b=5^cWL@F^jNIoi">
                                          <field name="OP">MULTIPLY</field>
                                          <value name="A">
                                            <shadow type="math_number" id="CH,=mu:d`U1||]kT=jV)">
                                              <field name="NUM">0</field>
                                            </shadow>
                                            <block type="get_value" id="|4_+=|FhhOV_WBLlVh{q">
                                              <field name="ATTR">val</field>
                                              <field name="OID">hm-rpc.0.NEQ1012859.1.FILLING_LEVEL</field>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <shadow type="math_number" id="oF~)w#,ED/Dn=*@O9m-$">
                                              <field name="NUM">20</field>
                                            </shadow>
                                            <block type="math_number" id="3=ixf}+o}{$yklNo5/!#">
                                              <field name="NUM">20</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                    </block>
                                  </statement>
                                </block>
                              </statement>
                            </block>
                            <block type="variables_set" id="12nbU}U93s)JH(HgC}vP" disabled="true" x="-262" y="389">
                              <field name="VAR" id="%Uq5Ax[r/t,)3]fd-Z}q" variabletype="">FüllstandRechnen</field>
                              <value name="VALUE">
                                <block type="math_arithmetic" id="_-P..:vIuH[_5KFJWVOL">
                                  <field name="OP">MULTIPLY</field>
                                  <value name="A">
                                    <shadow type="math_number" id="eiu8z)}P5e?5EbTz`+.*">
                                      <field name="NUM">2042</field>
                                    </shadow>
                                    <block type="get_value" id="V7B.u1}aXHA-~_pl}]Fy">
                                      <field name="ATTR">val</field>
                                      <field name="OID">hm-rpc.0.NEQ1012859.1.FILLING_LEVEL</field>
                                    </block>
                                  </value>
                                  <value name="B">
                                    <shadow type="math_number" id="Z/t@gA(#a0:y1QTGw/DS">
                                      <field name="NUM">2042</field>
                                    </shadow>
                                  </value>
                                </block>
                              </value>
                              <next>
                                <block type="control" id="uPOmsadx{V_/0hs$@Tp?" disabled="true">
                                  <mutation delay_input="true"></mutation>
                                  <field name="OID">Schalter.0.Garten.Füllstand</field>
                                  <field name="WITH_DELAY">TRUE</field>
                                  <field name="DELAY_MS">1</field>
                                  <field name="UNIT">sec</field>
                                  <field name="CLEAR_RUNNING">FALSE</field>
                                  <value name="VALUE">
                                    <block type="math_arithmetic" id="eArBci*jtBD35*3tOEvU">
                                      <field name="OP">DIVIDE</field>
                                      <value name="A">
                                        <shadow type="math_number" id=".O;Nlluw|}7+C8aM6-(X">
                                          <field name="NUM">2042</field>
                                        </shadow>
                                        <block type="variables_get" id="e]8WC[/PSND?1lBufupf">
                                          <field name="VAR" id="%Uq5Ax[r/t,)3]fd-Z}q" variabletype="">FüllstandRechnen</field>
                                        </block>
                                      </value>
                                      <value name="B">
                                        <shadow type="math_number" id="wtN@v=!0#|F/4Wl2o{9+">
                                          <field name="NUM">100</field>
                                        </shadow>
                                      </value>
                                    </block>
                                  </value>
                                </block>
                              </next>
                            </block>
                            <block type="field_oid" id=";9+f_SHT2.H|xetAx$lT" disabled="true" x="-237" y="563">
                              <field name="oid">Schalter.0.Garten.Füllstand_Akualisieren</field>
                            </block>
                            <block type="control" id="`TP-xTQe93CL|T^`Uj?H" disabled="true" x="263" y="538">
                              <mutation delay_input="true"></mutation>
                              <field name="OID">Schalter.0.Garten.Füllstand</field>
                              <field name="WITH_DELAY">TRUE</field>
                              <field name="DELAY_MS">1000</field>
                              <field name="UNIT">ms</field>
                              <field name="CLEAR_RUNNING">FALSE</field>
                            </block>
                          </xml>
                          

                          Vorgehensweise:
                          Unter Objects in iobroker ein neues Objekt anlegen.
                          12.jpg
                          13.jpg

                          Unter Javascript das Blockly Javascript einfügen
                          und die Objekte auswählen, FILLING_LEVEL und FuellstandTank
                          das ODER kann raus gelöscht werden war nur ein TEST.

                          14.jpg

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

                            Du kannst neue Datenpunkte auch direkt aus Blockly heraus anlegen lassen, das damit vereinfachen und Fehler vermeiden.

                            Ich hatte dazu mal vor längerer Zeit einen Tipp hier im Forum erhalten (Ich glaube von @paul53) , finden das Thema nach der Forumumstellung aber nicht mehr (Link ist tot).

                            Deshalb hier kurz der Code und die Erläuterung.
                            Wenn du den Code in ein Blockly importierst, hast du 3 Funktionen, damit unter "Funktionen" auch 3 neue Blöcke, die du nutzen kannst, um bei Bedarf neue Datenpunkte (Typ Number,String oder Bool) anzulegen.

                            Wenn du den Block gleich zu Beginn einfügst, wird der neue DP direkt nach dem Start des Scripts angelegt.

                            Funktionen_fuer_DP.png

                            Hier der Code:

                            <xml xmlns="http://www.w3.org/1999/xhtml">
                             <variables>
                               <variable type="" id="ev4ae2)vhI!DH:8cImp7">ID</variable>
                               <variable type="" id="q]Py[;@J~}jNy]6hOqa`">Init</variable>
                               <variable type="" id="[clCaHrT/wvEuj]r=v(k">Name</variable>
                             </variables>
                             <block type="procedures_defcustomnoreturn" id="5z?zZ*vU+r2Nd[7-_ctU" x="-687" y="-237">
                               <mutation statements="false">
                                 <arg name="ID" varid="ev4ae2)vhI!DH:8cImp7"></arg>
                                 <arg name="Init" varid="q]Py[;@J~}jNy]6hOqa`"></arg>
                                 <arg name="Name" varid="[clCaHrT/wvEuj]r=v(k"></arg>
                               </mutation>
                               <field name="NAME">newNumberDP1</field>
                               <field name="SCRIPT">Y3JlYXRlU3RhdGUoSUQsIEluaXQsIHsKICAgIHR5cGU6ICdudW1iZXInLAogICAgbmFtZTogTmFtZQp9KTs=</field>
                               <comment pinned="false" h="80" w="160">Datenpunkt Typ Zahl erzeugen</comment>
                             </block>
                             <block type="procedures_defcustomnoreturn" id="2@tb5Q,+;3xgyRLR`611" x="-687" y="-187">
                               <mutation statements="false">
                                 <arg name="ID" varid="ev4ae2)vhI!DH:8cImp7"></arg>
                                 <arg name="Init" varid="q]Py[;@J~}jNy]6hOqa`"></arg>
                                 <arg name="Name" varid="[clCaHrT/wvEuj]r=v(k"></arg>
                               </mutation>
                               <field name="NAME">newStringDP</field>
                               <field name="SCRIPT">Y3JlYXRlU3RhdGUoSUQsIEluaXQsIHt0eXBlOiAnc3RyaW5nJywgbmFtZTogTmFtZX0pOw==</field>
                               <comment pinned="false" h="80" w="160">Datenpunkt Typ Zeichenkette erzeugen</comment>
                             </block>
                             <block type="procedures_defcustomnoreturn" id="s}Pwi720KKlpTUa:!xH5" x="-687" y="-137">
                               <mutation statements="false">
                                 <arg name="ID" varid="ev4ae2)vhI!DH:8cImp7"></arg>
                                 <arg name="Name" varid="[clCaHrT/wvEuj]r=v(k"></arg>
                               </mutation>
                               <field name="NAME">newBoolDP</field>
                               <field name="SCRIPT">Y3JlYXRlU3RhdGUoSUQsIGZhbHNlLCB7dHlwZTogJ2Jvb2xlYW4nLCBuYW1lOiBOYW1lfSk7</field>
                               <comment pinned="false" h="80" w="160">Datenpunkt Typ Logikwert erzeugen</comment>
                             </block>
                            </xml>
                            

                            Amnesia1211 thewhobox 3 Replies Last reply Reply Quote 0
                            • Amnesia1211
                              Amnesia1211 @umbm last edited by

                              @umbm
                              Sehr geil, danke dafür werde ich gleich mal testen !!!

                              1 Reply Last reply Reply Quote 0
                              • thewhobox
                                thewhobox @umbm last edited by thewhobox

                                @umbm Warum nicht der "Datenpunkt erzeugen" Block?
                                553ea3a8-f7ea-48b8-8f67-3c4e29858d45-grafik.png

                                FredF 1 Reply Last reply Reply Quote 0
                                • FredF
                                  FredF Most Active Forum Testing @thewhobox last edited by FredF

                                  @thewhobox sagte in Berechnung der Liter in der Zisterne:

                                  @umbm Warum nicht der "Datenpunkt erzeugen" Block?

                                  Weil dieser Block nur im javascript Adapters latest Repo verfügbar ist?

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

                                    @FredF Nein den gibt es schon ewig. Ich habe ihn nur um "InitWert" und "Common" ergänzt.

                                    FredF 1 Reply Last reply Reply Quote 0
                                    • FredF
                                      FredF Most Active Forum Testing @thewhobox last edited by

                                      @thewhobox
                                      Im Produktivsystem verwende ich Version 4.1.12, da finde ich ihn nicht...
                                      Im Test System mit 4.1.13 dagegen schon...

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

                                        @FredF Okay seltsam. Hab den aber nur erweitert.
                                        Dachte aber auch schon, dass die 4.1.13 schon im stable ist.

                                        1 Reply Last reply Reply Quote 0
                                        • Amnesia1211
                                          Amnesia1211 @umbm last edited by

                                          @umbm
                                          Habe es leider nicht so ganz verstanden wie es geht wenn ich ehrlich bin,Bild Text dachte ich bekomme es hin aber, leider hat es nicht geklappt 😧
                                          Hast du vielleicht ein kleines "Tutorial" wie man vorgehen muss. Sorry das ich so doof frage.

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

                                          Support us

                                          ioBroker
                                          Community Adapters
                                          Donate

                                          715
                                          Online

                                          31.9k
                                          Users

                                          80.3k
                                          Topics

                                          1.3m
                                          Posts

                                          5
                                          23
                                          1716
                                          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