tgalarneau / bms

JBD BMS and Thornwave bluetooth data monitoring
43 stars 17 forks source link

Not able to connect 4S #11

Open Kaythaltes opened 2 years ago

Kaythaltes commented 2 years ago

Hi, I'm trying to us this programme to pull data from my 4s 280Ah battery with a 100A JBD bms. But I'm not able to connect. any advise?

pi@openplotter:~/Downloads/bms $ python3 jbdbms4.py -b A4:C1:38:55:35:3F -i 10 -m jbdbms attempting to connect 2nd try connect Traceback (most recent call last): File "jbdbms4.py", line 151, in bms = Peripheral(args.BLEaddress,addrType="public") File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 391, in init self._connect(deviceAddr, addrType, iface) File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 439, in _connect raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp) bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral A4:C1:38:55:35:3F, addr type: public

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "jbdbms4.py", line 155, in bms = Peripheral(args.BLEaddress,addrType="public") File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 391, in init self._connect(deviceAddr, addrType, iface) File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 439, in _connect raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp) bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral A4:C1:38:55:35:3F, addr type: public pi@openplotter:~/Downloads/bms $

tgalarneau commented 2 years ago

Can't say for certain. But from experience know that if bms connected to another device like a cellphone it will not connect with 2nd device.

On Tue, Jan 4, 2022 at 8:41 AM Kaythaltes @.***> wrote:

Hi, I'm trying to us this programme to pull data from my 4s 280Ah battery with a 100A JBD bms. But I'm not able to connect. any advise?

@.**:~/Downloads/bms $ python3 jbdbms4.py -b A4:C1:38:55:35:3F -i 10 -m jbdbms attempting to connect 2nd try connect Traceback (most recent call last): File "jbdbms4.py", line 151, in bms = Peripheral(args.BLEaddress,addrType="public") File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 391, in init* self._connect(deviceAddr, addrType, iface) File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 439, in _connect raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp) bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral A4:C1:38:55:35:3F, addr type: public

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "jbdbms4.py", line 155, in bms = Peripheral(args.BLEaddress,addrType="public") File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 391, in init self._connect(deviceAddr, addrType, iface) File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 439, in _connect raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp) bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral A4:C1:38:55:35:3F, addr type: public @.***:~/Downloads/bms $

— Reply to this email directly, view it on GitHub https://github.com/tgalarneau/bms/issues/11, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATWKVYP4USVMCQY5MKZMAJTUUM5PDANCNFSM5LIDNJEA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Tom

Kaythaltes commented 2 years ago

After rebooting the pi I'm able to connect. I get an Error creating socket: [Errno 2] No such file or directory but there is data comming in. Some of them are 0 but the important once for me are showing.

pi@openplotter:~/Downloads/bms $ sudo python3 ./jbdbms-4-socket-2temps.py -b A4:C1:38:55:35:3F -i 15 -m jbdbms attempting to connect connected A4:C1:38:55:35:3F Error creating socket: [Errno 2] No such file or directory meter,volts,amps,watts,remain,capacity,cycles jbdbms,13.26,0.00,0.00,184,272,6 meter,c01,c02,c03,c04,c05,c06,c07,c08 jbdbms,0,0,0,0,0,0,0,0 meter,c09,c10,c11,c12,c13,c14,c15,c16 jbdbms,0,0,0,0,0,0,0,0 meter,ovp,uvp,bov,buv,cot,cut,dot,dut,coc,duc,sc,ic,cnf jbdbms,0,0,0,0,0,0,0,0,0,0,0,0,0 meter,protect,percent,fet,cells,temp1,temp2 jbdbms,0,68,3,4,7.1,7.1 meter,cell1,cell2,cell3,cell4 jbdbms,3316,3318,3319,3315 meter,cellmin,cellmax,delta jbdbms,3315,3319,4 meter,volts,amps,watts,remain,capacity,cycles jbdbms,13.26,0.00,0.00,184,272,6 meter,c01,c02,c03,c04,c05,c06,c07,c08 jbdbms,0,0,0,0,0,0,0,0 meter,c09,c10,c11,c12,c13,c14,c15,c16 jbdbms,0,0,0,0,0,0,0,0 meter,ovp,uvp,bov,buv,cot,cut,dot,dut,coc,duc,sc,ic,cnf jbdbms,0,0,0,0,0,0,0,0,0,0,0,0,0

Using the mqtt version I get this Error:

pi@openplotter:~/Downloads/bms $ sudo python3 ./jbdbms4.py -b A4:C1:38:55:35:3F -i 15 -m jbdbms attempting to connect connected A4:C1:38:55:35:3F Traceback (most recent call last): File "./jbdbms4.py", line 164, in mqtt.connect(broker,port)
File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 914, in connect return self.reconnect() File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 1044, in reconnect sock = self._create_socket_connection() File "/usr/local/lib/python3.7/dist-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/lib/python3.7/socket.py", line 727, in create_connection raise err File "/usr/lib/python3.7/socket.py", line 716, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused broker disconnected pi@openplotter:~/Downloads/bms $

tgalarneau commented 2 years ago

The c01 to c16 fields are flags for cell balancing and are alway 0 unless actively balancing that cells. The ovp to cnf fields are over protection and other error flags so should always be 0 unless bms is in error state.

The zeros for amps and watts should only exist if system is not producing or using power.

The socket error is harder to resolve. Need to check if /tmp/telegraf.sock file exists and its permissions.

On Wed, Jan 5, 2022 at 4:37 AM Kaythaltes @.***> wrote:

After rebooting the pi I'm able to connect. I get an Error creating socket: [Errno 2] No such file or directory but there is data comming in. Some of them are 0 but the important once for me are showing.

@.***:~/Downloads/bms $ sudo python3 ./jbdbms-4-socket-2temps.py -b A4:C1:38:55:35:3F -i 15 -m jbdbms attempting to connect connected A4:C1:38:55:35:3F Error creating socket: [Errno 2] No such file or directory meter,volts,amps,watts,remain,capacity,cycles jbdbms,13.26,0.00,0.00,184,272,6 meter,c01,c02,c03,c04,c05,c06,c07,c08 jbdbms,0,0,0,0,0,0,0,0 meter,c09,c10,c11,c12,c13,c14,c15,c16 jbdbms,0,0,0,0,0,0,0,0 meter,ovp,uvp,bov,buv,cot,cut,dot,dut,coc,duc,sc,ic,cnf jbdbms,0,0,0,0,0,0,0,0,0,0,0,0,0 meter,protect,percent,fet,cells,temp1,temp2 jbdbms,0,68,3,4,7.1,7.1 meter,cell1,cell2,cell3,cell4 jbdbms,3316,3318,3319,3315 meter,cellmin,cellmax,delta jbdbms,3315,3319,4 meter,volts,amps,watts,remain,capacity,cycles jbdbms,13.26,0.00,0.00,184,272,6 meter,c01,c02,c03,c04,c05,c06,c07,c08 jbdbms,0,0,0,0,0,0,0,0 meter,c09,c10,c11,c12,c13,c14,c15,c16 jbdbms,0,0,0,0,0,0,0,0 meter,ovp,uvp,bov,buv,cot,cut,dot,dut,coc,duc,sc,ic,cnf jbdbms,0,0,0,0,0,0,0,0,0,0,0,0,0

— Reply to this email directly, view it on GitHub https://github.com/tgalarneau/bms/issues/11#issuecomment-1005740469, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATWKVYJV6YX5ZAPYIT5K2B3UURJTXANCNFSM5LIDNJEA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

-- Tom

Kaythaltes commented 2 years ago

Okay so the 0 values are normal, great. So the incomming data are correct.

The socket error is indeed because the file /tmp/telegraf.sock does not exist like you mentioned. Only problem is, being new to telegraf, I can't find how to create this file. Do I have to change something in the telegraf.conf ? inputs.socket_listener for unix is enabled in telegraf.conf

tgalarneau commented 2 years ago

The /tmp/telegraf.sock is created by jbdbms-4-socket-2temps.py and this script is the one giving the error.

You need to check the permissions on /tmp directory to see why this socket is not being created.

On Fri, Jan 7, 2022 at 2:25 AM Kaythaltes @.***> wrote:

Okay so the 0 values are normal, great. So the incomming data are correct.

The socket error is indeed because the file /tmp/telegraf.sock does not exist like you mentioned. Only problem is, being new to telegraf, I can't find how to create this file. Do I have to change something in the telegraf.conf ?

— Reply to this email directly, view it on GitHub https://github.com/tgalarneau/bms/issues/11#issuecomment-1007368158, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATWKVYJOYKWXCQFG52JQCV3UU3LVNANCNFSM5LIDNJEA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

-- Tom