diy solar

diy solar

JBD / Overkill BMS Monitoring

No update from creator, I was told it won't work with HASSIO, need to be running Core install of Home Assistant, Joe.
 
Great thread. Much learning to do but I see a path, just need some help getting started. My solar batteries/jbd bms(s) (8s2p) are remote and I have a pi3 connected to a cellular modem so that I have vnc and ssh access from anywhere. Pi is running raspian buster. (have not updated python from what ever was the default with Buster).
I can see the JBD BT devices and addresses with the Pi3 bluetooth. I'm hoping to get the bms data (just the data to start) and later put it into a database and pretty graphical format as shown in this thread.

First attempt to get a connection and data with the python script has failed. Not sure if I'm proceeding correctly and could use some pointers.
I have run the following commands via a ssh connection and get the following:

pi@raspberrypi:~/Downloads/bms-main $ python jbdbms-8-socket.py -b A4:C1:38:88:59:5E -i 10 -m jbdbms
File "jbdbms-8-socket.py", line 45
print(f'Error creating socket: {e}')
^
SyntaxError: invalid syntax

Help appreciated, I realize this thread is beyond were I'm getting stuck. Hoping someone can assist. thanks.
 
Great thread. Much learning to do but I see a path, just need some help getting started. My solar batteries/jbd bms(s) (8s2p) are remote and I have a pi3 connected to a cellular modem so that I have vnc and ssh access from anywhere. Pi is running raspian buster. (have not updated python from what ever was the default with Buster).
I can see the JBD BT devices and addresses with the Pi3 bluetooth. I'm hoping to get the bms data (just the data to start) and later put it into a database and pretty graphical format as shown in this thread.

First attempt to get a connection and data with the python script has failed. Not sure if I'm proceeding correctly and could use some pointers.
I have run the following commands via a ssh connection and get the following:

pi@raspberrypi:~/Downloads/bms-main $ python jbdbms-8-socket.py -b A4:C1:38:88:59:5E -i 10 -m jbdbms
File "jbdbms-8-socket.py", line 45
print(f'Error creating socket: {e}')
^
SyntaxError: invalid syntax

Help appreciated, I realize this thread is beyond were I'm getting stuck. Hoping someone can assist. thanks.
I'm by no means an expert here, but the F-string print function was introduced in Python 3.6. Raspian Buster came with Python 2.7 or something. Your "python" in the command line will use 2.7. If you have a newer version of python, use "python3.9" or whatever version you have installed. Try "python --version" or "python3.9(or whatever) --version" to see what you have installed.

Verify you have, or install python 3.9 and try "python3.9 jbdbms-8-socket.py -b A4:C1:38:88:59:5E -i 10 -m jbdbms"
 
Thanks. I got Python3.9 installed and attempted to run the script. Closer perhaps, but still no success. Following error message:


pi@raspberrypi:~/Downloads/bms-main $ python3.9 jbdbms-8-socket.py -b A4:C1:38:88:59:5E -i 10 -m jbdbms
Traceback (most recent call last):
File "/home/pi/Downloads/bms-main/jbdbms-8-socket.py", line 5, in <module>
from bluepy.btle import Peripheral, DefaultDelegate, BTLEException
ModuleNotFoundError: No module named 'bluepy'
 
As the error message stated: Have you installed bluepy at all?

Followed the instructions and installed bluepy on the pi3. I believed it installed correctly. The command "sudo blescan" resulted in the following:
Device (new): a4:c1:38:88:59:5e (public), -72 dBm
Flags: <06>
Incomplete 16b Services: <0000ff00-0000-1000-8000-00805f9b34fb>
Manufacturer: <5e598838c1a4>
Complete Local Name: 'BMS1'
Device (new): a4:c1:38:2e:67:91 (public), -78 dBm
Flags: <06>
Incomplete 16b Services: <0000ff00-0000-1000-8000-00805f9b34fb>
Manufacturer: <91672e38c1a4>
Complete Local Name: 'BMS1'


However running the below yields the same "ModuleNotFound Error: No module named 'bluepy"

pi@raspberrypi:~ $ python3.9 /home/pi/Downloads/bms-main/jbdbms-8-socket.py -b A4:C1:38:88:59:5E -i 10 -m jbdbms
Traceback (most recent call last):
File "/home/pi/Downloads/bms-main/jbdbms-8-socket.py", line 5, in <module>
from bluepy.btle import Peripheral, DefaultDelegate, BTLEException
ModuleNotFoundError: No module named 'bluepy'


Most likely something simple I'm still missing. Perhaps problems with how everything installed. Tried the below commands to get some information to help figure things out. Did not help me, but perhaps it will help others in recommending more potential solutions to try. thanks.

pi@raspberrypi:~/Downloads/bms-main $ find /usr -name "bluepy"
/usr/local/lib/python3.5/dist-packages/bluepy
/usr/local/lib/python2.7/dist-packages/bluepy

pi@raspberrypi:~/Downloads/bms-main $ python -V
Python 3.9.0
 
Probably because the first command is run as the root user and the other as a regular user. Either run the second command with sudo, or install bluepy for the regular user (pip install --user bluepy or something like that).
 
It looks like bluepy is installed for python2.7 and python3.5, but not python3.9. You need bluepy installed for python3.9.

Maybe something like:
~ sudo python3.9 -m pip install bluepy.

I haven't tried it.
 
Thanks. Getting closer. Discovering one issue at a time. See below. Does this look partially correct? Next step?

pi@raspberrypi:~/Downloads/bms-main $ python jbdbms-8-socket.py -b A4:C1:38:88:59:5E -i 10 -m jbdbmscd
attempting to connect
connected A4:C1:38:88:59:5E
Error creating socket: [Errno 2] No such file or directory
meter,cell1,cell2,cell3,cell4,cell5,cell6,cell7,cell8
jbdbmscd,3310,3311,3310,3312,3311,3312,3313,3314
meter,cellmin,cellmax,delta
jbdbmscd,3310,3314,4
meter,volts,amps,watts,remain,capacity,cycles
jbdbmscd,26.49,-2.08,-55.10,128,180,2
meter,c01,c02,c03,c04,c05,c06,c07,c08
jbdbmscd,0,0,0,0,0,0,0,0
meter,c09,c10,c11,c12,c13,c14,c15,c16
jbdbmscd,0,0,0,0,0,0,0,0
Traceback (most recent call last):
File "/home/pi/Downloads/bms-main/jbdbms-8-socket.py", line 185, in <module>
bms.waitForNotifications(5)
File "/home/pi/.local/lib/python3.9/site-packages/bluepy/btle.py", line 560, in waitForNotifications
resp = self._getResp(['ntfy','ind'], timeout)
File "/home/pi/.local/lib/python3.9/site-packages/bluepy/btle.py", line 416, in _getResp
self.delegate.handleNotification(hnd, data)
File "/home/pi/Downloads/bms-main/jbdbms-8-socket.py", line 153, in handleNotification
cellinfo1(data)
File "/home/pi/Downloads/bms-main/jbdbms-8-socket.py", line 67, in cellinfo1
volts, amps, remain, capacity, cycles, mdate, balance1, balance2 = struct.unpack_from('>HhHHHHHH', infodata, i)
struct.error: unpack_from requires a buffer of at least 20 bytes for unpacking 16 bytes at offset 4 (actual buffer size is 6)
Error closing socket: 'StatsReporter' object has no attribute '_sock'




Perhaps not important, but the python and bluepy install directory is different for 3.9 compared to the lower versions.
pi@raspberrypi:~ $ find /usr -name "bluepy"
/usr/local/lib/python3.5/dist-packages/bluepy
/usr/local/lib/python2.7/dist-packages/bluepy
/usr/lib/python3.9/site-packages/bluepy
 
Error creating socket: [Errno 2] No such file or directory
You're connected to the BMS and pulling data. It's erroring on the socket creation. I went with paho mqtt in the mqtt version of the code, not the socket in Telegraf, so I'm not familiar with that approach..

I would suggest looking at your Telegraf installation and matching that up with your code.
 
One step at a time. Slowly getting there. Not without my share of issues. Followed the the instructions from the bms-main folder with other google searches and installed telgraf, influxdb, and granfana. I seem to have it all running. At least reading data and building a database. Still having issue with Grafana. Hoping to get some verification that I'm on the right path and suggestion as to getting the graphical display with grafana

Grafana is giving me this error:

If you're seeing this Grafana has failed to load its application files
1. This could be caused by your reverse proxy settings.
2. If you host grafana under subpath make sure your grafana.ini root_url setting includes subpath. If not using a reverse proxy make sure to set serve_from_sub_path to true.
3. If you have a local dev build make sure you build frontend using: yarn start, yarn start:hot, or yarn build
4. Sometimes restarting grafana-server can help
5. Check if you are using a non-supported browser. For more information, refer to the list of supported browsers.

============================================================================
Here is the output from jdbms.py and telegraf --debug

pi@raspberrypi:~/Downloads/bms-main $ python jbdbms-8-socket.py -b A4:C1:38:88:59:5E -i 10 -m jbdbmscd

attempting to connect
connected A4:C1:38:88:59:5E
Error creating socket: [Errno 2] No such file or directory

meter,ovp,uvp,bov,buv,cot,cut,dot,dut,coc,duc,sc,ic,cnf
jbdbmscd,0,0,0,0,0,0,0,0,0,0,0,0,0

meter,protect,percent,fet,cells,temp1,temp2
jbdbmscd,0,63,3,8,9.0,8.9

meter,cell1,cell2,cell3,cell4,cell5,cell6,cell7,cell8
jbdbmscd,3377,3363,3373,3376,3380,3380,3379,3380

meter,cellmin,cellmax,delta
jbdbmscd,3363,3380,17

meter,volts,amps,watts,remain,capacity,cycles
jbdbmscd,27.01,6.74,182.05,113,180,2

meter,c01,c02,c03,c04,c05,c06,c07,c08
jbdbmscd,0,0,0,0,0,0,0,0

meter,c09,c10,c11,c12,c13,c14,c15,c16
jbdbmscd,0,0,0,0,0,0,0,0


=====================================================================
pi@raspberrypi:~ $ telegraf --debug
2021-12-02T19:57:42Z I! Starting Telegraf 1.20.4
2021-12-02T19:57:42Z I! Using config file: /etc/telegraf/telegraf.conf
2021-12-02T19:57:42Z I! Loaded inputs: cpu disk diskio kernel mem processes swap system
2021-12-02T19:57:42Z I! Loaded aggregators:
2021-12-02T19:57:42Z I! Loaded processors:
2021-12-02T19:57:42Z I! Loaded outputs: influxdb
2021-12-02T19:57:42Z I! Tags enabled: host=raspberrypi
2021-12-02T19:57:42Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"raspberrypi", Flush Interval:10s
2021-12-02T19:57:42Z D! [agent] Initializing plugins
2021-12-02T19:57:42Z D! [agent] Connecting outputs
2021-12-02T19:57:42Z D! [agent] Attempting connection to [outputs.influxdb]
2021-12-02T19:57:42Z D! [agent] Successfully connected to outputs.influxdb
2021-12-02T19:57:42Z D! [agent] Starting service inputs
2021-12-02T19:57:52Z D! [outputs.influxdb] Wrote batch of 13 metrics in 21.682593ms
2021-12-02T19:57:52Z D! [outputs.influxdb] Buffer fullness: 0 / 10000 metrics
2021-12-02T19:58:02Z D! [outputs.influxdb] Wrote batch of 18 metrics in 29.015974ms
2021-12-02T19:58:02Z D! [outputs.influxdb] Buffer fullness: 0 / 10000 metrics
2021-12-02T19:58:12Z D! [outputs.influxdb] Wrote batch of 18 metrics in 26.954032ms
2021-12-02T19:58:12Z D! [outputs.influxdb] Buffer fullness: 0 / 10000 metrics
2021-12-02T19:58:22Z D! [outputs.influxdb] Wrote batch of 18 metrics in 26.425589ms
===========================================================================================
 
One step at a time. Slowly getting there. Not without my share of issues. Followed the the instructions from the bms-main folder with other google searches and installed telgraf, influxdb, and granfana. I seem to have it all running. At least reading data and building a database. Still having issue with Grafana. Hoping to get some verification that I'm on the right path and suggestion as to getting the graphical display with grafana

Grafana is giving me this error:

If you're seeing this Grafana has failed to load its application files
1. This could be caused by your reverse proxy settings.
2. If you host grafana under subpath make sure your grafana.ini root_url setting includes subpath. If not using a reverse proxy make sure to set serve_from_sub_path to true.
3. If you have a local dev build make sure you build frontend using: yarn start, yarn start:hot, or yarn build
4. Sometimes restarting grafana-server can help
5. Check if you are using a non-supported browser. For more information, refer to the list of supported browsers.

============================================================================
Here is the output from jdbms.py and telegraf --debug

pi@raspberrypi:~/Downloads/bms-main $ python jbdbms-8-socket.py -b A4:C1:38:88:59:5E -i 10 -m jbdbmscd

attempting to connect
connected A4:C1:38:88:59:5E
Error creating socket: [Errno 2] No such file or directory

meter,ovp,uvp,bov,buv,cot,cut,dot,dut,coc,duc,sc,ic,cnf
jbdbmscd,0,0,0,0,0,0,0,0,0,0,0,0,0

meter,protect,percent,fet,cells,temp1,temp2
jbdbmscd,0,63,3,8,9.0,8.9

meter,cell1,cell2,cell3,cell4,cell5,cell6,cell7,cell8
jbdbmscd,3377,3363,3373,3376,3380,3380,3379,3380

meter,cellmin,cellmax,delta
jbdbmscd,3363,3380,17

meter,volts,amps,watts,remain,capacity,cycles
jbdbmscd,27.01,6.74,182.05,113,180,2

meter,c01,c02,c03,c04,c05,c06,c07,c08
jbdbmscd,0,0,0,0,0,0,0,0

meter,c09,c10,c11,c12,c13,c14,c15,c16
jbdbmscd,0,0,0,0,0,0,0,0


=====================================================================
pi@raspberrypi:~ $ telegraf --debug
2021-12-02T19:57:42Z I! Starting Telegraf 1.20.4
2021-12-02T19:57:42Z I! Using config file: /etc/telegraf/telegraf.conf
2021-12-02T19:57:42Z I! Loaded inputs: cpu disk diskio kernel mem processes swap system
2021-12-02T19:57:42Z I! Loaded aggregators:
2021-12-02T19:57:42Z I! Loaded processors:
2021-12-02T19:57:42Z I! Loaded outputs: influxdb
2021-12-02T19:57:42Z I! Tags enabled: host=raspberrypi
2021-12-02T19:57:42Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"raspberrypi", Flush Interval:10s
2021-12-02T19:57:42Z D! [agent] Initializing plugins
2021-12-02T19:57:42Z D! [agent] Connecting outputs
2021-12-02T19:57:42Z D! [agent] Attempting connection to [outputs.influxdb]
2021-12-02T19:57:42Z D! [agent] Successfully connected to outputs.influxdb
2021-12-02T19:57:42Z D! [agent] Starting service inputs
2021-12-02T19:57:52Z D! [outputs.influxdb] Wrote batch of 13 metrics in 21.682593ms
2021-12-02T19:57:52Z D! [outputs.influxdb] Buffer fullness: 0 / 10000 metrics
2021-12-02T19:58:02Z D! [outputs.influxdb] Wrote batch of 18 metrics in 29.015974ms
2021-12-02T19:58:02Z D! [outputs.influxdb] Buffer fullness: 0 / 10000 metrics
2021-12-02T19:58:12Z D! [outputs.influxdb] Wrote batch of 18 metrics in 26.954032ms
2021-12-02T19:58:12Z D! [outputs.influxdb] Buffer fullness: 0 / 10000 metrics
2021-12-02T19:58:22Z D! [outputs.influxdb] Wrote batch of 18 metrics in 26.425589ms
===========================================================================================
Wow can't wait till you figure it out, hopefully before Solar assistant integrates JBD and I can see it via Home assistant, spent 2 days doing what you are doing only to find out it doesn't work with HassIo, Joe.
 
Wow can't wait till you figure it out, hopefully before Solar assistant integrates JBD and I can see it via Home assistant, spent 2 days doing what you are doing only to find out it doesn't work with HassIo, Joe.
Actually, you don't need Home Assistant at all. However, I'm rebuilding my RPi4B system with Raspian Bullseye and Home Assistant Supervised to hopefully get the best of both worlds.

I have a D1 Mini talking to my Victron SmartSolar via Ve.Direct and sending data over WiFi right now. I'll get my jbd python going again next. I'm trying to document a lot of it on my Github, but I'm not ready to brag about that just yet.

The plan is Device/Python>>MQTT>>NodeRed>>Influx>>Grafana for everything.

My devices to connect are the JBD BMS (Python/Bluetooth), Victron SmartSolar (D1 Mini/WiFi), Victron Shunt (D1 Mini/WiFi), Sonoff S31s (ESPHome/WiFi), Xioami Temp/humidity sensors(ESPHome/WiFi), Shelly 1 switches(ESPHome/WiFi)

I'll start a new thread once everything is worked out.

Still having issue with Grafana
The trickiest thing about Grafana is getting your data sources connected. It's easy from there on out.
 
Actually, you don't need Home Assistant at all. However, I'm rebuilding my RPi4B system with Raspian Bullseye and Home Assistant Supervised to hopefully get the best of both worlds.

I have a D1 Mini talking to my Victron SmartSolar via Ve.Direct and sending data over WiFi right now. I'll get my jbd python going again next. I'm trying to document a lot of it on my Github, but I'm not ready to brag about that just yet.

The plan is Device/Python>>MQTT>>NodeRed>>Influx>>Grafana for everything.

My devices to connect are the JBD BMS (Python/Bluetooth), Victron SmartSolar (D1 Mini/WiFi), Victron Shunt (D1 Mini/WiFi), Sonoff S31s (ESPHome/WiFi), Xioami Temp/humidity sensors(ESPHome/WiFi), Shelly 1 switches(ESPHome/WiFi)

I'll start a new thread once everything is worked out.


The trickiest thing about Grafana is getting your data sources connected. It's easy from there on out.
A new Thread with all Your work published would be awesome - had all working perfect except the Python/Bluetooth and it's all still installed on HA, but disabled, Joe.
 
I was wondering if anyone has a way to get temperature off the BMS, with python and a the Bluetooth module. I have been using tgalarneau's code I can get cell voltages, amps, watts, SOC ... but would also like to pull temps, otherwise I was going use a separate temp sensor.

 
I haven't look on here for awhile.

The code supplies the temperature data. i.e.

meter,protect,percent,fet,cells,temp1,temp2
jbdbmscd,0,63,3,8,9.0,8.9


Also available for 4 probes and that's what I'm using.
 
When I run the code get cell info and cell voltages but no temps? looking at the code I don't see how it will trigger/run the sub cellinfo2(data)
when it writes two hex numbers, Shouldn't there be a third #/hex to write to 0x15?
i am looked


result = bms.writeCharacteristic(0x15,b'\xdd\xa5\x03\x00\xff\xfd\x77',False) # write x03 w/o response cell info
result = bms.writeCharacteristic(0x15,b'\xdd\xa5\x04\x00\xff\xfc\x77',False) # write x04 w/o response cell voltages
 
Back
Top