September 10, 20223 yr (Updated info further down in the post) I create a very simple Python script to interrogate the Pace BMS as used in some popular lithium battery brands. I've also packed this as a Home Assistant add-on, but can just as well be used as either a standalone script / within a docker container. It reports the voltage of cells, temperatures, the pack's current, voltage, SOC, SOH, and a few other metrics. Use at own risk. Either a serial link to the RS232 port or via IP (using some port server over TCP) will work. Repository: https://github.com/Tertiush/bmspace The script serves by needs atm, so any further developments can be done by the community. UPDATE: I've rewritten most of this script using the official PACE RS232 Protocol definition. The script now supports multiple packs! I've only implemented informational messages / retrieving data, no commands. Use at own risk! Many new fields are now retrieved such as warnings, balancing data, status indications, etc. Edited July 27, 20232 yr by tertiuscpt Updated info
November 23, 20223 yr Heya @tertiuscpt Just wanted to let you know this works great on my Revov R100 too! Can confirm the pinout is the same on the RJ11 Thanks for the project!
February 11, 20233 yr Author Quick update, I've rewritten most of this script using the official PACE RS232 Protocol definition. The script now supports multiple packs! I've only implemented informational messages / retrieving data, no commands. Use at own risk! Many new fields are now retrieved such as warnings, balancing data, status indications, etc.
May 5, 20233 yr I will play with your Python script! May I ask you where the PACE protocol definition is to be found?
May 5, 20233 yr Author Linked below. Another user on github shared it: https://github.com/Tertiush/bmspace/files/10372932/72651.11625-PACE-RS232commuciation-protocal.PACE-RS232-TY16S.-20180705.pdf
May 10, 20233 yr Hi Tertius, I'm getting the following error in the log after starting the addon. I've cut out the voltage info of my two AM-2 packs from the log to shorten it. After I get the error below, the addon halts, and I have to start it again. " Hello BMS Pace Starting up ... -all the voltage info of the two packs- ... Pack 2, SOH: 100.0 % Script running.... Pack Remaining Capacity: 124870 mAh Pack Full Capacity: 125000 mAh Pack Design Capacity: 125000 mAh Pack SOC: 99.9 % Pack SOH: 100.0 % Packs for warnings: 2 Pack 1, warnings: Protection State 2: Fully Pack 1, balancing1: 00000000 Pack 1, balancing2: 00000000 Error parsing BMS warning data: b'0D' Error retrieving BMS warning info: Error parsing BMS warning data: b'0D' Publishing HA Discovery topic... " I also turned on debugging 2, here's an extract of the bottom part of the log: " Pack SOC: 99.89 % Pack SOH: 100.0 % SOI: 0x7e VER: b'25' ADR: b'01' CID1 (Type): b'46' RTN: b'00' LENGTH: b'C08C' - LCHKSUM: 67 - LENID: b'08C' - LENID (int): 140 INFO: b'00020D0000000000000000000000000006000000000000000000008006000000000000010D000000000000000000000000000600000000000000000000800600000000000000' CHKSUM: b'E2ED' Calc CHKSUM: E2ED Packs for warnings: 2 Pack 1, warnings: Protection State 2: Fully Pack 1, balancing1: 00000000 Pack 1, balancing2: 00000000 Error parsing BMS warning data: b'0D' Error retrieving BMS warning info: Error parsing BMS warning data: b'0D' " Am I missing something?
May 12, 20233 yr Author The script is reading the warnings as ASCII data, not expecting the hex 0xD character representing a carriage-return. There's small variances between some BMS' causing this, I've compensated once before for it. Please drop a full debug log at Github in the Issues for me to look at.
May 20, 20233 yr I have a Revov R9 with what looks like a PACE BMS and tried to use the pacebms code but RS232 and RS485 is not responding when sending out serial commans. I'm not sure which port to use for USB to RS485.
May 20, 20233 yr Author Should be the RS232 port, if there's no reply whatsoever then it's likely not a PACE BMS, or maybe the baudate is different 🤷♂️
May 20, 20233 yr I'm thinking it is either a PACE BMS or CAN BMS. Revov's earlier model the R100 looks very very similar. The biggest difference is the BMS is built into the battery on the R100. @tertiuscpt, I want to confirm, the BAUD is 9600 by default on bmspace software? How would I set the BAUD to say 2400 @reapster mentioned earlier in this thread the RJ11 jack of the R100 pinout, so I'm hopfull the R9 with its 6S6C type, would most propably have the middle two conductors be TXD, and RXD. Will be finding a RJ11 with 6 conductors and experimenting with it. Attached a picture of the front of a R100. Edited May 20, 20233 yr by lcj
May 20, 20233 yr Author The PACE documentation requires a baud rate of 9600, as such this is hard-coded in my script. If you are using a networked serial device then you can change the baud rate on it, which the script accesses with its socket IP:Port. If you're connecting directly with serial then its not currently an optional setting. Your photo is an exact layout of the PACE BMS.
May 27, 20233 yr @tertiuscpt, happy to report that I got it working by getting the right RJ12 connector for the RS232 port.
July 12, 20232 yr HI, I have LifePO4 Batery system called "Yechuang" from China. This system is equiped with Pace BMS..I have tried to connect this BMS to home assistant, and In log i have found this: Connection Type: IP MQTT connected with result code 0 Connecting to BMS... trying to connect 10.0.0.221:8234 BMS socket connected -> Outgoing Data: b'~250146C10000FD9A\r' <- Incoming data: b'~250146C10000FD9A\r' SOI: 0x7e VER: b'25' ADR: b'01' CID1 (Type): b'46' RTN: b'C1' LENGTH: b'0000' - LCHKSUM: 48 - LENID: b'000' - LENID (int): 0 INFO: b'' CHKSUM: b'FD9A' Calc CHKSUM: FD9A BMS Version: -> Outgoing Data: b'~250146C20000FD99\r' <- Incoming data: b'~250146C20000FD99\r' SOI: 0x7e VER: b'25' ADR: b'01' CID1 (Type): b'46' RTN: b'C2' LENGTH: b'0000' - LCHKSUM: 48 - LENID: b'000' - LENID (int): 0 INFO: b'' CHKSUM: b'FD99' Calc CHKSUM: FD99 BMS Serial Number: Pack Serial Number: -> Outgoing Data: b'~25014642E002FFFD05\r' <- Incoming data: b'~25014642E002FFFD05\r' SOI: 0x7e VER: b'25' ADR: b'01' CID1 (Type): b'46' RTN: b'42' LENGTH: b'E002' - LCHKSUM: 69 - LENID: b'002' - LENID (int): 2 INFO: b'FF' CHKSUM: b'FD05' Calc CHKSUM: FD05 Error parsing BMS analog data: invalid literal for int() with base 16: b'' Error retrieving BMS analog data: Error parsing BMS analog data: invalid literal for int() with base 16: b'' Any idea what I sholuld do ?? Thanks
July 14, 20232 yr Author On 2023/07/12 at 8:24 PM, IrcI said: HI, I have LifePO4 Batery system called "Yechuang" from China. This system is equiped with Pace BMS..I have tried to connect this BMS to home assistant, and In log i have found this: Connection Type: IP MQTT connected with result code 0 Connecting to BMS... trying to connect 10.0.0.221:8234 BMS socket connected -> Outgoing Data: b'~250146C10000FD9A\r' <- Incoming data: b'~250146C10000FD9A\r' SOI: 0x7e VER: b'25' ADR: b'01' CID1 (Type): b'46' RTN: b'C1' LENGTH: b'0000' - LCHKSUM: 48 - LENID: b'000' - LENID (int): 0 INFO: b'' CHKSUM: b'FD9A' Calc CHKSUM: FD9A BMS Version: -> Outgoing Data: b'~250146C20000FD99\r' <- Incoming data: b'~250146C20000FD99\r' SOI: 0x7e VER: b'25' ADR: b'01' CID1 (Type): b'46' RTN: b'C2' LENGTH: b'0000' - LCHKSUM: 48 - LENID: b'000' - LENID (int): 0 INFO: b'' CHKSUM: b'FD99' Calc CHKSUM: FD99 BMS Serial Number: Pack Serial Number: -> Outgoing Data: b'~25014642E002FFFD05\r' <- Incoming data: b'~25014642E002FFFD05\r' SOI: 0x7e VER: b'25' ADR: b'01' CID1 (Type): b'46' RTN: b'42' LENGTH: b'E002' - LCHKSUM: 69 - LENID: b'002' - LENID (int): 2 INFO: b'FF' CHKSUM: b'FD05' Calc CHKSUM: FD05 Error parsing BMS analog data: invalid literal for int() with base 16: b'' Error retrieving BMS analog data: Error parsing BMS analog data: invalid literal for int() with base 16: b'' Any idea what I sholuld do ?? Thanks Seems like your Rx and Tx lines are either shorted somewhere or for some other reason you are reading back the exact commands being sent out. What does your setup look like, and how is your IP to serial converter configured? Should be in TCP Server mode
July 16, 20232 yr HI, Thank you for your replay.I,m now on short holiday, I will be back on friday and I chack the wiring and send you my cofiguration.
July 21, 20232 yr Hi, You have right...I have had bad wiring...After fixing seems to work well. I can confirm that now i it work well with BMS PACE ver: P16S100A-21265-1.03. Batteries producer: Yechuang I have 3 Pack 15KWh each. Thank you for great work and support.
October 2, 20232 yr Hi I have 3x Leoch lfeli-48200tb. When paraller install, maximum charge current 20A/batterypack, This is not enought my install (3x5kw inverter). Therefore i change my batterypack dip switch standalone mod. My question is, is there any way to start the program 3 times or add 3 serial ports somehow? Thanks!
December 6, 20232 yr Sorry but I am struggeling with the basics. I do have a System from Tewaycell Tewaycell 48V 200Ah 10Kwh All-in-one Mobile ESS Built-in Hybrid Invert and they provided a RS232 to USB Cable with it. They also sent the PACEexTool but its completely in Chinese. Now i found your Home Assistant integration. 😀 Can you explain a bit more how i do get the basic connection? I think i need to install the USB driver for Linux first on the Homeassistant Raspberry. Is that possible? Then i have questions for the requirements: paho_mqtt==1.6.1 PyYAML==6.0.1 pyserial==3.5 I dont know how to get the reuirements. I have Mosquito MQTT and use it already for my OpenDTU and ESP32
January 16, 20242 yr Hi, @XBoxBro Did you already fix your probs? I am strandet at same point as you I also have home assistant running with mosquito as mqtt server. I manged to add "BMS Pace Interface" but do not know who to get on. The protokoll shows up with this: Hello BMS Pace Starting up... Loading options.json Config: {"mqtt_host": "10.0.0.132", "mqtt_port": 1883, "mqtt_user": "mqtt-users", "mqtt_password": "mqtt", "mqtt_ha_discovery": true, "mqtt_ha_discovery_topic": "homeassistant", "mqtt_base_topic": "bmspace", "connection_type": "Serial", "bms_ip": "10.0.0.161", "bms_port": 5000, "bms_serial": "/dev/ttyUSB0", "scan_interval": 5, "debug_output": 0} Connection Type: Serial Traceback (most recent call last): File "/workdir/./bms.py", line 75, in <module> client.connect(config['mqtt_host'], config['mqtt_port'], 60) File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 914, in connect return self.reconnect() File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1044, in reconnect sock = self._create_socket_connection() File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source) File "/usr/local/lib/python3.9/socket.py", line 844, in create_connection raise err File "/usr/local/lib/python3.9/socket.py", line 832, in create_connection sock.connect(sa) socket.timeout: timed out I don´t even know how to get "paho_mqtt" (if I can not use mosquito) M
March 12, 20242 yr Hi @DocFog Yes i did it! TODAY My setup: Batterysystem: https://tewaycell.com/products/tewaycell-48v-200ah-10kwh-all-in-one-mobile-ess-built-in-hybrid-inverter?variant=41313098858553 Rs232to Eth: https://www.waveshare.com/wiki/RS485_TO_WIFI/ETH Installed bmspace Addon- its really JUST install the addon. NO prerequisits needed! Configured: Configured the Waveshare (with VirCom_en.exe) as follows: Afterwards the Addon could connect and i directly retrieved: Quote Pack Serial Number:xxxxxxxxxxxxxxxxx Packs: 1 Pack 1, Total cells: 16 Pack 1, V Cell1: 3281 mV Pack 1, V Cell2: 3280 mV Pack 1, V Cell3: 3281 mV Pack 1, V Cell4: 3281 mV Pack 1, V Cell5: 3281 mV Pack 1, V Cell6: 3280 mV Pack 1, V Cell7: 3280 mV Pack 1, V Cell8: 3280 mV Pack 1, V Cell9: 3280 mV Pack 1, V Cell10: 3280 mV Pack 1, V Cell11: 3279 mV Pack 1, V Cell12: 3279 mV Pack 1, V Cell13: 3279 mV Pack 1, V Cell14: 3279 mV Pack 1, V Cell15: 3279 mV Pack 1, V Cell16: 3278 mV Pack 1, Cell Max Diff Volt Calc: 3 mV Pack 1, Total temperature sensors: 6 Pack 1, Temp1: 23.7 ℃ Pack 1, Temp2: 22.0 ℃ Pack 1, Temp3: 20.3 ℃ Pack 1, Temp4: 19.5 ℃ Pack 1, Temp5: 29.8 ℃ Pack 1, Temp6: 26.4 ℃ Pack 1, I Pack: -1.17 A Pack 1, V Pack: 52.477 V Pack 1, I Remaining Capacity: 73750 mAh Pack 1, I Full Capacity: 200000 mAh Pack 1, SOC: 36.88 % Pack 1, Cycles: 15 Pack 1, Design Capacity: 190000 mAh Pack 1, SOH: 105.26 % Script running.... Pack Remaining Capacity: 73750 mAh Pack Full Capacity: 200000 mAh Pack Design Capacity: 190000 mAh Pack SOC: 36.88 % Pack SOH: 105.26 % Packs for warnings: 1 Pack 1, warnings: Pack 1, balancing1: 00000000 Pack 1, balancing2: 00000000 Publishing HA Discovery topic... Many thanks for this Addon !!!!!!
March 16, 20242 yr Hi I do also have the Waveshare RS485/Lan Adapter hanging on RS485, works fine on delivering data to my ioBroker Is it possible to get the data into HA parallel to ioBroker? THx
April 20, 20242 yr On 2024/03/16 at 12:10 PM, 4711Austria said: Hi I do also have the Waveshare RS485/Lan Adapter hanging on RS485, works fine on delivering data to my ioBroker Is it possible to get the data into HA parallel to ioBroker? THx Hi, I am wondering how you connected this. Does the adpater push the data directly to ioBroker or ioBroker polls the data from the adapter? Also does it read all the data from all paralleled batteries?
August 13, 20241 yr Hi @tertiuscpt i have error when connect pararel battery with comunication. Settup DIP battery 1 (on,off,off,off) battery 2(off,on,off,off) i follow user manual on pacebms. Only pack 1 can be read. Here this log: Quote VER: b'25' ADR: b'01' CID1 (Type): b'46' RTN: b'00' LENGTH: b'B050' LCHKSUM: 66 LENID: b'050' LENID (int): 80 INFO: b'36303332363031363230373237303030310000002020202000000000000000000000000000000000' CHKSUM: b'EE31' Calc CHKSUM: EE31 BMS Serial Number: 603260162072700 Pack Serial Number: -> Outgoing Data: b'~25014642E002FFFD05\r' <- Incoming data: b'~25014600307600030F0D030D040CFC0CFD0CFE0CFE0CFE0CFE0CFE0CFE0CFF0CFF0CFF0CFF0CFF060BC20BC20BC20BCE0BDC0BEC0000C2EC285700287400032710E271\r' SOI: 0x7e VER: b'25' ADR: b'01' CID1 (Type): b'46' RTN: b'00' LENGTH: b'3076' LCHKSUM: 51 LENID: b'076' LENID (int): 118 INFO: b'00030F0D030D040CFC0CFD0CFE0CFE0CFE0CFE0CFE0CFE0CFF0CFF0CFF0CFF0CFF060BC20BC20BC20BCE0BDC0BEC0000C2EC285700287400032710' CHKSUM: b'E271' Calc CHKSUM: E271 Packs: 3 Pack 1, Total cells: 15 Pack 1, V Cell1: 3331 mV Pack 1, V Cell2: 3332 mV Pack 1, V Cell3: 3324 mV Pack 1, V Cell4: 3325 mV Pack 1, V Cell5: 3326 mV Pack 1, V Cell6: 3326 mV Pack 1, V Cell7: 3326 mV Pack 1, V Cell8: 3326 mV Pack 1, V Cell9: 3326 mV Pack 1, V Cell10: 3326 mV Pack 1, V Cell11: 3327 mV Pack 1, V Cell12: 3327 mV Pack 1, V Cell13: 3327 mV Pack 1, V Cell14: 3327 mV Pack 1, V Cell15: 3327 mV Pack 1, Cell Max Diff Volt Calc: 8 mV Pack 1, Total temperature sensors: 6 Pack 1, Temp1: 28.0 ℃ Pack 1, Temp2: 28.0 ℃ Pack 1, Temp3: 28.0 ℃ Pack 1, Temp4: 29.2 ℃ Pack 1, Temp5: 30.6 ℃ Pack 1, Temp6: 32.2 ℃ Pack 1, I Pack: 0.0 A Pack 1, V Pack: 49.9 V Pack 1, I Remaining Capacity: 103270 mAh Pack 1, I Full Capacity: 103560 mAh Pack 1, SOC: 99.72 % Pack 1, Cycles: 3 Pack 1, Design Capacity: 100000 mAh Pack 1, SOH: 103.56 % Error parsing BMS analog data: invalid literal for int() with base 16: b'' Error retrieving BMS analog data: Error parsing BMS analog data: invalid literal for int() with base 16: b'' -> Outgoing Data: b'~250146A60000FD97\r' <- Incoming data: b'~25014600400C285728742710FB22\r' SOI: 0x7e VER: b'25' ADR: b'01' CID1 (Type): b'46' RTN: b'00' LENGTH: b'400C' LCHKSUM: 52 LENID: b'00C' LENID (int): 12 INFO: b'285728742710' CHKSUM: b'FB22' Calc CHKSUM: FB22 Pack Remaining Capacity: 103270 mAh Pack Full Capacity: 103560 mAh Pack Design Capacity: 100000 mAh Pack SOC: 99.72 % Pack SOH: 103.56 % -> Outgoing Data: b'~25014644E002FFFD03\r' <- Incoming data: b'~25014600204A00030F00000000000000000000000000000006000000000000000000008006010000000000EF89\r' SOI: 0x7e VER: b'25' ADR: b'01' CID1 (Type): b'46' RTN: b'00' LENGTH: b'204A' LCHKSUM: 50 LENID: b'04A' LENID (int): 74 INFO: b'00030F00000000000000000000000000000006000000000000000000008006010000000000' CHKSUM: b'EF89' Calc CHKSUM: EF89 Packs for warnings: 3 Pack 1, warnings: Protection State 2: Fully, Control State: Buzzer warn function enabled Pack 1, balancing1: 00000000 Pack 1, balancing2: 00000000 Error parsing BMS warning data: invalid literal for int() with base 16: b'' Error retrieving BMS warning info: Error parsing BMS warning data: invalid literal for int() with base 16: b'' Edited August 13, 20241 yr by Shingsam
December 7, 20241 yr Is there anybody that can help with the pinout for a RS232 to RJ 11 for the Revov B100 battery. There does not seem to be a standard pinout for this and I have found 3 different ones online.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.