Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Praktische Anwendungen (Showcase)
    4. Kaco Blueplanet Wechselrichter (FW 3.2) auslesen

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Kaco Blueplanet Wechselrichter (FW 3.2) auslesen

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

      Hey All,

      nachdem das Auslesen meines Wechselrichters Kaco blueplanet 3,7 TL1 per modbus wegen timeouts und auch so unzuverlässigkeit gescheitert ist habe ich mich entschieden mal zu schauen was der Webserver des Kaco so hergibt. Ich habe Software Version 3.26

      Daraus sind zwei Skripte entstanden, da es einmal ein CSV-File gibt was alle 5 Minuten Daten enthält und vom Webserver für das Diagramm genutzt wird. Vorteil: hier ist der Gesamt-Tages-Ertrag drin.

      Mein Kaco hat zwei DC-Generatoren und eine AC Phase … Ich denke das die CSV-Files bei anderen Konfigurationen leicht anders aussehen. ABer da unterstütze ich gern.

      Skript zum Auslesen:

      var request = require('request');
      
      var kaco_ip = '192.168.x.y'; // IP des Kaco Wechselrichters, Webservers muss aktiv sein
      
      // Uhrzeit;Udc1[V];Idc1[A];Pdc1[W];Udc2[V];Idc2[A];Pdc2[W];Uac1[V];Iac1[A];Pdc[W];Pac[W];Tsys[°C]
      
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Zeitpunkt', 0, {type: 'number', role: 'value.time'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Generatorspannung1', 0, {type: 'number', role: 'value', unit: 'V'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Generatorstrom1', 0, {type: 'number', role: 'value', unit: 'A'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Generatorleistung1', 0, {type: 'number', role: 'value', unit: 'W'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Generatorspannung2', 0, {type: 'number', role: 'value', unit: 'V'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Generatorstrom2', 0, {type: 'number', role: 'value', unit: 'A'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Generatorleistung2', 0, {type: 'number', role: 'value', unit: 'W'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Netzspannung', 0, {type: 'number', role: 'value', unit: 'V'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Netzstrom', 0, {type: 'number', role: 'value', unit: 'A'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.NetzleistungDC', 0, {type: 'number', role: 'value', unit: 'W'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.NetzleistungAC', 0, {type: 'number', role: 'value', unit: 'W'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Gerätetemperatur', 0, {type: 'number', role: 'value', unit: '°C'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Ertrag', 0, {type: 'number', role: 'value', unit: 'kWh'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.ErtragCounter', 0, {type: 'number', role: 'value', unit: 'kWh'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.ErtragBaseValue', 0, {type: 'number', role: 'value', unit: 'kWh'});
      
      schedule("59 23 * * *", function() {
          setTimeout(function() {
              var ertragcounter = getState('javascript.'+instance+'.Photovoltaik.Kaco.ErtragCounter').val;
              setState('javascript.'+instance+'.Photovoltaik.Kaco.ErtragBaseValue', ertragcounter);
          }, 30000);
      });
      
      schedule("* * * * *", function() { // Minütlich auslesen
          var url = 'http://' + kaco_ip + '/';
      
          var d = new Date();
          url+=d.getFullYear();
          var m = d.getMonth()+1;
          if (m<10) url+='0';
          url+=m;
          var da=d.getDate();
          if (da<10) url+='0';
          url+=da;
          url+='.CSV';
      
          request(url, function (error, response, body) {
              if (!error && body) {
                  var lines = body.split('\r');
                  var last_line_index = lines.length-1;
                  while (lines[last_line_index] === '' && last_line_index > 2) last_line_index--;
                  if (last_line_index>2) {
                      var last_line_arr = lines[last_line_index].split(';');
                      //console.log(JSON.stringify(last_line_arr));
                      var time_arr = last_line_arr[0].split(':');
                      d.setHours(time_arr[0]);
                      d.setMinutes(time_arr[1]);
                      d.setSeconds(time_arr[2]);
                      d.setMilliseconds(0);
      
                      var lastState = getState('javascript.'+instance+'.Photovoltaik.Kaco.NetzleistungAC');
                      //console.log('Last=' + lastState.ts + ', New=' + d.getTime());
                      if (d.getTime() > lastState.ts) {
                          //["21:35:24","286.4","0.00","0","39.7","0.00","0","229.3","0.00","0","0","37.3"]
                          setState('javascript.'+instance+'.Photovoltaik.Kaco.Zeitpunkt', d.getTime(), true);
                          setState('javascript.'+instance+'.Photovoltaik.Kaco.Generatorspannung1', parseFloat(last_line_arr[1]), true);
                          setState('javascript.'+instance+'.Photovoltaik.Kaco.Generatorstrom1', parseFloat(last_line_arr[2]), true);
                          setState('javascript.'+instance+'.Photovoltaik.Kaco.Generatorleistung1', parseFloat(last_line_arr[3]), true);
                          setState('javascript.'+instance+'.Photovoltaik.Kaco.Generatorspannung2', parseFloat(last_line_arr[4]), true);
                          setState('javascript.'+instance+'.Photovoltaik.Kaco.Generatorstrom2', parseFloat(last_line_arr[5]), true);
                          setState('javascript.'+instance+'.Photovoltaik.Kaco.Generatorleistung2', parseFloat(last_line_arr[6]), true);
                          setState('javascript.'+instance+'.Photovoltaik.Kaco.Netzspannung', parseFloat(last_line_arr[7]), true);
                          setState('javascript.'+instance+'.Photovoltaik.Kaco.Netzstrom', parseFloat(last_line_arr[8]), true);
                          setState('javascript.'+instance+'.Photovoltaik.Kaco.NetzleistungDC', parseFloat(last_line_arr[9]), true);
                          setState('javascript.'+instance+'.Photovoltaik.Kaco.NetzleistungAC', parseFloat(last_line_arr[10]), true);
                          setState('javascript.'+instance+'.Photovoltaik.Kaco.Gerätetemperatur', parseFloat(last_line_arr[11]), true);
      
                          var ertrag_line = lines[1].split(';');
                          setState('javascript.'+instance+'.Photovoltaik.Kaco.Ertrag', parseFloat(ertrag_line[4]), true);
                          var ertragbasevalue = getState('javascript.'+instance+'.Photovoltaik.Kaco.ErtragBaseValue').val;
                          setState('javascript.'+instance+'.Photovoltaik.Kaco.ErtragCounter', ertragbasevalue + parseFloat(ertrag_line[4]), true);
                      }
                  }
              }
          });
      });
      

      Als zweites gibt es ein "realtime.csv" welches faktisch Sekündlich verfügbar ist und die aktuellen Daten aus enthält (aber halt nicht den Gesamt-Ertrag). Ich nutze daher beide 🙂

      Skript zum Auslesen:

      var request = require('request');
      
      var kaco_ip = '192.168.x.y'; // IP des Kaco Wechselrichters, Webservers muss aktiv sein
      
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Zeitpunkt', 0, {type: 'number', role: 'value.time'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Generatorspannung1', 0, {type: 'number', role: 'value', unit: 'V'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Generatorspannung2', 0, {type: 'number', role: 'value', unit: 'V'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Netzspannung', 0, {type: 'number', role: 'value', unit: 'V'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Generatorstrom1', 0, {type: 'number', role: 'value', unit: 'A'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Generatorstrom2', 0, {type: 'number', role: 'value', unit: 'A'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Netzstrom', 0, {type: 'number', role: 'value', unit: 'A'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Netzleistung', 0, {type: 'number', role: 'value', unit: 'W'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Gerätetemperatur', 0, {type: 'number', role: 'value', unit: '°C'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Generatorleistung1', 0, {type: 'number', role: 'value', unit: 'W'});
      createState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Generatorleistung2', 0, {type: 'number', role: 'value', unit: 'W'});
      
      request('http://' + kaco_ip + '/pstadeDE.txt', function (error, response, body) {
          var statesList = '';
          if (!error && body) {
              var lines = body.split('\r');
      		for (var x = 0; x < lines.length; x++) {
                  var entry = lines[x].split('  ');
                  statesList+=entry[0].trim() + ':' + entry[1].trim();
                  if (x < lines.length -1) statesList+=';';
              }
          }
          var stateDef = {type: 'number', role: 'value'};
          if (statesList !== '') {
              stateDef.states = statesList;
          }
          //console.log(JSON.stringify(stateDef));
          createState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Status', 0, stateDef);
      });
      
      /*
      https://forum.fhem.de/index.php?topic=26071.0
      
      0:1496398468; * 1000 new Date
      1:18365; t=1 DCGen1 Spannung V  $val / (65535.0 / 1600.0)
      2:0;     t=2 DCGen2 Spannung V  $val / (65535.0 / 1600.0)
      3:9384;  ACGen1? Spannung V     $val / (65535.0 / 1600.0)
      4:734;   t=1 DCGen1 Strom A     $val / (65535.0 / 200.0)
      5:0;     t=2 DCGen2 Strom A     $val / (65535.0 / 200.0)
      6:1417;  AC gen Strom? A        $val / (65535.0 / 200.0)
      7:642;   IN W                   $val / (65535.0 / 100000.0)
      8:3627;  TEMP                   $val / 100.0
      9:4      STATUS
      */
      
      setInterval(function() {
          request('http://' + kaco_ip + '/realtime.csv', function (error, response, body) {
              if (!error && body) {
                  var data = body.split(';');
                  setState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Zeitpunkt', parseInt(data[0], 10)*1000, true);
                  setState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Generatorspannung1', parseInt(data[1], 10) / (65535.0 / 1600.0), true);
                  setState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Generatorspannung2', parseInt(data[2], 10) / (65535.0 / 1600.0), true);
                  setState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Netzspannung', parseInt(data[3], 10) / (65535.0 / 1600.0), true);
                  setState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Generatorstrom1', parseInt(data[4], 10) / (65535.0 / 200.0), true);
                  setState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Generatorstrom2', parseInt(data[5], 10) / (65535.0 / 200.0), true);
                  setState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Netzstrom', parseInt(data[6], 10) / (65535.0 / 200.0), true);
                  setState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Netzleistung', parseInt(data[7], 10) / (65535.0 / 100000.0), true);
                  setState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Gerätetemperatur', parseInt(data[8], 10) / 100.0, true);
                  setState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Status', parseInt(data[9], 10), true);
      
                  setState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Generatorleistung1', parseInt(data[1], 10) / (65535.0 / 1600.0) * parseInt(data[4], 10) / (65535.0 / 200.0), true);
                  setState('javascript.'+instance+'.Photovoltaik.Kaco.Realtime.Generatorleistung2', parseInt(data[2], 10) / (65535.0 / 1600.0) * parseInt(data[5], 10) / (65535.0 / 200.0), true);
              }
          });
      }, 10000);
      
      

      Vielleicht hilft es jemandem 🙂

      Ingo

      R 1 Reply Last reply Reply Quote 0
      • apollon77
        apollon77 last edited by

        Reserve für Changelog und so

        1 Reply Last reply Reply Quote 0
        • S
          Schimi last edited by

          HI,

          ich bekomme "in Zukunft" so wie es aussieht auch einen KACO....

          funktioniert es noch einwandfrei bei dir?

          Für Fronius gibt es ja einen Adapter...

          1 Reply Last reply Reply Quote 0
          • R
            ragu @apollon77 last edited by

            @apollon77

            Hallo

            Super Arbeit.
            Läuft einwandfrei.
            Habe noch ein Script geschrieben um den Gesamtertrag auszulesen.

            var request = require('request');
             
            var kaco_ip = '192.168.x.x'; // IP des Kaco Wechselrichters, Webservers muss aktiv sein
             
            
            createState('javascript.'+instance+'.Photovoltaik.Kaco.GesamtErtrag', 0, {type: 'number', role: 'value', unit: 'kWh'});
            
            schedule("59 23 * * *", function() {
                setTimeout(function() {
                    var ertragcounter = getState('javascript.'+instance+'.Photovoltaik.Kaco.ErtragCounter').val;
                    setState('javascript.'+instance+'.Photovoltaik.Kaco.ErtragBaseValue', ertragcounter);
                }, 60000);
            });
             
            schedule("* * * * *", function() { // Minütlich auslesen
                var url = 'http://' + kaco_ip + '/eternal.CSV';
             
               
             
                request(url, function (error, response, body) {
                    if (!error && body) {
                        var lines = body.split('\r');
                               
                                var ertrag_line = lines[1].split(';');
                                setState('javascript.'+instance+'.Photovoltaik.Kaco.GesamtErtrag', parseFloat(ertrag_line[4]), true);
                     
                    }
                });
            
            1 Reply Last reply Reply Quote 0
            • C
              cheese2203 last edited by

              @apollon77 Bei mir werden die Zeitpunkte immer falsch angezeigt weißt du woran das liegen kann? ich habe einen Kaco blueplanet 5.0 TL3

              apollon77 1 Reply Last reply Reply Quote 0
              • apollon77
                apollon77 @cheese2203 last edited by

                @cheese2203 Logge doch mal die Daten die drin stehen. Vllt ist ja die Uhr vom gerät falsch gestellt 🙂

                C 1 Reply Last reply Reply Quote 0
                • C
                  cheese2203 @apollon77 last edited by

                  @apollon77 😵 hattest recht war falsch gestellt 😂 😂

                  Eine Frage noch gibt es die Möglichkeit den Monats und Jahresertrag noch mit in das Script einzubauen? Ich kenne mich leider mit JavaScript noch gar nicht aus.

                  1 Reply Last reply Reply Quote 0
                  • S
                    Schimi last edited by

                    funktioniert beim 10 TL3 und 5 TL3 mit jeweils 5.53 Firmware ganz gut....

                    Falls jemand mir trotzdem beim ModBus helfen kann....
                    https://forum.iobroker.net/topic/42163/kaco-wechselrichter-und-modbus

                    1 Reply Last reply Reply Quote 0
                    • A
                      AndreasE112 last edited by

                      Hallo, hab die beiden Scripte gerade eingebunden. Leider bekomme ich bei der realtime keine Werte... hat jemand eine Idee woran das liegen könnte?

                      1 Reply Last reply Reply Quote 0
                      • A
                        AndreasE112 last edited by AndreasE112

                        wenn ich die besagte txt im browser öffne steht das hier drin ( sieht wie eine Beschreibung des WR Status aus)

                        1 Reply Last reply Reply Quote 0
                        • A
                          AndreasE112 last edited by

                          @andrease112
                          Hallo nochmal, ich habe das script für die Realtime angepasst. Es läuft jetzt einigermaßen... leider finde ich die Generatorleistungen nicht... Bei mir sieht die Realtime csv so aus:

                          0.) Zeitstempel

                          (in Sekunden vom 01.01.1970) 1632416155
                          * 1.) DC-Spannung [V] (2 bzw. 3 Werte) 15197
                          * 2.) 9142
                          * 3.) AC-Spannung [V] (3 Werte) 9474
                          * 4.) 9546
                          * 5.) 9547
                          * 6.) DC-Strom [A] (2 bzw. 3 Werte) 193
                          * 7.) 628
                          * 8.) AC-Strom [A] (3 Werte) 368
                          * 9.) 363
                          * 10.) 357
                          * 11.) AC-Leistung [W] 389
                          * 12.) Systemtemperatur [°C] 4550
                          * 13.) Wechselrichterstatus 4

                          S 1 Reply Last reply Reply Quote 0
                          • S
                            Schimi @AndreasE112 last edited by

                            @andrease112
                            Hast du nal ddn zugriff über Modbus versuch?

                            1 Reply Last reply Reply Quote 0
                            • A
                              AndreasE112 last edited by

                              nee läuft das über den normalen Modbus adapter ?

                              A 1 Reply Last reply Reply Quote 0
                              • A
                                AndreasE112 @AndreasE112 last edited by

                                @andrease112 also der Modbus Adapter läuft jetzt aber wie stelle ich das da alles ein ? gibt es dazu eine Anleitung

                                A 1 Reply Last reply Reply Quote 0
                                • A
                                  AndreasE112 @AndreasE112 last edited by

                                  naja ich hab da mal die IP vom WR eingetragen und Port auf 502 belassen und Master ausgewählt .
                                  Der Adapter bleibt gelb.

                                  zur HW: Der WR ist nur über Ethernet an der Fritzbox angeschlossen. Reicht das ? Ich dachte immer Modbus ist RS485.
                                  Wikipedia hat mich aufgeklärt.

                                  muss ich sonst noch was beachten

                                  A 1 Reply Last reply Reply Quote 0
                                  • A
                                    AndreasE112 @AndreasE112 last edited by

                                    Achso die Schnittstelle hab im im WR aktiviert. PORT passt an der Stelle auch

                                    1 Reply Last reply Reply Quote 0
                                    • A
                                      AndreasE112 last edited by

                                      So Adapter ist grün, und bleibt grün, aber lesen tut er nichts....

                                      1 Reply Last reply Reply Quote 0
                                      • S
                                        Schimi last edited by

                                        Ja mit dem "normalem" Modbus Adapter....

                                        Da steht im grunde alles....

                                        https://forum.iobroker.net/topic/42163/kaco-wechselrichter-und-modbus/29

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

                                        Support us

                                        ioBroker
                                        Community Adapters
                                        Donate

                                        950
                                        Online

                                        31.7k
                                        Users

                                        79.7k
                                        Topics

                                        1.3m
                                        Posts

                                        5
                                        18
                                        3508
                                        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