Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. Kostal Wechselrichter mit Firmware 3.71

    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

    Kostal Wechselrichter mit Firmware 3.71

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

      Hier nochmal das bisherige Script in Code-Tags:

      
       
       
      // Photovoltaik: Piko 5.5 Anlage (alte Firmware)
       // Danke an homoran für den regex
       // @bahnuhr; 03/2019 Dieter Müller
        
       //Variaben
           var idaktuell = 'javascript.0.Photovoltaik.Leistung_aktuell';
           var idTag = 'javascript.0.Photovoltaik.Tagesleistung';
           var idall = 'javascript.0.Photovoltaik.Leistung_gesamt';
           var idP1 = 'javascript.0.Photovoltaik.Leistung_Strang1';
           var idP2 = 'javascript.0.Photovoltaik.Leistung_Strang2';
        
           var NameAnlage = 'pvserver';        // Nutzername der Photovoltaik-Anlage
           var PassAnlage = 'pvwr';         // Password der Photovoltaik-Anlage
           var IPAnlage = '192.168.176.211';    // IP der Photovoltaik-Anlage
        
           var logging = false;
           var request = require('request');
        
        
        function Piko() {
           log("Piko 10.1 auslesen");
           var results = [];
           request('http://' + NameAnlage + ':' + PassAnlage +'@' + IPAnlage, function (error, response, body) {
               var d = body.toString();
               if (logging) log (d);
               var reg = /#FFFFFF">[^\d]+([^<]+)/g
               var z = reg.exec(d);
        
               while(z != null) {
                   if (isNaN(z[1])) {
                       if (logging) log("keine Zahl= "+ z[1]);
                       z[1] = 0;
                   } else {
                       if (logging) log("Zahl= "+ z[1]);
                       parseFloat(z[1]);
                   }
                   results[results.length] = z[1];
                   z = reg.exec(d);
                   log (z[1]);
               }
               if (logging) log("results= "+ results);
        
           // Werte zuordnen
               var pwr = results[0];           // Energie aktuell in W
               var day = results[2];           // Tagesenergie in kWh
               var all = results[1];           // Gesamtenergie in kWh
               var v1 = results[3];            // PV Generator Nr. 1 - Spannung in V
               var i1 = results[5];            // PV Generator Nr. 1 - Strom in A
               var p1 = parseInt(v1 * i1);
               var v2 = results[7];            // PV Generator Nr. 2 - Spannung in V
               var i2 = results[9];            // PV Generator Nr. 2 - Strom in A
               var p2 = parseInt(v2 * i2);
        
               if (logging) log("Leistung aktuell= " + pwr + " W");
               if (logging) log("Tagesleistung= " + day + " kWh");
               if (logging) log("Leistung gesamt= " + all + " kWh");
       	     if (logging) log("Leistung Strang 1= " + p1 + " W");
           	 if (logging) log("Leistung Strang 2= " + p2 + " W");
        
               setState(idaktuell, parseFloat(pwr));
               setState(idTag, parseFloat(day));
               setState(idall, parseFloat(all));
               setState(idP1, parseFloat(p1));
               setState(idP2, parseFloat(p2));
           });
       }
        
        
       schedule("2,7,12,17,22,27,32,37,42,47,52,57 * * * *", function () {
           log ("Auslöser: Schedule");
       	Piko();
       });
        
       schedule("3 0 * * *", function () {     // Variablen löschen um 00:03 Uhr   
           setState('javascript.0.Photovoltaik.Tagesleistung', 0);
       });
        
       
      
      
      
      1 Reply Last reply Reply Quote 0
      • Homoran
        Homoran Global Moderator Administrators @dbox83 last edited by

        @dbox83 ok!
        mal sehen ob @bahnuhr hier nochmal reinsieht.
        ich muss das nämlich alles trocken am Handy machen und habe von js keine Ahnung.

        D 1 Reply Last reply Reply Quote 0
        • D
          dbox83 @Homoran last edited by

          @homoran

          Danke Dir schonmal.

          Lass das aber erstmal. Es eilt mir nicht.

          Ich hoffe einfach dass @bahnuhr nochmal reinschaut und seinen code postet.

          Viele Grüße

          bahnuhr Homoran 2 Replies Last reply Reply Quote 0
          • bahnuhr
            bahnuhr Forum Testing Most Active @dbox83 last edited by bahnuhr

            @dbox83
            @Homoran

            Na klar, ich lese hier fleißig mit:

            Im Script befindet sich folgendes:

                     var v1 = results[3];            // PV Generator Nr. 1 - Spannung in V
                     var i1 = results[5];            // PV Generator Nr. 1 - Strom in A
                     var p1 = parseInt(v1 * i1);
                     var v2 = results[7];            // PV Generator Nr. 2 - Spannung in V
                     var i2 = results[9];            // PV Generator Nr. 2 - Strom in A
                     var p2 = parseInt(v2 * i2);
            

            Wenn dies funktioniert, dann vielleicht wie folgt erweitern:

                     var v3 = results[11];            // PV Generator Nr. 3 - Spannung in V
                     var i3 = results[13];            // PV Generator Nr. 3 - Strom in A
                     var p3 = parseInt(v3 * i3);
            

            Habs nicht getestet (weil bei mir nicht notwendig).
            Und weiter unten dann logisch noch log und setstate erweitern.

            Bitte probieren.

            Homoran 1 Reply Last reply Reply Quote 1
            • Homoran
              Homoran Global Moderator Administrators @dbox83 last edited by

              @dbox83 im prinzip musst du die Variablen p1,p2 um p3 erweitern das Array hat bei dir weitete Einträge.
              leider kann ich dir die Zahlen nicht zuordnen, da ichbzwar den quelltext, aber ichtvdie zugehörige Maske mit den Werten sehe.

              im prinzip sind v1, i1 das 3. und 5. Element, v2,i2 das 7. und 9. Elemrnt, dann müssten v3 und i3 das 11. und 13. Element sein.

              warum @Bahnuhr rechnet obwohl W auch in der Ausgabe vorkommt, weiß ich nicht mehr. kann sein, dass es DC Werte sind undcer AC rechnet.

              mein problem ist, dass unter regex101.com dauernd der Zwischenspeicher gelöscht wird, wenn ich hier schreibe

              bahnuhr 1 Reply Last reply Reply Quote 0
              • Homoran
                Homoran Global Moderator Administrators @bahnuhr last edited by

                @bahnuhr danke, passt zu meiner Theorie

                D 1 Reply Last reply Reply Quote 0
                • D
                  dbox83 @Homoran last edited by

                  Ich habe jetzt mal so erweitert:

                  
                   
                   
                  // Photovoltaik: Piko 5.5 Anlage (alte Firmware)
                   // Danke an homoran für den regex
                   // @bahnuhr; 03/2019 Dieter Müller
                    
                   //Variaben
                       var idaktuell = 'javascript.0.Photovoltaik.Leistung_aktuell';
                       var idTag = 'javascript.0.Photovoltaik.Tagesleistung';
                       var idall = 'javascript.0.Photovoltaik.Leistung_gesamt';
                       var idP1 = 'javascript.0.Photovoltaik.Leistung_Strang1';
                       var idP2 = 'javascript.0.Photovoltaik.Leistung_Strang2';
                    
                       var NameAnlage = 'pvserver';        // Nutzername der Photovoltaik-Anlage
                       var PassAnlage = 'pvwr';         // Password der Photovoltaik-Anlage
                       var IPAnlage = '192.168.176.211';    // IP der Photovoltaik-Anlage
                    
                       var logging = false;
                       var request = require('request');
                    
                    
                    function Piko() {
                       log("Piko 10.1 auslesen");
                       var results = [];
                       request('http://' + NameAnlage + ':' + PassAnlage +'@' + IPAnlage, function (error, response, body) {
                           var d = body.toString();
                           if (logging) log (d);
                           var reg = /#FFFFFF">[^\d]+([^<]+)/g
                           var z = reg.exec(d);
                    
                           while(z != null) {
                               if (isNaN(z[1])) {
                                   if (logging) log("keine Zahl= "+ z[1]);
                                   z[1] = 0;
                               } else {
                                   if (logging) log("Zahl= "+ z[1]);
                                   parseFloat(z[1]);
                               }
                               results[results.length] = z[1];
                               z = reg.exec(d);
                               log (z[1]);
                           }
                           if (logging) log("results= "+ results);
                    
                       // Werte zuordnen
                           var pwr = results[0];           // Energie aktuell in W
                           var day = results[2];           // Tagesenergie in kWh
                           var all = results[1];           // Gesamtenergie in kWh
                           var v1 = results[3];            // PV Generator Nr. 1 - Spannung in V
                           var i1 = results[5];            // PV Generator Nr. 1 - Strom in A
                           var p1 = parseInt(v1 * i1);
                           var v2 = results[7];            // PV Generator Nr. 2 - Spannung in V
                           var i2 = results[9];            // PV Generator Nr. 2 - Strom in A
                           var p2 = parseInt(v2 * i2);
                           var v3 = results[11];            // PV Generator Nr. 3 - Spannung in V
                           var i3 = results[12];            // PV Generator Nr. 3 - Strom in A
                           var p3 = parseInt(v3 * i3);
                  
                           if (logging) log("Leistung aktuell= " + pwr + " W");
                           if (logging) log("Tagesleistung= " + day + " kWh");
                           if (logging) log("Leistung gesamt= " + all + " kWh");
                   	     if (logging) log("Leistung Strang 1= " + p1 + " W");
                       	 if (logging) log("Leistung Strang 2= " + p2 + " W");
                           if (logging) log("Leistung Strang 3= " + p3 + " W");
                           setState(idaktuell, parseFloat(pwr));
                           setState(idTag, parseFloat(day));
                           setState(idall, parseFloat(all));
                           setState(idP1, parseFloat(p1));
                           setState(idP2, parseFloat(p2));
                           setState(idP3, parseFloat(p3));
                       });
                   }
                    
                    
                   schedule("2,7,12,17,22,27,32,37,42,47,52,57 * * * *", function () {
                       log ("Auslöser: Schedule");
                   	Piko();
                   });
                    
                   schedule("3 0 * * *", function () {     // Variablen löschen um 00:03 Uhr   
                       setState('javascript.0.Photovoltaik.Tagesleistung', 0);
                   });
                    
                   
                  
                  
                  bahnuhr 2 Replies Last reply Reply Quote 0
                  • bahnuhr
                    bahnuhr Forum Testing Most Active @Homoran last edited by

                    @homoran sagte in Kostal Wechselrichter mit Firmware 3.71:

                    warum @Bahnuhr rechnet obwohl W auch in der Ausgabe vorkommt, weiß ich nicht mehr. kann sein, dass es DC Werte sind undcer AC rechnet.

                    Weil ich W haben will.
                    Und kostal liefern V und A.

                    Homoran 1 Reply Last reply Reply Quote 0
                    • bahnuhr
                      bahnuhr Forum Testing Most Active @dbox83 last edited by

                      @dbox83 sagte in Kostal Wechselrichter mit Firmware 3.71:

                           var i3 = results[12];            // PV Generator Nr. 3 - Strom in A
                      

                      hier muss 13 hin.
                      Hatte vorne einen Schreibfehler, ist aber schon berichtigt.

                      log uns setstate passt.
                      Die Variable müssen aber auch angelegt sein !

                      1 Reply Last reply Reply Quote 0
                      • bahnuhr
                        bahnuhr Forum Testing Most Active @dbox83 last edited by

                        @dbox83 sagte in Kostal Wechselrichter mit Firmware 3.71:

                        var idP2 = 'javascript.0.Photovoltaik.Leistung_Strang2';

                        und oben musst du idP3 ergänzen.

                        D 1 Reply Last reply Reply Quote 0
                        • Homoran
                          Homoran Global Moderator Administrators @bahnuhr last edited by

                          @bahnuhr sagte in Kostal Wechselrichter mit Firmware 3.71:

                          Weil ich W haben will.

                          Leistung</td>
                          
                          <td width="70" align="right" bgcolor="#FFFFFF">
                          
                          x x x&nbsp</td>
                          
                          <td width="30">&nbsp W</td>
                          

                          gibbet doch

                          bahnuhr 1 Reply Last reply Reply Quote 0
                          • D
                            dbox83 @bahnuhr last edited by

                            in etwa so?

                            
                             
                             
                            // Photovoltaik: Piko 5.5 Anlage (alte Firmware)
                             // Danke an homoran für den regex
                             // @bahnuhr; 03/2019 Dieter Müller
                              
                             //Variaben
                                 var idaktuell = 'javascript.0.Photovoltaik.Leistung_aktuell';
                                 var idTag = 'javascript.0.Photovoltaik.Tagesleistung';
                                 var idall = 'javascript.0.Photovoltaik.Leistung_gesamt';
                                 var idP1 = 'javascript.0.Photovoltaik.Leistung_Strang1';
                                 var idP2 = 'javascript.0.Photovoltaik.Leistung_Strang2';
                                 var idP3 = 'javascript.0.Photovoltaik.Leistung_Strang3';
                              
                                 var NameAnlage = 'pvserver';        // Nutzername der Photovoltaik-Anlage
                                 var PassAnlage = 'pvwr';         // Password der Photovoltaik-Anlage
                                 var IPAnlage = '192.168.176.211';    // IP der Photovoltaik-Anlage
                              
                                 var logging = false;
                                 var request = require('request');
                              
                              
                              function Piko() {
                                 log("Piko 10.1 auslesen");
                                 var results = [];
                                 request('http://' + NameAnlage + ':' + PassAnlage +'@' + IPAnlage, function (error, response, body) {
                                     var d = body.toString();
                                     if (logging) log (d);
                                     var reg = /#FFFFFF">[^\d]+([^<]+)/g
                                     var z = reg.exec(d);
                              
                                     while(z != null) {
                                         if (isNaN(z[1])) {
                                             if (logging) log("keine Zahl= "+ z[1]);
                                             z[1] = 0;
                                         } else {
                                             if (logging) log("Zahl= "+ z[1]);
                                             parseFloat(z[1]);
                                         }
                                         results[results.length] = z[1];
                                         z = reg.exec(d);
                                         log (z[1]);
                                     }
                                     if (logging) log("results= "+ results);
                              
                                 // Werte zuordnen
                                     var pwr = results[0];           // Energie aktuell in W
                                     var day = results[2];           // Tagesenergie in kWh
                                     var all = results[1];           // Gesamtenergie in kWh
                                     var v1 = results[3];            // PV Generator Nr. 1 - Spannung in V
                                     var i1 = results[5];            // PV Generator Nr. 1 - Strom in A
                                     var p1 = parseInt(v1 * i1);
                                     var v2 = results[7];            // PV Generator Nr. 2 - Spannung in V
                                     var i2 = results[9];            // PV Generator Nr. 2 - Strom in A
                                     var p2 = parseInt(v2 * i2);
                                     var v3 = results[11];            // PV Generator Nr. 3 - Spannung in V
                                     var i3 = results[13];            // PV Generator Nr. 3 - Strom in A
                                     var p3 = parseInt(v3 * i3);
                            
                                     if (logging) log("Leistung aktuell= " + pwr + " W");
                                     if (logging) log("Tagesleistung= " + day + " kWh");
                                     if (logging) log("Leistung gesamt= " + all + " kWh");
                             	     if (logging) log("Leistung Strang 1= " + p1 + " W");
                                 	 if (logging) log("Leistung Strang 2= " + p2 + " W");
                                     if (logging) log("Leistung Strang 3= " + p3 + " W");
                                     setState(idaktuell, parseFloat(pwr));
                                     setState(idTag, parseFloat(day));
                                     setState(idall, parseFloat(all));
                                     setState(idP1, parseFloat(p1));
                                     setState(idP2, parseFloat(p2));
                                     setState(idP3, parseFloat(p3));
                                 });
                             }
                              
                              
                             schedule("2,7,12,17,22,27,32,37,42,47,52,57 * * * *", function () {
                                 log ("Auslöser: Schedule");
                             	Piko();
                             });
                              
                             schedule("3 0 * * *", function () {     // Variablen löschen um 00:03 Uhr   
                                 setState('javascript.0.Photovoltaik.Tagesleistung', 0);
                             });
                              
                             
                            
                            
                            bahnuhr 1 Reply Last reply Reply Quote 0
                            • bahnuhr
                              bahnuhr Forum Testing Most Active @Homoran last edited by

                              @homoran
                              ccb07ff2-5f62-4f8c-87dd-f2c0726abb11-image.png
                              Diese beide lese ich aus und rechne halt selber 😉

                              Homoran 1 Reply Last reply Reply Quote 1
                              • Homoran
                                Homoran Global Moderator Administrators @bahnuhr last edited by

                                @bahnuhr alles gut! die W sind anscheinend für die drei Phasen

                                1 Reply Last reply Reply Quote 0
                                • bahnuhr
                                  bahnuhr Forum Testing Most Active @dbox83 last edited by

                                  @dbox83 sagte in Kostal Wechselrichter mit Firmware 3.71:

                                  in etwa so?

                                  sieht doch gut aus.
                                  Gib mal Bescheid ob es auch klappt.

                                  D Homoran 2 Replies Last reply Reply Quote 0
                                  • D
                                    dbox83 @bahnuhr last edited by

                                    Ich habe jetzt auch nochmal das Script, das die Variablen erzeugt wie folgt angepasst.

                                    // Photovoltaik -------------------------------------------------------------------------------------------------------------
                                    createState('javascript.0.Photovoltaik.Leistung_aktuell', 0, {type: 'number',name: 'Leistung aktuell',min: 0,role: 'per Script'});
                                    createState('javascript.0.Photovoltaik.Tagesleistung', 0, {type: 'number',name: 'Tagesleistung',min: 0,role: 'per Script'});
                                    createState('javascript.0.Photovoltaik.Leistung_gesamt', 0, {type: 'number',name: 'Leistung gesamt',min: 0,role: 'per Script'});
                                    createState('javascript.0.Photovoltaik.Leistung_Strang1', 0, {type: 'number',name: 'Leistung Strang 1',min: 0,role: 'per Script'});
                                    createState('javascript.0.Photovoltaik.Leistung_Strang2', 0, {type: 'number',name: 'Leistung Strang 2',min: 0,role: 'value'});
                                    createState('javascript.0.Photovoltaik.Leistung_Strang3', 0, {type: 'number',name: 'Leistung Strang 3',min: 0,role: 'value'});
                                    

                                    Die Variablen (Objekte) sind nun auch vorhanden.
                                    Aber alle haben den Wert "0".

                                    Ich werde morgen weiterschauen... Muss für heute Schluss machen.

                                    Vielen Dank schonmal für die tatkräftige Unterstützung!😊

                                    bahnuhr 1 Reply Last reply Reply Quote 0
                                    • bahnuhr
                                      bahnuhr Forum Testing Most Active @dbox83 last edited by

                                      @dbox83 sagte in Kostal Wechselrichter mit Firmware 3.71:

                                      Aber alle haben den Wert "0".

                                      Na klar, ist ja auch dunkel!

                                      Wie sieht die Webseite aktuell aus?
                                      Müsste doch überall (fast) 0 oder xxx stehen.

                                      1 Reply Last reply Reply Quote 0
                                      • Homoran
                                        Homoran Global Moderator Administrators @bahnuhr last edited by Homoran

                                        @bahnuhr sagte in Kostal Wechselrichter mit Firmware 3.71:

                                        Gib mal Bescheid ob es auch klappt.

                                        dann müsste @dbox83 aber Lunarmodule am 3. String haben.

                                        interessiert mich aber auch

                                        wenn's dann läuft, dann kommt hier das Skript rein!

                                        D 1 Reply Last reply Reply Quote 0
                                        • D
                                          dbox83 @Homoran last edited by

                                          Guten Morgen allerseits,

                                          sorry dass ich nur sporadisch schreiben kann, aber zeitlich klapt es leider nicht anders.

                                          Aktueller Stand:
                                          Im Fenster unter dem Skript sehe ich nach jeder Abfrage des Wechselrichters die aktuellen Werte (ich glaube die aktuelle AC-Leistung gesamt fehlt hierbei).

                                          Die "Objekte" im Ordner "Photovoltaik" werden jedoch nicht aktualisiert.
                                          Im Objekt "Leistung Strang 3" habe ich mal händisch eine "1" geschrieben, diese wird auch nicht überschrieben.
                                          Ich sende mal ein paar Fotos. Die EInstellungen der Instanz "javascript" mit den "Schreib Rechten" sollte doch so passen , oder?

                                          Skript_Ausgabe.jpg Objekte_Photovoltaik.jpg Instanz-Sscript_Einstellung.jpg

                                          bahnuhr Homoran 2 Replies Last reply Reply Quote 0
                                          • bahnuhr
                                            bahnuhr Forum Testing Most Active @dbox83 last edited by

                                            @dbox83
                                            zeig mal:

                                            • Screenshot alte dos Seite von kostal
                                            • aktuelles Script
                                            • screenshot Objekte

                                            Dann hat man alles zusammen und kann es beurteilen.

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate
                                            FAQ Cloud / IOT
                                            HowTo: Node.js-Update
                                            HowTo: Backup/Restore
                                            Downloads
                                            BLOG

                                            708
                                            Online

                                            31.9k
                                            Users

                                            80.1k
                                            Topics

                                            1.3m
                                            Posts

                                            parsen wechselrichter
                                            5
                                            64
                                            4367
                                            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