diy solar

diy solar

Monitoring Jakiper ( maybe SOK too?) server rack batteries via modbus to Esp8266 mqtt

Cool project. It'd be great if you could publish a Home Assistant auto discovery topic to MQTT so all the data would automatically show up in HA.

And using GitHub release tags would make it much easier for users to track versions.
I don't use Home Assistant and don't know anything about that. Also I am working with Graham who is the coding wizard who makes this happen.
You can suggest this to him on the github link. I will try to figure out the release tags thing since I barely understand github.
Thanks
 
Cool project. It'd be great if you could publish a Home Assistant auto discovery topic to MQTT so all the data would automatically show up in HA.

And using GitHub release tags would make it much easier for users to track versions.

Came across this info, might be useful.

 
Came across this info, might be useful.

Yeah, that would be nice if you've got an existing serial connection to the BMS.

The nice thing about adding the HA autodiscovery topics is that this project is already pulling the data into MQTT topics. With just a few lines of code, those topics can be read by HA as sensors automatically with no config. If you don't use HA, it's just some MQTT data on your broker.
 
Came across this info, might be useful.

thanks I will check that out
 
I have added a Python implementation to the https://github.com/ClassicDIY/PylonToMQTT project, the ESP32 version has been tested with a Jakiper 3 pack P16S100A using the console RS232 port.

If someone would like try out the python version to see if it works with the Jakiper console to USB cable and let me know if you get anything.

There are install instructions for the Raspberry Pi in the projects wiki pages (https://github.com/ClassicDIY/PylonToMQTT/wiki/4-Python-Implementation)
I've been testing using docker (option 2)
This should also work with SOK batteries since they use the same BMS
 
I tried today the python implementation on a Raspberry Pi and it couldn't connect with the batteries. I'm not sue if it is from the cable or some drivers, or the newer batteries JK48V100PRO. Using the same cable from a Windows PC I can connect with PbmsTools and monitor the batteries.

Here is the log from the execution:
Code:
2022-10-24 15:14:04,733:INFO:PylonToMQTT:pylon_mqtt starting up...
2022-10-24 15:14:04,744:INFO:PylonToMQTT:pylonPort = /dev/ttyUSB0
2022-10-24 15:14:04,744:INFO:PylonToMQTT:rackName = Main
2022-10-24 15:14:04,744:INFO:PylonToMQTT:mqttHost = localhost
2022-10-24 15:14:04,744:INFO:PylonToMQTT:mqttPort = 1883
2022-10-24 15:14:04,745:INFO:PylonToMQTT:mqttRoot = PylonToMQTT
2022-10-24 15:14:04,745:INFO:PylonToMQTT:mqttUser = node_red
2022-10-24 15:14:04,745:INFO:PylonToMQTT:mqttPassword = **********
2022-10-24 15:14:04,745:INFO:PylonToMQTT:publishRate = 10
2022-10-24 15:14:04,745:INFO:PylonToMQTT:Connecting with clientId=node_red_mqttclient_221
2022-10-24 15:14:04,745:INFO:PylonToMQTT:Connecting to MQTT localhost:1883
2022-10-24 15:14:04,748:DEBUG:PylonToMQTT:MQTT connected OK Returned code=0
2022-10-24 15:14:04,749:DEBUG:PylonToMQTT:Starting main loop...
2022-10-24 15:14:04,749:DEBUG:PylonToMQTT:Subscribed to PylonToMQTT/Main/cmnd/#
2022-10-24 15:14:16,752:ERROR:PylonToMQTT:Caught Error in periodic
2022-10-24 15:14:16,753:ERROR:PylonToMQTT:invalid literal for int() with base 16: b''
Traceback (most recent call last):
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/pylon_to_mqtt.py", line 171, in periodic
    number_of_packs = p.get_pack_count().PackCount
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/support/pylontech.py", line 143, in get_pack_count
    f =  self.read_frame()
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/support/pylontech.py", line 137, in read_frame
    f = self._decode_hw_frame(raw_frame=raw_frame)
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/support/pylontech.py", line 121, in _decode_hw_frame
    assert got_frame_checksum == int(frame_chksum, 16)
ValueError: invalid literal for int() with base 16: b''

It looks like that the Raspberry Pi doesn't receive any response. I haven't tried the EPS32 version because my ESP board wasn't compatible with the flasher. I have to look for another board and try again in the near future.
 
I tried today the python implementation on a Raspberry Pi and it couldn't connect with the batteries. I'm not sue if it is from the cable or some drivers, or the newer batteries JK48V100PRO. Using the same cable from a Windows PC I can connect with PbmsTools and monitor the batteries.

Here is the log from the execution:
Code:
2022-10-24 15:14:04,733:INFO:PylonToMQTT:pylon_mqtt starting up...
2022-10-24 15:14:04,744:INFO:PylonToMQTT:pylonPort = /dev/ttyUSB0
2022-10-24 15:14:04,744:INFO:PylonToMQTT:rackName = Main
2022-10-24 15:14:04,744:INFO:PylonToMQTT:mqttHost = localhost
2022-10-24 15:14:04,744:INFO:PylonToMQTT:mqttPort = 1883
2022-10-24 15:14:04,745:INFO:PylonToMQTT:mqttRoot = PylonToMQTT
2022-10-24 15:14:04,745:INFO:PylonToMQTT:mqttUser = node_red
2022-10-24 15:14:04,745:INFO:PylonToMQTT:mqttPassword = **********
2022-10-24 15:14:04,745:INFO:PylonToMQTT:publishRate = 10
2022-10-24 15:14:04,745:INFO:PylonToMQTT:Connecting with clientId=node_red_mqttclient_221
2022-10-24 15:14:04,745:INFO:PylonToMQTT:Connecting to MQTT localhost:1883
2022-10-24 15:14:04,748:DEBUG:PylonToMQTT:MQTT connected OK Returned code=0
2022-10-24 15:14:04,749:DEBUG:PylonToMQTT:Starting main loop...
2022-10-24 15:14:04,749:DEBUG:PylonToMQTT:Subscribed to PylonToMQTT/Main/cmnd/#
2022-10-24 15:14:16,752:ERROR:PylonToMQTT:Caught Error in periodic
2022-10-24 15:14:16,753:ERROR:PylonToMQTT:invalid literal for int() with base 16: b''
Traceback (most recent call last):
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/pylon_to_mqtt.py", line 171, in periodic
    number_of_packs = p.get_pack_count().PackCount
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/support/pylontech.py", line 143, in get_pack_count
    f =  self.read_frame()
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/support/pylontech.py", line 137, in read_frame
    f = self._decode_hw_frame(raw_frame=raw_frame)
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/support/pylontech.py", line 121, in _decode_hw_frame
    assert got_frame_checksum == int(frame_chksum, 16)
ValueError: invalid literal for int() with base 16: b''

It looks like that the Raspberry Pi doesn't receive any response. I haven't tried the EPS32 version because my ESP board wasn't compatible with the flasher. I have to look for another board and try again in the near future.
I had some problems with the Raspberry Pi also - Graham is working on it . Not sure when you downloaded that , but keep an eye on the github pages since Graham has been working on the fix.
I did get a little bit further along in that my pi did communicate with the battery before I got errors. Here is my log in case it is of some help to you. This is from using stand along method 1.

ast login: Sun Oct 23 21:46:01 2022 from 192.168.3.34
pi@pylontomqtt:~ $ ls
main.zip PylonToMQTT-main
pi@pylontomqtt:~ $ cd PylonToMQTT-main/Code/Python/
pi@pylontomqtt:~/PylonToMQTT-main/Code/Python $ ls
compose-override.yml LICENSE.md support
docker-compose.yml __pycache__ telegraf.conf
Dockerfile pylon_to_mqtt.py
IOTStack_docker-compose.yml README.md
pi@pylontomqtt:~/PylonToMQTT-main/Code/Python $ python3 pylon_to_mqtt.py --pylon _port /dev/ttyUSB0 --rack_name Main --mqtt_host 192.168.3.73 --mqtt_root PylonTo MQTT --publish_rate 5
2022-10-23 22:53:42,093:INFO:pylonToMQTT:pylon_mqtt starting up...
2022-10-23 22:53:42,172:INFO:pylonToMQTT:pylonPort = /dev/ttyUSB0
2022-10-23 22:53:42,176:INFO:pylonToMQTT:rackName = Main
2022-10-23 22:53:42,181:INFO:pylonToMQTT:mqttHost = 192.168.3.73
2022-10-23 22:53:42,186:INFO:pylonToMQTT:mqttPort = 1883
2022-10-23 22:53:42,190:INFO:pylonToMQTT:mqttRoot = PylonToMQTT
2022-10-23 22:53:42,195:INFO:pylonToMQTT:mqttUser =
2022-10-23 22:53:42,200:INFO:pylonToMQTT:mqttPassword = **********
2022-10-23 22:53:42,205:INFO:pylonToMQTT:publishRate = 5
2022-10-23 22:53:42,210:INFO:pylonToMQTT:Connecting with clientId=_mqttclient_82 3
2022-10-23 22:53:42,216:INFO:pylonToMQTT:Connecting to MQTT 192.168.3.73:1883
2022-10-23 22:53:42,282:DEBUG:pylonToMQTT:MQTT connected OK Returned code=0
2022-10-23 22:53:42,287:DEBUG:pylonToMQTT:Starting main loop...
2022-10-23 22:53:42,296:DEBUG:pylonToMQTT:Subscribed to PylonToMQTT/Main/cmnd/#
2022-10-23 22:53:49,357:DEBUG:pylonToMQTT:pack count: 3
2022-10-23 22:53:54,420:DEBUG:pylonToMQTT:version_info: P16S100A-1B470-1.04
2022-10-23 22:53:56,599:DEBUG:pylonToMQTT:barcode: 1B470102010238D
2022-10-23 22:53:56,605:DEBUG:pylonToMQTT:publishing: PylonToMQTT/Main/stat/info /Pack1
2022-10-23 22:53:58,691:ERROR:pylonToMQTT:Caught Error in periodic
2022-10-23 22:53:58,696:ERROR:pylonToMQTT:Error in path (parsing) -> NumberOfCel ls
stream read less than specified amount, expected 1, found 0
Traceback (most recent call last):
File "/home/pi/PylonToMQTT-main/Code/Python/pylon_to_mqtt.py", line 186, in pe riodic
ai = p.get_alarm_info(current_pack)
File "/home/pi/PylonToMQTT-main/Code/Python/support/pylontech.py", line 168, i n get_alarm_info
return self.get_alarm_fmt.parse(f.info[1:])
 
Last edited:
It looks like that the Raspberry Pi doesn't receive any response. I haven't tried the EPS32 version because my ESP board wasn't compatible with the flasher. I have to look for another board and try again in the near future.
Which Esp32 board do you have ? What are you using to flash your esp32 ?
If you use Platformio or Arduino you should be able to choose which ever board you want.
I used Platformio on VSCode and there was a learning curve to figure out how to use it.
There may be a way to make a bin file to flash specific to your board - I can look into how to do that or ask Graham about it.
 
I'm using Wemos D1 Mini or a clone I don't know. It is very useful for flashing Tasmota. I made a couple of sensonrs using DHT22 or BMP280. For flashing I used the included flasher.exe. Here is the output:

Code:
←[31m
********* You may need to press the Boot button for a few seconds to start the flashing process *********
←[0m
esptool.py v4.4-dev
Serial port COM5
Connecting....
WARNING: This chip doesn't appear to be a ESP32 (chip magic value 0xfff0c101). Probably it is unsupported by this version of esptool.
Chip is ESP32-D0WDQ6 (revision v0.0)
Features: WiFi, BT, Dual Core, Coding Scheme None
WARNING: Detected crystal freq 0.00MHz is quite different to normalized freq 26MHz. Unsupported crystal in use?
Crystal is 26MHz
MAC: 00:00:00:00:00:00
Uploading stub...
←[31m
Connect error:
←[0m Failed to enter RAM download mode. Only got 2 byte status response
Tried GPIO0 to ground or holding the reset button and nothing worked.
I can flash the board using Arduino. Haven't used esptool for flashing. Probably there is some configuration that can be tweaked for this chip. I can flash the firmware with Tasmotizer but I can't upload the Wifi configuration. Anyway I'll look into this in details in the next few days.
 
I'm using Wemos D1 Mini or a clone I don't know. It is very useful for flashing Tasmota. I made a couple of sensonrs using DHT22 or BMP280. For flashing I used the included flasher.exe. Here is the output:
The code is written for the ESP32, so the D1 Mini won't work (it's an ESP8266-based board).
 
I'm using Wemos D1 Mini or a clone I don't know. It is very useful for flashing Tasmota. I made a couple of sensonrs using DHT22 or BMP280. For flashing I used the included flasher.exe. Here is the output:

Code:
←[31m
********* You may need to press the Boot button for a few seconds to start the flashing process *********
←[0m
esptool.py v4.4-dev
Serial port COM5
Connecting....
WARNING: This chip doesn't appear to be a ESP32 (chip magic value 0xfff0c101). Probably it is unsupported by this version of esptool.
Chip is ESP32-D0WDQ6 (revision v0.0)
Features: WiFi, BT, Dual Core, Coding Scheme None
WARNING: Detected crystal freq 0.00MHz is quite different to normalized freq 26MHz. Unsupported crystal in use?
Crystal is 26MHz
MAC: 00:00:00:00:00:00
Uploading stub...
←[31m
Connect error:
←[0m Failed to enter RAM download mode. Only got 2 byte status response
Tried GPIO0 to ground or holding the reset button and nothing worked.
I can flash the board using Arduino. Haven't used esptool for flashing. Probably there is some configuration that can be tweaked for this chip. I can flash the firmware with Tasmotizer but I can't upload the Wifi configuration. Anyway I'll look into this in details in the next few days.
yeah you should get an esp32 - I think this project needed the extra memory that esp32 has that esp8266 like you have .
Oh I see yours says it is an esp32 -- might work if you change the board when you flash it - not sure . Yes in Arduino you can select the board that is what you have.
Yeah Tasmota is great - made my life a lot easier compared to when I started messing around with esp boards.
examples
 
I updated my Grafana monitor today - added in cell differential . What Graham was working on is the ability to have one Raspberry Pi that plugs into batteries , and then will also run all the programs needed to make Grafana screen like this which would be accessible by any web browser on the network. I am using the Esp32 version now and sending the data to a raspberry pi on my network. It was cloudy here today so not much charging going on in capture shown.
1666661092103.png
 
I tried today the python implementation on a Raspberry Pi and it couldn't connect with the batteries. I'm not sue if it is from the cable or some drivers, or the newer batteries JK48V100PRO. Using the same cable from a Windows PC I can connect with PbmsTools and monitor the batteries.

Here is the log from the execution:
Code:
2022-10-24 15:14:04,733:INFO:PylonToMQTT:pylon_mqtt starting up...
2022-10-24 15:14:04,744:INFO:PylonToMQTT:pylonPort = /dev/ttyUSB0
2022-10-24 15:14:04,744:INFO:PylonToMQTT:rackName = Main
2022-10-24 15:14:04,744:INFO:PylonToMQTT:mqttHost = localhost
2022-10-24 15:14:04,744:INFO:PylonToMQTT:mqttPort = 1883
2022-10-24 15:14:04,745:INFO:PylonToMQTT:mqttRoot = PylonToMQTT
2022-10-24 15:14:04,745:INFO:PylonToMQTT:mqttUser = node_red
2022-10-24 15:14:04,745:INFO:PylonToMQTT:mqttPassword = **********
2022-10-24 15:14:04,745:INFO:PylonToMQTT:publishRate = 10
2022-10-24 15:14:04,745:INFO:PylonToMQTT:Connecting with clientId=node_red_mqttclient_221
2022-10-24 15:14:04,745:INFO:PylonToMQTT:Connecting to MQTT localhost:1883
2022-10-24 15:14:04,748:DEBUG:PylonToMQTT:MQTT connected OK Returned code=0
2022-10-24 15:14:04,749:DEBUG:PylonToMQTT:Starting main loop...
2022-10-24 15:14:04,749:DEBUG:PylonToMQTT:Subscribed to PylonToMQTT/Main/cmnd/#
2022-10-24 15:14:16,752:ERROR:PylonToMQTT:Caught Error in periodic
2022-10-24 15:14:16,753:ERROR:PylonToMQTT:invalid literal for int() with base 16: b''
Traceback (most recent call last):
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/pylon_to_mqtt.py", line 171, in periodic
    number_of_packs = p.get_pack_count().PackCount
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/support/pylontech.py", line 143, in get_pack_count
    f =  self.read_frame()
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/support/pylontech.py", line 137, in read_frame
    f = self._decode_hw_frame(raw_frame=raw_frame)
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/support/pylontech.py", line 121, in _decode_hw_frame
    assert got_frame_checksum == int(frame_chksum, 16)
ValueError: invalid literal for int() with base 16: b''

It looks like that the Raspberry Pi doesn't receive any response. I haven't tried the EPS32 version because my ESP board wasn't compatible with the flasher. I have to look for another board and try again in the near future.
I had a bug where the request sent from the python code had pack 0, it should have been pack 1, hopefully Larry will help test it later today since I don't have the Jakiper battery to test against just a node-red simulator...
 
I had a bug where the request sent from the python code had pack 0, it should have been pack 1, hopefully Larry will help test it later today since I don't have the Jakiper battery to test against just a node-red simulator...
I tried the latest changes in the Python code and the outcome is the same. Cannot get the PackCount
Code:
2022-10-25 23:22:52,292:INFO:PylonToMQTT:pylon_mqtt starting up...
2022-10-25 23:22:52,310:INFO:PylonToMQTT:pylonPort = /dev/ttyUSB0
2022-10-25 23:22:52,310:INFO:PylonToMQTT:rackName = Main
2022-10-25 23:22:52,311:INFO:PylonToMQTT:mqttHost = localhost
2022-10-25 23:22:52,311:INFO:PylonToMQTT:mqttPort = 1883
2022-10-25 23:22:52,311:INFO:PylonToMQTT:mqttRoot = PylonToMQTT
2022-10-25 23:22:52,311:INFO:PylonToMQTT:mqttUser = node_red
2022-10-25 23:22:52,311:INFO:PylonToMQTT:mqttPassword = **********
2022-10-25 23:22:52,311:INFO:PylonToMQTT:publishRate = 10
2022-10-25 23:22:52,311:INFO:PylonToMQTT:Connecting with clientId=node_red_mqttclient_741
2022-10-25 23:22:52,312:INFO:PylonToMQTT:Connecting to MQTT localhost:1883
2022-10-25 23:22:52,316:DEBUG:PylonToMQTT:MQTT connected OK Returned code=0
2022-10-25 23:22:52,317:DEBUG:PylonToMQTT:Subscribed to PylonToMQTT/Main/cmnd/#
2022-10-25 23:22:52,317:DEBUG:PylonToMQTT:Starting main loop...
2022-10-25 23:23:02,317:DEBUG:PylonToMQTT:send_cmd: 7e323030303436393030303030464441420d
2022-10-25 23:23:07,323:DEBUG:PylonToMQTT:received_response:
2022-10-25 23:23:07,324:ERROR:PylonToMQTT:Failed to process response!
2022-10-25 23:23:07,324:ERROR:PylonToMQTT:invalid literal for int() with base 16: b''
Traceback (most recent call last):
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/pylon_to_mqtt.py", line 167, in periodic
    number_of_packs = p.get_pack_count().PackCount
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/support/pylontech.py", line 155, in get_pack_count
    f =  self.read_frame()
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/support/pylontech.py", line 148, in read_frame
    f = self._decode_hw_frame(raw_frame)
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/support/pylontech.py", line 129, in _decode_hw_frame
    assert got_frame_checksum == int(frame_chksum, 16)
ValueError: invalid literal for int() with base 16: b''
2022-10-25 23:23:17,329:DEBUG:PylonToMQTT:send_cmd: 7e323030303436393030303030464441420d
2022-10-25 23:23:22,335:DEBUG:PylonToMQTT:received_response:
2022-10-25 23:23:22,335:ERROR:PylonToMQTT:Failed to process response!
2022-10-25 23:23:22,336:ERROR:PylonToMQTT:invalid literal for int() with base 16: b''
I got an ESP32 and flashed it with the firmware. Tomorrow I'll plug it to the battery because it is at remote location.
Managed to configure the Wifi and after connecting to it with Putty I got a different command sent from the ESP to the battery:
Code:
[  5312][I][IOT.cpp:55] connectToMqtt(): Connecting to MQTT...
[  5318][D][IOT.cpp:67] connectToMqtt(): rootTopicPrefix: PylonToMQTT/Penevi
[  5572][D][IOT.cpp:32] onMqttConnect(): Connected to MQTT. Session present: 0
[  5575][I][IOT.cpp:37] onMqttConnect(): Subscribed to [PylonToMQTT/Penevi/cmnd/#], qos: 0
[ 10098][D][Pylon.cpp:123] send_cmd(): send_cmd: ~25FF4690E002FFFCD7
[ 20101][E][Pylon.h:34] timeout(): AsyncSerial: timeout
It gives timeout because I haven't connected the RS232 converter and the battery. Tomorrow morning I'll be testing it. Graham I hope this can help you. I have VPN access to the Raspberry Pi connected to the batteries and I can try new changes.
 
I tried the latest changes in the Python code and the outcome is the same. Cannot get the PackCount
Code:
2022-10-25 23:22:52,292:INFO:PylonToMQTT:pylon_mqtt starting up...
2022-10-25 23:22:52,310:INFO:PylonToMQTT:pylonPort = /dev/ttyUSB0
2022-10-25 23:22:52,310:INFO:PylonToMQTT:rackName = Main
2022-10-25 23:22:52,311:INFO:PylonToMQTT:mqttHost = localhost
2022-10-25 23:22:52,311:INFO:PylonToMQTT:mqttPort = 1883
2022-10-25 23:22:52,311:INFO:PylonToMQTT:mqttRoot = PylonToMQTT
2022-10-25 23:22:52,311:INFO:PylonToMQTT:mqttUser = node_red
2022-10-25 23:22:52,311:INFO:PylonToMQTT:mqttPassword = **********
2022-10-25 23:22:52,311:INFO:PylonToMQTT:publishRate = 10
2022-10-25 23:22:52,311:INFO:PylonToMQTT:Connecting with clientId=node_red_mqttclient_741
2022-10-25 23:22:52,312:INFO:PylonToMQTT:Connecting to MQTT localhost:1883
2022-10-25 23:22:52,316:DEBUG:PylonToMQTT:MQTT connected OK Returned code=0
2022-10-25 23:22:52,317:DEBUG:PylonToMQTT:Subscribed to PylonToMQTT/Main/cmnd/#
2022-10-25 23:22:52,317:DEBUG:PylonToMQTT:Starting main loop...
2022-10-25 23:23:02,317:DEBUG:PylonToMQTT:send_cmd: 7e323030303436393030303030464441420d
2022-10-25 23:23:07,323:DEBUG:PylonToMQTT:received_response:
2022-10-25 23:23:07,324:ERROR:PylonToMQTT:Failed to process response!
2022-10-25 23:23:07,324:ERROR:PylonToMQTT:invalid literal for int() with base 16: b''
Traceback (most recent call last):
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/pylon_to_mqtt.py", line 167, in periodic
    number_of_packs = p.get_pack_count().PackCount
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/support/pylontech.py", line 155, in get_pack_count
    f =  self.read_frame()
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/support/pylontech.py", line 148, in read_frame
    f = self._decode_hw_frame(raw_frame)
  File "/home/pi/PylonToMQTT/PylonToMQTT-main/Python/support/pylontech.py", line 129, in _decode_hw_frame
    assert got_frame_checksum == int(frame_chksum, 16)
ValueError: invalid literal for int() with base 16: b''
2022-10-25 23:23:17,329:DEBUG:PylonToMQTT:send_cmd: 7e323030303436393030303030464441420d
2022-10-25 23:23:22,335:DEBUG:PylonToMQTT:received_response:
2022-10-25 23:23:22,335:ERROR:PylonToMQTT:Failed to process response!
2022-10-25 23:23:22,336:ERROR:PylonToMQTT:invalid literal for int() with base 16: b''
I got an ESP32 and flashed it with the firmware. Tomorrow I'll plug it to the battery because it is at remote location.
Managed to configure the Wifi and after connecting to it with Putty I got a different command sent from the ESP to the battery:
Code:
[  5312][I][IOT.cpp:55] connectToMqtt(): Connecting to MQTT...
[  5318][D][IOT.cpp:67] connectToMqtt(): rootTopicPrefix: PylonToMQTT/Penevi
[  5572][D][IOT.cpp:32] onMqttConnect(): Connected to MQTT. Session present: 0
[  5575][I][IOT.cpp:37] onMqttConnect(): Subscribed to [PylonToMQTT/Penevi/cmnd/#], qos: 0
[ 10098][D][Pylon.cpp:123] send_cmd(): send_cmd: ~25FF4690E002FFFCD7
[ 20101][E][Pylon.h:34] timeout(): AsyncSerial: timeout
It gives timeout because I haven't connected the RS232 converter and the battery. Tomorrow morning I'll be testing it. Graham I hope this can help you. I have VPN access to the Raspberry Pi connected to the batteries and I can try new changes.
Yeah there is still a bug with the raspberry pi part of this. The esp32 works fine for me. Let me know if you have any problems getting the esp32 working . I use mqtt.fx program to find out if mqtt is working - you connect up to your mqtt server , and then you can subscribe to # it will show anything being published by the server. With that info you can setup the telegraf, influxdb, and grafana to get the data and display it.
 
Back
Top