Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. [Gelöst] Funktion mit der man Eingangswert multiplizieren kann

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    [Gelöst] Funktion mit der man Eingangswert multiplizieren kann

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

      Hallo ich bin neu hier im Forum und bei der Benutzung mit Node-Red.

      Ich würde mir gerne mein Eingangswert *10 multiplizieren und wenn es geht noch das Ergebnis auf ganze Zahlen runden. Vor das ganze muss allerdings auch noch ein TargetPosition damit die Homekit-node das ganze auch erkennt.Das habe ich schon hin bekommen. Die Funktion sieht momentan so aus :

      {"TargetPosition": {{payload}}}
      

      Wäre toll wenn mir jemand helfen könnte!

      Gruß Tobi

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

        Hallo Tobi,

        ich habe es mir wie folgt zusammenkopier 🙂

        Vielleicht hilft dir das.

        im function Node musst du natürlich noch

        var preis = 0.2418

        gegen

        var preis = 10 tauschen

        [
            {
                "id": "f040aeb7.c0f",
                "type": "debug",
                "z": "54dc610c.f1c2c",
                "name": "",
                "active": false,
                "console": "false",
                "complete": "payload",
                "x": 828.0002593994141,
                "y": 1208.0002346038818,
                "wires": []
            },
            {
                "id": "cdc81735.b67048",
                "type": "function",
                "z": "54dc610c.f1c2c",
                "name": "Verbraucht mit Preis multiplizieren",
                "func": "\nvar preis = 0.2418;\n\n//ausgabe   =  in float wandeln         mal  variable   auf 2 Stellen nachkomma\nmsg.payload = (parseFloat(msg.payload)  *   preis)    .toFixed(2);\n\n\nreturn msg;",
                "outputs": 1,
                "noerr": 0,
                "x": 542.0001602172852,
                "y": 1215.3334112167358,
                "wires": [
                    [
                        "f040aeb7.c0f",
                        "641cf068.a19c9"
                    ]
                ]
            },
            {
                "id": "9c88ec54.6fcd3",
                "type": "inject",
                "z": "54dc610c.f1c2c",
                "name": "",
                "topic": "",
                "payload": "true",
                "payloadType": "bool",
                "repeat": "60",
                "crontab": "",
                "once": false,
                "x": 118.00003814697266,
                "y": 1219.6667432785034,
                "wires": [
                    [
                        "c8b3a4ed.fe1a98"
                    ]
                ]
            },
            {
                "id": "c8b3a4ed.fe1a98",
                "type": "ioBroker get",
                "z": "54dc610c.f1c2c",
                "name": "Zahelerstand_Strom_heute",
                "topic": "admin.0.Eigene_Objekte.Verbrauch.Zahelerstand_Strom_heute",
                "attrname": "payload",
                "payloadType": "value",
                "x": 281.0001220703125,
                "y": 1278.3334064483643,
                "wires": [
                    [
                        "cdc81735.b67048"
                    ]
                ]
            },
            {
                "id": "641cf068.a19c9",
                "type": "ioBroker out",
                "z": "54dc610c.f1c2c",
                "name": "Zaelherstand_Strom_heute_EURO",
                "topic": "admin.0.Eigene_Objekte.Verbrauch.Zaelherstand_Strom_heute_EURO",
                "ack": "false",
                "autoCreate": "false",
                "x": 779.0000228881836,
                "y": 1278.0000839233398,
                "wires": []
            },
            {
                "id": "e7f4b902.0c1ef8",
                "type": "comment",
                "z": "54dc610c.f1c2c",
                "name": "Tagesverbrauch in EURO ermitteln",
                "info": "",
                "x": 179.99996948242188,
                "y": 1172.3332934379578,
                "wires": []
            }
        ]
        
        1 Reply Last reply Reply Quote 0
        • T
          ToB204 last edited by

          Super hat funktioniert ! Danke!

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

          Support us

          ioBroker
          Community Adapters
          Donate

          557
          Online

          31.7k
          Users

          79.8k
          Topics

          1.3m
          Posts

          2
          3
          3155
          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