Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. [gelöst] Blockly zwei Nachkommastellen hochzählen

    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] Blockly zwei Nachkommastellen hochzählen

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

      Ich dachte es ist einfach aber irgendwie klappt es nicht.

      ich möchte eine Zahl mit 2 Nachkommastellen bei jedem Trigger um 0.01 erhöhen. Ich bekomme aber krumme Werte wie 5178.430000000006 raus. Wie kann ich das besser lösen?
      4971_2018-10-22_2158.png

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

        Hallo,

        hast du eine Lösung für das Problem gefunden?

        Ich bin in der selben Situation.

        1 Reply Last reply Reply Quote 0
        • W
          watcherkb last edited by

          Ich habe es so gelöst und funktioniert auch gut. Einfach das Blockly Script importieren, dann hast du alles was du brauchst. Dann die Datenpunkte entsprechend anpassen.

          ! <xml 1999/xmlns="<URL url=" http:/www.w3.org/xhtml"="">http://www.w3.org/1999/xhtml">
          ! <block type="on" id="FLfW;pWblQWz(Q[*b#+X" x="-362" y="13"><field name="OID">mqtt.0.ESP_Easy.Gaszähler.Total</field>
          ! <field name="CONDITION">ne</field>
          ! <statement name="STATEMENT"><block type="update" id=";U_YCxKC8kW/x:Pf2^f"><mutation delay_input="false"></mutation> ! <field name="OID">admin.0.Datenpunkte.Energie.Gaszähler.aktuell</field> ! <field name="WITH_DELAY">FALSE</field> ! <value name="VALUE"><block type="math_arithmetic" id="/*4z_8{j*yU.mc*UHD4a"><field name="OP">DIVIDE</field> ! <value name="A"><shadow type="math_number" id="_=F{;HjK5PXnG/@8?Kk"><field name="NUM">1</field></shadow>
          ! <block type="math_round" id="/F|ys`NU_tU9SX.i;;75"><field name="OP">ROUND</field>
          ! <value name="NUM"><shadow type="math_number" id="*0+clnLO~49o1Sk8(})Q"><field name="NUM">3.1</field></shadow>
          ! <block type="math_arithmetic" id="GBaV#d-^I/FL8A}qyAxm"><field name="OP">ADD</field>
          ! <value name="A"><shadow type="math_number" id="_ip@-v!b.Z{aIe/[;q4"><field name="NUM">1</field></shadow>
          ! <block type="math_arithmetic" id="D!S~7^yemymGKv|qr,M"><field name="OP">MULTIPLY</field>
          ! <value name="A"><shadow type="math_number" id="!%,K=_VNlA{uJx8JOhoT"><field name="NUM">1</field></shadow>
          ! <block type="get_value" id="Xs9D=~/ldXt):|=!Y?@s"><field name="ATTR">val</field>
          ! <field name="OID">admin.0.Datenpunkte.Energie.Gaszähler.aktuell</field></block></value>
          ! <value name="B"><shadow type="math_number" id="KuIG{1oQ19d
          g/x(RG7D"><field name="NUM">100</field></shadow></value></block></value>
          ! <value name="B"><shadow type="math_number" id="B~XKQ.av?6IL(]uaS]@+"><field name="NUM">1</field></shadow></value></block></value></block></value>
          ! <value name="B"><shadow type="math_number" id="6,+@/5O
          vU7u7isTD@x("><field name="NUM">0.01</field></shadow>
          ! <block type="math_number" id="gaLsE_p2yz7)PLGI;b2Q"><field name="NUM">100</field></block></value></block></value></block></statement></block></xml>

          M 1 Reply Last reply Reply Quote 0
          • Matzebhv
            Matzebhv last edited by

            Über dieses Problem ist wohl jeder schon mal gestolpert der Rechenoperationen unter Javascript durchführen will.

            http://www.dcljs.de/faq/antwort.php?Ant … en_rechnen

            Gruß

            Matze

            1 Reply Last reply Reply Quote 0
            • M
              markus397 @watcherkb last edited by

              @watcherkb said in [gelöst] Blockly zwei Nachkommastellen hochzählen:

              Ich habe es so gelöst und funktioniert auch gut. Einfach das Blockly Script importieren, dann hast du alles was du brauchst. Dann die Datenpunkte entsprechend anpassen.

              ! <xml 1999/xmlns="<URL url=" http:/www.w3.org/xhtml"="">http://www.w3.org/1999/xhtml">
              ! <block type="on" id="FLfW;pWblQWz(Q[*b#+X" x="-362" y="13"><field name="OID">mqtt.0.ESP_Easy.Gaszähler.Total</field>
              ! <field name="CONDITION">ne</field>
              ! <statement name="STATEMENT"><block type="update" id=";U_YCxKC8kW/x:Pf2^f"><mutation delay_input="false"></mutation> ! <field name="OID">admin.0.Datenpunkte.Energie.Gaszähler.aktuell</field> ! <field name="WITH_DELAY">FALSE</field> ! <value name="VALUE"><block type="math_arithmetic" id="/*4z_8{j*yU.mc*UHD4a"><field name="OP">DIVIDE</field> ! <value name="A"><shadow type="math_number" id="_=F{;HjK5PXnG/@8?Kk"><field name="NUM">1</field></shadow>
              ! <block type="math_round" id="/F|ys`NU_tU9SX.i;;75"><field name="OP">ROUND</field>
              ! <value name="NUM"><shadow type="math_number" id="*0+clnLO~49o1Sk8(})Q"><field name="NUM">3.1</field></shadow>
              ! <block type="math_arithmetic" id="GBaV#d-^I/FL8A}qyAxm"><field name="OP">ADD</field>
              ! <value name="A"><shadow type="math_number" id="_ip@-v!b.Z{aIe/[;q4"><field name="NUM">1</field></shadow>
              ! <block type="math_arithmetic" id="D!S~7^yemymGKv|qr,M"><field name="OP">MULTIPLY</field>
              ! <value name="A"><shadow type="math_number" id="!%,K=_VNlA{uJx8JOhoT"><field name="NUM">1</field></shadow>
              ! <block type="get_value" id="Xs9D=~/ldXt):|=!Y?@s"><field name="ATTR">val</field>
              ! <field name="OID">admin.0.Datenpunkte.Energie.Gaszähler.aktuell</field></block></value>
              ! <value name="B"><shadow type="math_number" id="KuIG{1oQ19d
              g/x(RG7D"><field name="NUM">100</field></shadow></value></block></value>
              ! <value name="B"><shadow type="math_number" id="B~XKQ.av?6IL(]uaS]@+"><field name="NUM">1</field></shadow></value></block></value></block></value>
              ! <value name="B"><shadow type="math_number" id="6,+@/5O
              vU7u7isTD@x("><field name="NUM">0.01</field></shadow>
              ! <block type="math_number" id="gaLsE_p2yz7)PLGI;b2Q"><field name="NUM">100</field></block></value></block></value></block></statement></block></xml>

              Habe versucht deinen Code zu importieren, aber hat nicht geklappt. Kommt nur ein schwarzer Baustein. Kannst du noch mal den Code gier rein stellen oder auch ein Bild machen?

              W 1 Reply Last reply Reply Quote 0
              • W
                watcherkb @markus397 last edited by

                @markus397

                <xml xmlns="http://www.w3.org/1999/xhtml">
                  <block type="on" id="FLfW;pWblQWz(Q[*b#+X" x="-362" y="13">
                    <field name="OID">mqtt.0.ESP_Easy.Gaszähler.Total</field>
                    <field name="CONDITION">ne</field>
                    <field name="ACK_CONDITION"></field>
                    <statement name="STATEMENT">
                      <block type="update" id=";U_YCxKC8`kW/x:Pf2^f">
                        <mutation delay_input="false"></mutation>
                        <field name="OID">admin.0.Datenpunkte.Energie.Gaszähler.aktuell</field>
                        <field name="WITH_DELAY">FALSE</field>
                        <value name="VALUE">
                          <block type="math_arithmetic" id="/*4z_8{j*yU.mc*UHD4a">
                            <field name="OP">DIVIDE</field>
                            <value name="A">
                              <shadow type="math_number" id="_=F{;Hj`K5PXnG/@8?Kk">
                                <field name="NUM">1</field>
                              </shadow>
                              <block type="math_round" id="/F|ys`NU_tU9SX.i;;75">
                                <field name="OP">ROUND</field>
                                <value name="NUM">
                                  <shadow type="math_number" id="*0+clnLO~49o1Sk8(})Q">
                                    <field name="NUM">3.1</field>
                                  </shadow>
                                  <block type="math_arithmetic" id="GBaV#d-^I/FL8A}qyAxm">
                                    <field name="OP">ADD</field>
                                    <value name="A">
                                      <shadow type="math_number" id="_ip@-*v!b.Z{aIe/[;q4">
                                        <field name="NUM">1</field>
                                      </shadow>
                                      <block type="math_arithmetic" id="D!S~7^*yemymGKv|qr,M">
                                        <field name="OP">MULTIPLY</field>
                                        <value name="A">
                                          <shadow type="math_number" id="!%,K=_VNlA{uJx8JOhoT">
                                            <field name="NUM">1</field>
                                          </shadow>
                                          <block type="get_value" id="Xs9D=~/ldXt):|=!Y?@s">
                                            <field name="ATTR">val</field>
                                            <field name="OID">admin.0.Datenpunkte.Energie.Gaszähler.aktuell</field>
                                          </block>
                                        </value>
                                        <value name="B">
                                          <shadow type="math_number" id="KuIG{1oQ19d*g/x(RG7D">
                                            <field name="NUM">100</field>
                                          </shadow>
                                        </value>
                                      </block>
                                    </value>
                                    <value name="B">
                                      <shadow type="math_number" id="B~XKQ.av?6IL(]uaS]@+">
                                        <field name="NUM">1</field>
                                      </shadow>
                                    </value>
                                  </block>
                                </value>
                              </block>
                            </value>
                            <value name="B">
                              <shadow type="math_number" id="6,+@/5O*vU7u7isTD@x(">
                                <field name="NUM">0.01</field>
                              </shadow>
                              <block type="math_number" id="gaLsE_p2yz7)PLGI;b2Q">
                                <field name="NUM">100</field>
                              </block>
                            </value>
                          </block>
                        </value>
                      </block>
                    </statement>
                  </block>
                </xml>
                

                2019-02-14_1445.png

                1 Reply Last reply Reply Quote 0
                • M
                  markus397 last edited by

                  Danke nun hat der Import geklappt und es funktioniert prima.

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

                  Support us

                  ioBroker
                  Community Adapters
                  Donate

                  760
                  Online

                  31.9k
                  Users

                  80.2k
                  Topics

                  1.3m
                  Posts

                  4
                  7
                  823
                  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