Closed tomascrespo closed 1 year ago
Looks like you're getting a checksum error on the response, could be the baud rate (default is 9600). You can set the baud rate using --baud_rate 9600 . I used the tool from Orient Power to help develop the code, (https://www.opsolarbattery.com/download-center). If you can get the battery data using this code from a PC then it should work with my code.
Hi Graham! I had tried with 1200 bps and with 115200 bps with the same result. As far as I know the RS232 pylon protocol needs a initial 1200 connection and after that a 115200 connection.
I will try OSP solar, but... What specific software? There are various in the download page. Is it linux and has available source code?
I was using the PC Monitoring Software V2.04
PC Monitoring Software not working for me.
Finally I adjust your code to work with my US2000 Pylontech batteries, according to RS232 Protocol specification. Only a few changes about baud rate and address field in frames.
I have publish the changes in my github
ok great, I'll add a link to it from my page
Hi! First thing congratulations for this great project! As far as I know your software is for Jakiper but it will work with a Pylontech US2000B, isn't it?
I am trying to communicate my Raspberry 3B+ with my rack of 2 Pylontech US2000B by console port (RS232) using your software. Previously I had used ICC to communicate with my batteries, and batteryview software also works, so I think my cable is working perfectly.
I have tried your software as mentioned in point 4 of your wiki (Adding PylonToMQTT to an existing system). I have tried command line and docker container with the same result. It publish only a topic in my MQTT server, /PylonToMQTT/Main/tele/LWT=Online, but nothing more, and logut this error:
023-04-04 08:16:47,503:INFO:PylonToMQTT:pylon_mqtt starting up... 2023-04-04 08:16:47,535:INFO:PylonToMQTT:pylonPort = /dev/ttyUSB0 2023-04-04 08:16:47,536:INFO:PylonToMQTT:baud_rate = 9600 2023-04-04 08:16:47,537:INFO:PylonToMQTT:rackName = Main 2023-04-04 08:16:47,537:INFO:PylonToMQTT:mqttHost = 192.168.2.245 2023-04-04 08:16:47,538:INFO:PylonToMQTT:mqttPort = 1883 2023-04-04 08:16:47,538:INFO:PylonToMQTT:mqttRoot = PylonToMQTT 2023-04-04 08:16:47,539:INFO:PylonToMQTT:mqttUser = tomascrespo 2023-04-04 08:16:47,539:INFO:PylonToMQTT:mqttPassword = ********** 2023-04-04 08:16:47,540:INFO:PylonToMQTT:publishRate = 5 2023-04-04 08:16:47,540:INFO:PylonToMQTT:sok = False 2023-04-04 08:16:47,541:INFO:PylonToMQTT:Connecting with clientId=tomascrespo_mqttclient_267 2023-04-04 08:16:47,542:INFO:PylonToMQTT:Connecting to MQTT 192.168.2.245:1883 2023-04-04 08:16:47,546:INFO:PylonToMQTT:MQTT connected OK Returned code=0 2023-04-04 08:16:47,547:INFO:PylonToMQTT:Subscribed to PylonToMQTT/Main/cmnd/# 2023-04-04 08:16:58,389:ERROR:PylonToMQTT:Failed to process response! 2023-04-04 08:16:58,390:ERROR:PylonToMQTT:invalid literal for int() with base 16: b'\x00\x80\x80\x80' Traceback (most recent call last): File "pylon_to_mqtt.py", line 235, in periodic number_of_packs = pylontech.get_pack_count().PackCount File "/support/pylontech.py", line 149, in get_pack_count f = self.read_frame() File "/support/pylontech.py", line 143, in read_frame f = self._decode_hw_frame(raw_frame=raw_frame) File "/support/pylontech.py", line 127, in _decode_hw_frame assert got_frame_checksum == int(frame_chksum, 16) ValueError: invalid literal for int() with base 16: b'\x00\x80\x80\x80' 2023-04-04 08:17:09,418:ERROR:PylonToMQTT:Failed to process response! 2023-04-04 08:17:09,418:ERROR:PylonToMQTT:invalid literal for int() with base 16: b'\x00\x80\x80\x80'
Any clue?