chinezbrun / pytes_esp

PYTES and PYLONTECH LiFePo4 batteries integration with Home Assistant via MQTT.
GNU General Public License v3.0
8 stars 2 forks source link

Serial connection error #6

Closed killamilla0815 closed 5 months ago

killamilla0815 commented 5 months ago

Hello

I cannot get serial connection to work on my Pytes e-box 4850C battery.

Pre-condition: Direct serial connection from PC to the battery via DB9-to-RJ45 cable works OK (tested with Putty, getting the "PYTES>" input prompt and can run commands.

After setting up your code on an ESP board and do the wiring as in your instruction, it boots but I'm getting the following output which points into some serial connection error:

..wlan connection successful
..... ('192.168.178.145', '255.255.255.0', '192.168.178.1', '192.168.178.1')
..... (2024, 5, 4, 22, 20, 27, 5, 125)
...serial initialization complete
...mqtt initialization complete
...mqtt auto discovery - system sensors:100 %
...mqtt auto discovery - battery sensors:100 %
...mqtt auto discovery
...program initialisation completed starting main loop
relay local time: 2024-5-4 22:20
serial uptime   : 0.0
...timeouts -> close serial, skip set
...serial stat   : loops: 1 errors: 1 efficiency: 0.0
...serial stat   : parsing round-trip: 7.91
------------------------------------------------------
relay local time: 2024-5-4 22:20
serial uptime   : 0.0
...timeouts -> close serial, skip set
...serial stat   : loops: 2 errors: 2 efficiency: 0.0
...serial stat   : parsing round-trip: 7.61
------------------------------------------------------
relay local time: 2024-5-4 22:20
serial uptime   : 0.0
...timeouts -> close serial, skip set
...serial stat   : loops: 3 errors: 3 efficiency: 0.0
...serial stat   : parsing round-trip: 7.76
------------------------------------------------------
relay local time: 2024-5-4 22:21
serial uptime   : 0.0

ESP board is connected as suggested in your instruction:

Pinout has been tested multiple times and I'm 100% sure that there is no mistak ein wiring or poor connection (measured via multimeter).

Appended is a picture of the RS232-TTL PCB, its a very common one with the typical MAX3232 chip, sold on ebay or anywhere else. Looking on your RS232-TTL board (with connector) I dont see any difference in the chip, and anythings else is just simple wiring, no difference to my PCB.

What else can I do to make the serial connection working (sure, I've also tested to swap Rx/Tx, makes no difference for me).

Thanks a lot for this great project, I hope I can get it working for me.

IMG_9829 IMG_9830 IMG_9831

killamilla0815 commented 5 months ago

No ideas (besides of broken MAX3232 chip) ?

On a scope I could see, that ESP32 is polling data via its TX2 pin, can clearly see and trigger that on the scope, but once Tx2 is connected to Tx TTL pin of the converter, it seems that data is "lost" somehow, scope cannot trigger it any longer. Same goes when connecting Tx2 to Rx TTL pin. I hope that its just related to a broken chip, tommorrow I will test with a new converter PCB, that comes with DB9 connector and hope that will fix it.

chinezbrun commented 5 months ago

This is a common hardware / wiring issue. the message : "...timeouts -> close serial, skip set" error is normal when no data is coming in/out on the ESP32 serial pins :). Hope that u will fix it. Following the connections instruction and recommended hardware (PCB, ESP32) will be the key for success. Statement tested on other users too. :) .

Note: I supposed that the cable "PC to the battery via DB9-to-RJ45" was tested with a DB09 (female)- USB adapter and worked. I can't see your tested cable PC to the battery via DB9-to-RJ45 in your pictures. Hope that will be the one to be used with the new DB09 PCB, right?

killamilla0815 commented 5 months ago

Hello Dan

Thanks for your response. Indeed it was caused by broken MAX3232 ICs (two of them !) and after replacing

it with the recommended converter PCB, it worked straight away. At least for ONE battery. But, I’m struggling to read information from other 2 batteries

At first, I was trying to do this via direct RS232-RJ45 connection to the master battery. Slave 1 and 2 are connected via LINK port as advised in the manual:

Host Link1 à Slave1 Link0

Slave1 Link1 à Slave2 Link0

RS232-RJ45 cable connected to Host CONSOLE port

Doing so, I can only read out the master battery, but it will not show any information of the slaves.

Finally this is essential to me, to control all the batteries via one single RS232 connection, swapping the cable each time is not an option,

as they are operated remotely. Right now, it seems that this doesn’t work.

Apart from that, there is another limitation vs. the Pylontech batteries: for Pylontech there exist a Github project https://github.com/irekzielinski/Pylontech-Battery-Monitoring/tree/master , that allows direct control via Web-UI, this works for me quite well on a single US2000C, which I also run:

It allows to query the “stat” command which is not addressed in your project, as far as I can see.

Such a Web-UI is unfortunately missing in your project.

I have also contacted a guy called Robert from Pytes support, about this topic and waiting for his answer now.

As its not too long ago since I bought the 3 Pytes batteries, probably I will return them back to the dealer, the saving of ~ 100,- EUR per unit vs Pylon, its not worth the time, that I’ve already spend to make it working.

For Pylon there exist a workflow, that has proved to work me, so will probably invest in additional US3000 units.

Nevertheless, thanks for the time, you invested in this project.

WBR, Manfred

Von: Dan Popescu @.> Gesendet: Montag, 6. Mai 2024 09:09 An: chinezbrun/pytes_esp @.> Cc: killamilla0815 @.>; Author @.> Betreff: Re: [chinezbrun/pytes_esp] Serial connection error although properly connected (Issue #6)

This is a common hardware / wiring issue. the message : "...timeouts -> close serial, skip set" error is normal when no data is coming in/out on the ESP32 serial pins :). Hope that u will fix it. Following the connections instruction and recommended hardware (PCB, ESP32) will be the key for success. Statement tested on other users too. :) Good luck !!

— Reply to this email directly, view it on GitHub https://github.com/chinezbrun/pytes_esp/issues/6#issuecomment-2095325263 , or unsubscribe https://github.com/notifications/unsubscribe-auth/A52HZWYAJTDHFG6LDP5J6Q3ZA4UB3AVCNFSM6AAAAABHHFMBEGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJVGMZDKMRWGM . You are receiving this because you authored the thread.Message ID: @.***>

chinezbrun commented 5 months ago

How many batteries are shown in pytes_esp device in Home Assistant? Did you proper configure the config.py file with the correct powers number (in your case 3) ? Are you able to read via Hyperterminal all your batteries via master? command BAT 1, BAT 2 or PWR 1, PWR 2... If the program works for one battery should work for all batteries too, as was tested on 6 batteries with no issues.

killamilla0815 commented 5 months ago

Hi Dan

It works now as expected, getting data from all of the 3 batteries, appended is a screenshot. Probably an issue with the starting sequence, turning them off and on, one by one, resolved it, obviously they don’t like hotplugging of the LINK cables.

Anyhow, I’m getting data now and was happy to start with my setup, but then another issue occurred: kept them connected yesterday evening to my inverter with ~45% SoC left and today morning all 3 of them had red ALM LED blinking

which indicates undervoltage.bMeasuring the voltage I found them down to ~45V, WTF ?

Serial data shows, they are down to 0% SoC ! No clue, haw this can happen, my Pylontech US2000C shuts down discharging at ~13 SoC, no way to get below

that SoC level. Obviously the Pytes guys do not have such a SW protection built into the BMS…

But the really annoying part is: when I connectmy charger (Meanwhell NPB-1700 48V), they don’t go into charging state but remain in ALM mode, WTH ? Restart etc. doen’t help, also „trst“ serial command did not make a difference. Seems stay are stuck in this state now.

I’ve contacted Robert from Pytes Support to tell me, how to reactivate them and getting them into charging mode.

BTW: do you know the appended list with serial commands (many of them are not shown via the “help” command) ? I’ve tried a few ones, but they do not work, maybe they are locked somehow ?

WBR, Manfred

Von: Dan Popescu @.> Gesendet: Dienstag, 7. Mai 2024 20:32 An: chinezbrun/pytes_esp @.> Cc: killamilla0815 @.>; Author @.> Betreff: Re: [chinezbrun/pytes_esp] Serial connection error although properly connected (Issue #6)

How many batteries are shown in pytes_esp device in Home Assistant? Did you proper configure the config.py file with the correct powers number (in your case 3) ? If it works for one should work for all batteries too, program was tested on 6 batteries with no issues.

— Reply to this email directly, view it on GitHub https://github.com/chinezbrun/pytes_esp/issues/6#issuecomment-2099062973 , or unsubscribe https://github.com/notifications/unsubscribe-auth/A52HZWYV5II2USTE2IA4DHLZBEMZNAVCNFSM6AAAAABHHFMBEGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJZGA3DEOJXGM . You are receiving this because you authored the thread.Message ID: @.***>

chinezbrun commented 5 months ago

I have no clue on your specific issues with SOC. But I'm happy to hear that your setup is working. Now you can do deep monitoring on cell level that can give you more data and may be an answer on what happened. I will close now the issue as completed.

killamilla0815 commented 5 months ago

Hello Dan

Its all working now, but I have some issue with your MQTT data format, which you implemented in your code:

I’m processing MQTT data via Node-Red to fed it into an Influx database. Influx expects a simple format, as you can see from another MQTT device in the screenshot: “name = value” , nothing else. Your data has the format “name = {“value”: }”

Any chance to modify the main.py code, so that it directly outputs the expected Influx format ?

If this is caused by the homeassistant integration, I won’t need it, since I don’t run homeassistant.

Thanks a lot.

Best regards, Manfred

Von: Dan Popescu @.> Gesendet: Mittwoch, 8. Mai 2024 22:57 An: chinezbrun/pytes_esp @.> Cc: killamilla0815 @.>; Author @.> Betreff: Re: [chinezbrun/pytes_esp] Serial connection error although properly connected (Issue #6)

I have no clue on your specific issues with SOC. But I'm happy to hear that your setup is working. Now you can do deep monitoring on cell level that can give you more data and may be an answer on what happened. I will close now the issue as completed.

— Reply to this email directly, view it on GitHub https://github.com/chinezbrun/pytes_esp/issues/6#issuecomment-2101441024 , or unsubscribe https://github.com/notifications/unsubscribe-auth/A52HZWZTEOC7XUP6H6ACIRTZBKGSVAVCNFSM6AAAAABHHFMBEGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBRGQ2DCMBSGQ . You are receiving this because you authored the thread.Message ID: @.***>