Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Node-Red
    5. Pylontech Akku mit Node-Red auslesen

    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 Pylontech Akku mit Node-Red auslesen

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

      @mickym
      Ich mache mir schon seit einigen Tagen Gedanken darüber wie ich mein Akkupack von Pylontech mit Node-Red ausgelesen bekomme. Vielleicht kannst Du mir bei der Lösung helfen.

      Erst hatte ich mit der eingesetzten Hardware so meine Probleme, da wurde der Akku1 nur zum Teil ausgelesen. Nachdem ich auf den USB zu seriell Adapter von digitus gewechselt bin, werden die 3 Akkus vollständig und fehlerfrei ausgelesen. Auch der Battery-Monitor von pylontech funktioniert damit.

      Das Datenprotokoll wird von pylontech über die Serielle Schnittstelle in Textform (console) zur Verfügung gestellt und sieht wie folgt aus:


      bat 1

      @

      Battery Volt Curr Tempr Base State Volt. State Curr. State Temp. State SOC Coulomb BAL

      0 3349 726 20000 Charge Normal Normal Normal 86% 63484 mAH N

      1 3349 726 20000 Charge Normal Normal Normal 86% 63484 mAH N

      2 3349 726 20000 Charge Normal Normal Normal 86% 63470 mAH N

      3 3349 726 20000 Charge Normal Normal Normal 86% 63477 mAH N

      4 3349 726 20000 Charge Normal Normal Normal 86% 63503 mAH N

      5 3349 726 19700 Charge Normal Normal Normal 86% 63488 mAH N

      6 3349 726 19700 Charge Normal Normal Normal 86% 63492 mAH N

      7 3349 726 ...


      Ich habe schon Lösungsansätze gefunden, aber so richtig begeistert bin ich davon nicht.

      Hier die besten Lösungsansätze. Aus einem wurde dann ein ioBroker Adapter, der wohl ausgezeichnet funktioniert. Nützt mir aber leider nichts.

      https://github.com/juanhaywood/nodered-pylontech-console-reader/blob/main/README.md

      https://forum.iobroker.net/topic/67799/pylontech-mit-nodered-in-den-iobroker-geschlossen

      Ob das String Node eine Hilfe wäre?

      https://flows.nodered.org/node/node-red-contrib-string

      Ich hätte gerne dass die Textwerte in diverse context Variable geschrieben werden. MQTT steht momentan nicht auf dem Wunschzettel

      Vielleicht hast Du eine Lösung, die mir weiterhilft.

      Danke dir.

      Gruß Garf

      mickym 1 Reply Last reply Reply Quote 0
      • mickym
        mickym Most Active @Garf last edited by mickym

        @garf Warum klappt das mit dem iobroker- Adapter nicht?

        Nun gut lassen wir das mal dahingestellt.

        So dass was Du da gepostet hast, was da rauskommt, soll am Ende wie aussehen?
        Von der String Node halte ich auf den ersten Blick nicht viel. Wie soll denn das Ergebnis aussehen?

        Und warum nimmst Du nicht einfach eine CSV Node und machst Dir das Leben schwer?

        Mit den Überschriften ist bissi doof mit den Leerzeichen - aber schau halt ob es in etwa passt:

        d6ea73f9-3f6d-4222-b355-832ab480e4d2-image.png

        [{"id":"b91974ec9eee2b32","type":"inject","z":"289f539dcc33814e","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":170,"y":5180,"wires":[["8f840614a03ae184"]]},{"id":"8f840614a03ae184","type":"template","z":"289f539dcc33814e","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"\nbat 1\n@\n\nBattery Volt Curr Tempr Base State Volt. State Curr. State Temp. State SOC Coulomb BAL\n\n0 3349 726 20000 Charge Normal Normal Normal 86% 63484 mAH N\n\n1 3349 726 20000 Charge Normal Normal Normal 86% 63484 mAH N\n\n2 3349 726 20000 Charge Normal Normal Normal 86% 63470 mAH N\n\n3 3349 726 20000 Charge Normal Normal Normal 86% 63477 mAH N\n\n4 3349 726 20000 Charge Normal Normal Normal 86% 63503 mAH N\n\n5 3349 726 19700 Charge Normal Normal Normal 86% 63488 mAH N\n\n6 3349 726 19700 Charge Normal Normal Normal 86% 63492 mAH N\n","output":"str","x":320,"y":5180,"wires":[["525cc59f65e1adba","644986050296f87f"]]},{"id":"525cc59f65e1adba","type":"debug","z":"289f539dcc33814e","name":"Simulate Input","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":520,"y":5120,"wires":[]},{"id":"644986050296f87f","type":"csv","z":"289f539dcc33814e","name":"","sep":" ","hdrin":false,"hdrout":"none","multi":"one","ret":"\\n","temp":"Battery,Volt,Curr,Tempr,Base State,Volt. State,Curr. State,Temp. State,SOC,Coulomb,BAL","skip":"5","strings":true,"include_empty_strings":"","include_null_values":"","x":490,"y":5180,"wires":[["447205fa81b36ae8"]]},{"id":"447205fa81b36ae8","type":"debug","z":"289f539dcc33814e","name":"Objekte","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":5180,"wires":[]}]
        

        Keine Ahnung was die letzte Spalte ist und ob Du die brauchst - vielleicht ist das mit den mAH auch falsch und Du machst eine eigene Spalte Unit oder hinten was anderes.

        aecf4d0b-fef4-4cc6-a39c-795f981b39bc-image.png

        G 1 Reply Last reply Reply Quote 0
        • G
          Garf @mickym last edited by

          @mickym sagte in Pylontech Akku mit Node-Red auslesen:

          Warum klappt das mit dem iobroker- Adapter nicht?

          Der klappt sicher ganz prima. Nur bei mir läuft kein iobroker mehr. Hatte ich mal auf der NAS in docker am Laufen. Aber ich mache einfach zu wenig mit iobroker. Und nur um die Werte auszulesen, weiß nicht.

          Der Flow sieht echt gut aus. Mit dem csv-Node umwandeln. Gute Idee. Ich schaue es mir mal an. Die Units brauche ich sicher nicht. Mir geht es um die Werte, diese richtig formatiert und visualisiert reicht mir schon. So wichtig sind die Werte am Ende auch nicht. Ist halt alles eine nette Spielerei.

          Danke schon mal, ich denke damit komme ich schon einmal zurecht.

          mickym 1 Reply Last reply Reply Quote 0
          • mickym
            mickym Most Active @Garf last edited by mickym

            @garf Falls Du den SoC anstelle als String - als Zahl brauchst etc. kannst das ja dann easy mit einer Change Node umwandeln.

            G 1 Reply Last reply Reply Quote 0
            • G
              Garf @mickym last edited by

              @mickym

              Live sieht das Ergebnis so aus:

              162df072-95e6-49de-90ea-27974156e8dd-grafik.png

              48bad305-4075-4e86-bdf8-afd118d33a55-grafik.png

              7d919d18-41c4-4935-84ca-979750347d36-grafik.png

              mickym 1 Reply Last reply Reply Quote 0
              • mickym
                mickym Most Active @Garf last edited by

                @garf Keine Ahnung was Du machst - aber Du musst halt schon immer eine Zeile analysieren. Ich habs doch in dem Flow gemacht.

                G 1 Reply Last reply Reply Quote 0
                • G
                  Garf @mickym last edited by

                  @mickym
                  Wenn ich deinen Flow richtig verstehe, dann verwendest Du das template Node um die komplette Textnachricht an das csv-Node zu übergeben. Darauf kann ich doch verzichten? Meine Textnachricht kommt ja direkt aus dem Serial-Interface.

                  Starte ich deinen Beispielflow, dann sieht es so aus:

                  d96a6354-5bab-4be6-b184-a99808d28d24-grafik.png

                  0eed508a-d8bb-41c9-b9ac-dd02c5530359-grafik.png

                  So wäre es perfekt. Irgend etwas ist an meiner zu deiner Textnachricht anders. Deshalb kommt es vermutlich zu diesen Fehlern in der Ausgabe

                  mickym 1 Reply Last reply Reply Quote 0
                  • mickym
                    mickym Most Active @Garf last edited by

                    @garf Genau - also Du musst halt schauen, was der Unterschied ist und was man ggf. ändern muss, dass es eben so wie in der template Node aussieht.

                    G 1 Reply Last reply Reply Quote 0
                    • G
                      Garf @mickym last edited by Garf

                      @mickym
                      Ich habe in deinem Template Node einmal die Originalnachricht hineinkopiert. Und schon ist der Fehler da.

                      Hier mal als Code

                      bat 1
                      
                      @
                      
                      
                      Battery  Volt     Curr     Tempr    Base State   Volt. State  Curr. State  Temp. State  SOC          Coulomb      BAL         
                      
                      
                      0        3472     0        20600    Idle         Normal       Normal       Normal       100%         73999 mAH      N
                      
                      
                      1        3489     0        20600    Idle         Normal       Normal       Normal       100%         73999 mAH      N
                      
                      
                      2        3472     0        20600    Idle         Normal       Normal       Normal       100%         73999 mAH      N
                      
                      
                      3        3471     0        20600    Idle         Normal       Normal       Normal       100%         73999 mAH      N
                      
                      
                      4        3487     0        20600    Idle         Normal       Normal       Normal       100%         73999 mAH      N
                      
                      
                      5        3483     0        20300    Idle         Normal       Normal       Normal       100%         73999 mAH      N
                      
                      
                      6        3490     0        20300    Idle         Normal       Normal       Normal       100%         73999 mAH      N
                      
                      
                      

                      Ich vermute einmal die Vielzahl der Leerzeichen könnten dass Problem sein.

                      mickym 1 Reply Last reply Reply Quote 0
                      • mickym
                        mickym Most Active @Garf last edited by

                        @garf dann die leerzeichen entfernen

                        d97641b2-04c0-4085-a7a1-25708d360d93-image.png

                        [{"id":"b91974ec9eee2b32","type":"inject","z":"289f539dcc33814e","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":110,"y":5200,"wires":[["8f840614a03ae184"]]},{"id":"8f840614a03ae184","type":"template","z":"289f539dcc33814e","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"bat 1\n\n@\n\n\nBattery  Volt     Curr     Tempr    Base State   Volt. State  Curr. State  Temp. State  SOC          Coulomb      BAL         \n\n\n0        3472     0        20600    Idle         Normal       Normal       Normal       100%         73999 mAH      N\n\n\n1        3489     0        20600    Idle         Normal       Normal       Normal       100%         73999 mAH      N\n\n\n2        3472     0        20600    Idle         Normal       Normal       Normal       100%         73999 mAH      N\n\n\n3        3471     0        20600    Idle         Normal       Normal       Normal       100%         73999 mAH      N\n\n\n4        3487     0        20600    Idle         Normal       Normal       Normal       100%         73999 mAH      N\n\n\n5        3483     0        20300    Idle         Normal       Normal       Normal       100%         73999 mAH      N\n\n\n6        3490     0        20300    Idle         Normal       Normal       Normal       100%         73999 mAH      N\n\n","output":"str","x":260,"y":5200,"wires":[["525cc59f65e1adba","a18c91b3f1cbce85"]]},{"id":"525cc59f65e1adba","type":"debug","z":"289f539dcc33814e","name":"Simulate Input","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":460,"y":5140,"wires":[]},{"id":"644986050296f87f","type":"csv","z":"289f539dcc33814e","name":"","sep":" ","hdrin":false,"hdrout":"none","multi":"one","ret":"\\n","temp":"Battery,,Volt,Curr,Tempr,Base State,Volt. State,Curr. State,Temp. State,SOC,Coulomb, Unit,BAL","skip":"8","strings":true,"include_empty_strings":"","include_null_values":"","x":910,"y":5200,"wires":[["447205fa81b36ae8"]]},{"id":"447205fa81b36ae8","type":"debug","z":"289f539dcc33814e","name":"Objekte","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1080,"y":5200,"wires":[]},{"id":"a18c91b3f1cbce85","type":"split","z":"289f539dcc33814e","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":410,"y":5200,"wires":[["838eda0f01a264ce"]]},{"id":"838eda0f01a264ce","type":"change","z":"289f539dcc33814e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$trim(payload)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":5200,"wires":[["5588a5d1f23162bf"]]},{"id":"5588a5d1f23162bf","type":"join","z":"289f539dcc33814e","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":"false","timeout":"","count":"","reduceRight":false,"x":770,"y":5200,"wires":[["644986050296f87f"]]}]
                        

                        G 1 Reply Last reply Reply Quote 0
                        • G
                          Garf @mickym last edited by

                          @mickym
                          0Volt kann die Zelle aber nicht haben, dann wäre die Zelle defekt. Dann sind es wohl nicht nur die Leerzeichen. Wäre auch zu einfach gewesen.

                          mickym 1 Reply Last reply Reply Quote 0
                          • mickym
                            mickym Most Active @Garf last edited by mickym

                            @garf sagte in Pylontech Akku mit Node-Red auslesen:

                            @mickym
                            0Volt kann die Zelle aber nicht haben, dann wäre die Zelle defekt. Dann sind es wohl nicht nur die Leerzeichen. Wäre auch zu einfach gewesen.

                            Sorry war mein Fehler - da ist ein doppeltes Komma in der Spaltendefinition drin gewesen, dann mach das raus - dann sollte es gehen :
                            f76139cb-76a0-4c96-a949-6790e73a3c36-image.png
                            69e678ff-0edb-40e3-b92a-4e50c92f2ca0-image.png

                            fb95566d-b713-4ac0-affe-f34a4c7af99b-image.png

                            Durch das Komma, hatten sich die Spalten um eins verschoben.

                            G 2 Replies Last reply Reply Quote 1
                            • G
                              Garf @mickym last edited by

                              @mickym
                              Super. Ich schaue es mir nachher noch an. Wäre ja dann ne echt einfache Lösung. Man muss halt einfach nur einen Profi fragen.
                              Danke für deine Hilfe.

                              1 Reply Last reply Reply Quote 0
                              • G
                                Garf @mickym last edited by

                                @mickym sagte in Pylontech Akku mit Node-Red auslesen:

                                Durch das Komma, hatten sich die Spalten um eins verschoben.

                                Habe ich heraugenommen und nun sieht es fehlerfrei aus. Damit kann ich arbeiten. Mega und wie einfach gelöst.

                                Vielen Dank nochmals für deine Hilfe.

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

                                Support us

                                ioBroker
                                Community Adapters
                                Donate

                                883
                                Online

                                31.8k
                                Users

                                79.9k
                                Topics

                                1.3m
                                Posts

                                node-red
                                2
                                14
                                785
                                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