Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Visualisierung
    4. (Gelöst) Absoluten Wert eines Objekts anzeigen

    NEWS

    • Neues Video "KI im Smart Home" - ioBroker plus n8n

    • Neues Video über Aliase, virtuelle Geräte und Kategorien

    • Wir empfehlen: Node.js 22.x

    (Gelöst) Absoluten Wert eines Objekts anzeigen

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

      @amg_666 Update : Ich hab das jetzt ans Laufen bekommen, allerdings über den Umweg eines alias.
      html widgt und da dann

      {wert:alias.0.testtest.value;Math.abs(wert)}
      

      zeigt mir den absoluten Betrag des Wertes an. Aber verstehen tue ich es nicht, beide Werte (DP und Alias) sind Zustandstyp "Zahl". Der originale Datenpunkt (funktioniert nicht) hat die Objektdaten

      {
        "_id": "mqtt.0.iot.smartmeter.sensor.1.obis.1-0:16.7.0.255.value",
        "common": {
          "name": "iot/smartmeter/sensor/1/obis/1-0:16.7.0/255/value",
          "write": true,
          "read": true,
          "role": "variable",
          "desc": "mqtt server variable",
          "type": "number",
          "custom": {
            "history.0": {
              "enabled": true
            }
          }
        },
        "native": {
          "topic": "iot/smartmeter/sensor/1/obis/1-0:16.7.0/255/value"
        },
        "type": "state",
        "acl": {
          "object": 1636,
          "state": 1636,
          "owner": "system.user.admin",
          "ownerGroup": "system.group.administrator"
        },
        "from": "system.adapter.admin.0",
        "user": "system.user.admin",
        "ts": 1716028810331
      }
      
      

      Der Alias (funktioniert) hat die 1:1 übernommen:

      {
        "type": "state",
        "common": {
          "name": "iot/smartmeter/sensor/1/obis/1-0:16.7.0/255/value",
          "role": "variable",
          "type": "number",
          "read": true,
          "write": true,
          "alias": {
            "id": "mqtt.0.iot.smartmeter.sensor.1.obis.1-0:16.7.0.255.value"
          },
          "custom": {
            "history.0": {
              "enabled": true
            }
          }
        },
        "_id": "alias.0.testtest.value",
        "native": {},
        "from": "system.adapter.admin.0",
        "user": "system.user.admin",
        "ts": 1716308213191,
        "acl": {
          "object": 1636,
          "state": 1636,
          "owner": "system.user.admin",
          "ownerGroup": "system.group.administrator"
        }
      }
      

      Hat hier jemand eine Idee, woran es liegen könnte? Ich kann da zwar so mit leben, aber schön ist irgendwie anders 😉

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

        @amg_666

        ginge:

        {wert:mqtt.0.iot.smartmeter.sensor.1.obis.1-0:16.7.0.255.value;wert<0 ? "-"+String(Math.abs(wert)):  "+"+String(Math.abs(wert))} 
        
        amg_666 1 Reply Last reply Reply Quote 0
        • jogibear9988
          jogibear9988 @amg_666 last edited by

          @amg_666

          Ist der orginale Wert vlt. vom Typ Zahl, aber als string gespeichert und enthält dann ein , statt einen . ?
          Das würde es erklären:

          b8e672ea-e3e0-47d1-9dc9-9b7935e2ccaa-image.png

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

            @liv-in-sky sagte in Absoluten Wert eines Objekts anzeigen:

            {wert:mqtt.0.iot.smartmeter.sensor.1.obis.1-0:16.7.0.255.value;wert<0 ? "-"+String(Math.abs(wert)): "+"+String(Math.abs(wert))}

            Nein, das spuckt in der vis "+NaN" aus

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

              @amg_666 vis 1 oder vis 2

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

                @jogibear9988 Wenn ich in die Objekte schau, dann ist das "type: number" (siehe auch oben die geposteten Objektdaten) und der Wert ist mit einem Punkt, kein Komma:
                Momentan z.B. -446.6

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

                  @amg_666

                  mal ne andere frage - warum machst du das - ein minus-wert wird doch als minus angezeigt - bei einem normalen binding ?

                  {mqtt.0.iot.smartmeter.sensor.1.obis.1-0:16.7.0.255.value}
                  

                  müßte doch reichen

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

                    @liv-in-sky Nee, wie oben geschrieben, ich hab diesen +/- thread genommen um zu schauen ob das überhaupt funktioniert (tut es nicht), was ich wirklich will ist "nur" den absoluten Wert darstellen, also z.B. 446 wenn es **-**446 sind.
                    Was ich also will ist Math.abs(xyz) als binding und das funktioniert jetzt bei mir nur mit Alias, nicht mit direktem DP

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

                      @amg_666 nochmal : vis1 oder vis2

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

                        @amg_666

                        {wert1:0_userdata.0.CONTROL-OWN.AAATEST.TestStart; Math.abs(wert1)  }
                        

                        vis1: bei mir geht das ohne probleme

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

                          @liv-in-sky vis1

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

                            @amg_666

                            was sagt den die entwicklungsumgebung von chrome, wenn du die seite refresht ?

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

                              @amg_666

                              falsche antwort

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

                                @liv-in-sky ich wll ja eigentlich "nur"

                                {wert:mqtt.0.iot.smartmeter.sensor.1.obis.1-0:16.7.0.255.value;Math.abs(wert)} 
                                

                                also ohne irgendwelche String Additionen, das funktioniert schon nicht.
                                Ich weiss nicht was genau aus Chrome ich hier posten soll, der html Quelltext liefert schon das "NaN":
                                2b2e0240-d364-4d74-8ae9-80ef820d50cd-grafik.png

                                Ich nutze auch eigentlich Firefox, habs jetzt in Chrome geladen, selbes Ergebnis (math.abs mit direktem Datenpunkt geht nicht, Math.abs mit Alias-Datenpunkt geht

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

                                  @amg_666

                                  du musst in den console tab gehen in den entwicklertools

                                  Image 040.png

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

                                    @amg_666 said in Absoluten Wert eines Objekts anzeigen:

                                    {wert:mqtt.0.iot.smartmeter.sensor.1.obis.1-0:16.7.0.255.value;Math.abs(wert)}

                                    was steht da wenn du es so machst (oder geht das bei vis überhaupt??)

                                     {wert:mqtt.0.iot.smartmeter.sensor.1.obis.1-0:16.7.0.255.value;wert}
                                    1 Reply Last reply Reply Quote 0
                                    • liv-in-sky
                                      liv-in-sky last edited by liv-in-sky

                                      also:

                                      nochmal getestet - das funktioniert bei mir damit:

                                      {wert11:0_userdata.0.CONTROL-OWN.AAATEST.TestStart; wert11 > 0 ? '+'+ String(Math.abs(wert11)) : '-' + String(Math.abs(wert11))}
                                      

                                      smiler12.gif

                                      mit dem alias geht das wahrscheinlich nur - weil du keine doppelpunkte in der object id haben darfst - ist ein fehler auf github und wurde nie repariert

                                      da ist der fehler drin vor 0:16

                                      .1.obis.1-0:16.7.
                                      
                                      amg_666 1 Reply Last reply Reply Quote 2
                                      • amg_666
                                        amg_666 @liv-in-sky last edited by

                                        @liv-in-sky sagte in Absoluten Wert eines Objekts anzeigen:

                                        weil du keine doppelpunkte in der object id haben darfst

                                        Dann ist das die Antwort, die ich gesucht habe (die ich aber nicht hören will 🙂 )
                                        Die mqtt Datenpunkte kommen von einem Lesekopf für meinen Smartmeter, da kann ich am Namen nichts anpassen, also muss ich wohl mit dem Alias leben.

                                        Danke an alle

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

                                        Support us

                                        ioBroker
                                        Community Adapters
                                        Donate

                                        1.0k
                                        Online

                                        32.1k
                                        Users

                                        80.7k
                                        Topics

                                        1.3m
                                        Posts

                                        5
                                        25
                                        880
                                        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