Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Visualisierung
    4. Bindings in vis

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Bindings in vis

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

      Hallo,

      Rundungen in Bindings scheinen knifflig zu sein. Die Funktion round(x, y) funktioniert nicht.

      DP(type: number): 0_userdata.0.a = 1.2

      Binding:
      {a:0_userdata.0.a;Math.round(parseFloat(a)/10,2)}

      Ergebnis im Widget: 0 (erwartet: 0.12 bzw. 0,12)

      Vis Version: v1.4.15

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

        @ocio

        keine kommas sondern punkte bei /10.2 verwenden - nicht 10,2

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

          @liv-in-sky Danke für das feedback, aber das Komma trennt die zwei Argumente der round(x,y) Funktion, x der wert (a/10), y (=2) die Dezimalstellen.

          liv-in-sky 2 Replies Last reply Reply Quote 0
          • liv-in-sky
            liv-in-sky @ocio last edited by

            @ocio

            ???? was passiert, wenn du ,2 wegnimmst

            https://www.techonthenet.com/js/math_round.php

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

              @ocio sagte in Bindings in vis:

              @liv-in-sky Danke für das feedback, aber das Komma trennt die zwei Argumente der round(x,y) Funktion, x der wert (a/10), y (=2) die Dezimalstellen.

              zwei dezimalstellen sollte so sein
              {a:0_userdata.0.a;Math.round(parseFloat(a)/10*100)/100}

              script-vis1.gif

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

                @liv-in-sky Danke, sehe jetzt meinen Fehler, round(x,y) gibt es in nicht in js 🤦‍♂️

                liv-in-sky OliverIO 2 Replies Last reply Reply Quote 1
                • liv-in-sky
                  liv-in-sky @ocio last edited by

                  @ocio

                  nur nebenbei:
                  wenn man die runtime in chrome öffnet, kann man die entwicklertools öffnen und unter dem tab console die fehler ansehen, die bei einem refresh der seite kommen - manchmal hilft das. um binding fehler zu finden

                  1 Reply Last reply Reply Quote 0
                  • OliverIO
                    OliverIO @ocio last edited by

                    @ocio sagte in Bindings in vis:

                    @liv-in-sky Danke, sehe jetzt meinen Fehler, round(x,y) gibt es in nicht in js 🤦‍♂️

                    Eigentlich schon
                    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round?retiredLocale=de

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

                      @oliverio

                      ???

                      ich sehe dort nicht, dass es eine function math.round gibt, bei der man 2 werte übergibt

                      Math.round(x,y) 
                      
                      OliverIO 1 Reply Last reply Reply Quote 0
                      • OliverIO
                        OliverIO @liv-in-sky last edited by

                        @liv-in-sky
                        Ja mit 2 werten nicht.
                        Der korrekte Befehl wäre
                        https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed?retiredLocale=de

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

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        989
                        Online

                        31.7k
                        Users

                        79.7k
                        Topics

                        1.3m
                        Posts

                        vis
                        17
                        81
                        11491
                        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