Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Blockly zwei Variablen addieren

    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

    UNSOLVED Blockly zwei Variablen addieren

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

      Bin blutiger Anfänger und möchte einfach zwei Variablen addieren. Wie kann ich das machen? So weit bin ich:

      var Solar_Gesamt;

      Solar_Gesamt = getState("fronius.0.inverter.1.PAC").val + getState("fronius.1.inverter.1.PAC").val;

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

        Habst gelöst:

        const idEZWR1 = 'fronius.0.inverter.1.PAC';
        const idEZWR2 = 'fronius.1.inverter.1.PAC';
        const idSumme = 'javascript.0.Solar.Summe';
        
        var EZWR1 = getState(idEZWR1).val;
        var EZWR2 = getState(idEZWR2).val;
        
        if(!existsState(idSumme)) createState(idSumme, EZWR1 + EZWR2, {type: 'number', unit: 'W'}); 
         
        function summe() {
            setState(idSumme, EZWR1 + EZWR2, true);
        }
        
        on(idEZWR1, function(dp) {
           EZWR1 = dp.state.val;
           summe();
        });
        on(idEZWR2, function(dp) {
           EZWR2 = dp.state.val;
           summe();
        });
        
        paul53 1 Reply Last reply Reply Quote 0
        • paul53
          paul53 @Maunty last edited by

          @maunty sagte: Habst gelöst:

          Das sieht aber nicht nach Blockly aus.

          M 1 Reply Last reply Reply Quote 0
          • M
            Maunty @paul53 last edited by Maunty

            @paul53 Ja sorry, mit Blockly komme ich (noch) nicht zurecht

            Asgothian 1 Reply Last reply Reply Quote 0
            • Asgothian
              Asgothian Developer @Maunty last edited by

              @maunty sagte in Blockly zwei Variablen addieren:

              @paul53 Ja sorry, mit Blockly komme ich (noch) nicht zurecht

              Wenn du das so elegant mit JS lösen kannst, warum willst Du dann auf Blockly wechseln ?

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

                Er übt für Blockly 😊

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

                Support us

                ioBroker
                Community Adapters
                Donate

                842
                Online

                31.9k
                Users

                80.1k
                Topics

                1.3m
                Posts

                4
                6
                331
                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