Skip to content

Navigation Menu

Sign in
Sign up

Batman does not connect to jkbms #278

Unanswered
Simon-Kasper asked this question in Q&A
Discussion options

To start: thanks for your great work on the batman add-on!

I cannot seem to get it to connect to my batteries though... The scanner function does seem to pickup the bluetooth signal and I can connect to it with my phone a couple of metres further away from the BMS than my home assistant is located without any problems.

I'm not at all clear what the problem is. I've bought a bigger BT antenna and even moved the antenna closer to the BMS with a cable. Could somebody point me in the right direction?

These are the logs, i'm trying to read the items BMS Pack A and BMS Pack B:
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
15:33:30 INFO [main] Started in pair-only mode (bleak 0.20.2)
15:33:30 INFO [main] No PSK, nothing to pair
15:33:30 INFO [main] exit signal handler... (), {}, shutdown was False
15:33:31 INFO [main] Power cycle bluetooth hardware
Unable to open mgmt_socket
Unable to open mgmt_socket
15:33:34 INFO [bt] BT Discovery:
15:33:39 INFO [bt] BT 79:21:13:89:B6:F9 79-21-13-89-B6-F9
15:33:39 INFO [bt] BT D0:4F:7E:25:1A:14 D0-4F-7E-25-1A-14
15:33:39 INFO [bt] BT 54:81:64:86:76:0B 54-81-64-86-76-0B
15:33:39 INFO [bt] BT 61:63:09:82:48:54 61-63-09-82-48-54
15:33:39 INFO [bt] BT 64:BA:39:62:D1:EA 64-BA-39-62-D1-EA
15:33:39 INFO [bt] BT 43:ED:E2:5F:8E:E4 ESS
15:33:39 INFO [bt] BT C8:47:80:07:A7:7E BMS Pack A-00
15:33:39 INFO [bt] BT CB:94:BC:11:05:E3 CB-94-BC-11-05-E3
15:33:39 INFO [main] Bleak version 0.20.2, BtBackend version bluez-v5.79
15:33:39 INFO [main] connecting mqtt mqtt-user@core-mosquitto
15:33:39 INFO [main] Fetching 2 BMS + 0 virtual + 0 others serially, period=30.00s, keep_alive=True
15:33:39 INFO [sampling] connecting bms JKBt(C8:47:80:07:A7:81,ESS Pack B)
15:33:39 INFO [main] mqtt watchdog loop started with timeout 300.0s
15:33:46 ERROR [bt] Device with address C8:47:80:07:A7:81 was not found., starting scanner
15:33:46 INFO [bt] BT Discovery:
15:33:51 INFO [bt] BT D0:4F:7E:25:1A:14 D0-4F-7E-25-1A-14
15:33:51 INFO [bt] BT 64:BA:39:62:D1:EA 64-BA-39-62-D1-EA
15:33:51 INFO [bt] BT 54:81:64:86:76:0B 54-81-64-86-76-0B
15:33:51 INFO [bt] BT 61:63:09:82:48:54 61-63-09-82-48-54
15:33:51 INFO [bt] BT C8:47:80:07:A7:7E BMS Pack A-00
15:33:51 INFO [bt] BT 79:21:13:89:B6:F9 79-21-13-89-B6-F9
15:33:51 INFO [bt] BT 43:ED:E2:5F:8E:E4 ESS
15:33:51 INFO [bt] BT CB:94:BC:11:05:E3 CB-94-BC-11-05-E3
15:33:51 INFO [bt] BT C8:47:80:07:A7:81 BMS Pack B-01
15:33:51 INFO [bt] BT 34:29:8F:66:05:77 34-29-8F-66-05-77
15:33:51 INFO [bt] BT 57:AA:6D:71:97:47 57-AA-6D-71-97-47
15:33:51 INFO [bt] BT FA:01:33:EE:EB:AF SmartShunt HQ23036DDZU
15:33:51 INFO [jikong] ESS Pack B normal connect failed (Device with address C8:47:80:07:A7:81 was not found.), connecting with scanner
15:34:00 ERROR [sampling] ESS Pack B error (#1): [org.bluez.Error.InProgress] Operation already in progress
Traceback (most recent call last):
File "/app/bmslib/models/jikong.py", line 129, in connect
await super().connect(timeout=6)
File "/app/bmslib/bt.py", line 240, in connect
await self._connect_client(timeout=timeout)
File "/app/bmslib/bt.py", line 189, in _connect_client
await asyncio.wait_for(self.client.connect(timeout=timeout), timeout=timeout + 1)
File "/usr/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
return await fut
^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/bleak/init.py", line 531, in connect
return await self._backend.connect(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/bleak/backends/bluezdbus/client.py", line 135, in connect
raise BleakDeviceNotFoundError(
bleak.exc.BleakDeviceNotFoundError: Device with address C8:47:80:07:A7:81 was not found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/bmslib/sampling.py", line 155, in call
s = await self._sample_inner()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/bmslib/sampling.py", line 229, in _sample_inner
async with bms:
^^^
File "/app/bmslib/bt.py", line 348, in aenter
await self.connect()
File "/app/bmslib/models/jikong.py", line 132, in connect
await self._connect_with_scanner(timeout=timeout)
File "/app/bmslib/bt.py", line 276, in _connect_with_scanner
await self._connect_client(timeout=timeout / 2)
File "/app/bmslib/bt.py", line 189, in _connect_client
await asyncio.wait_for(self.client.connect(timeout=timeout), timeout=timeout + 1)
File "/usr/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
return await fut
^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/bleak/init.py", line 531, in connect
return await self._backend.connect(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/bleak/backends/bluezdbus/client.py", line 124, in connect
device = await BleakScanner.find_device_by_address(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/bleak/init.py", line 310, in find_device_by_address
return await cls.find_device_by_filter(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/bleak/init.py", line 369, in find_device_by_filter
async with cls(detection_callback=apply_filter, **kwargs):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/bleak/init.py", line 152, in aenter
await self._backend.start()
File "/app/venv/lib/python3.12/site-packages/bleak/backends/bluezdbus/scanner.py", line 191, in start
self._stop = await manager.active_scan(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/bleak/backends/bluezdbus/manager.py", line 368, in active_scan
assert_reply(reply)
File "/app/venv/lib/python3.12/site-packages/bleak/backends/bluezdbus/utils.py", line 22, in assert_reply
raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.InProgress] Operation already in progress
15:34:00 INFO [sampling] ESS Pack B bms debug data: {'resp': {}, 'char_w': None, 'char_r': None}
15:34:00 INFO [sampling] Bleak version 0.20.2
15:34:00 INFO [sampling] connecting bms JKBt_32s(C8:47:80:07:A7:7E,ESS Pack A)
15:34:05 INFO [sampling] connected bms JKBt_32s(C8:47:80:07:A7:7E,ESS Pack A)!
15:34:05 INFO [jikong] PSK = '0000' (Note that anyone within BLE range can read this!)
15:34:06 INFO [sampling] ESS Pack A subscribing for {'charge': True, 'discharge': True, 'balance': True} switch change
15:34:06 INFO [sampling] ESS Pack A: BmsSampl(6.7%,U=51.1V,I=-0.99A,P=-51W,Q=20/300Ah,mos=nan°C)
15:34:06 INFO [sampling] ESS Pack A volt=[3196,3196,3198,3196,3198,3196,3198,3196,3196,3195,3196,3198,3196,3198,3196,3196] temp=[nan, nan, nan, nan]
15:34:06 INFO [sampling] Sending HA discovery for ESS Pack A (num_samples=0)
15:34:07 INFO [sampling] connecting bms JKBt(C8:47:80:07:A7:81,ESS Pack B)
15:34:13 INFO [jikong] ESS Pack B normal connect failed (<class 'TimeoutError'>), connecting with scanner

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Sorry, wait a second. It seems that adding jk_32s as the type instead of just "jk" does the trick, at least for "BMS Pack A". Pack B is still not connecting somehow. Now also getting this message:

16:00:25 INFO [jikong] ESS Pack B normal connect failed (Device with address C8:47:80:07:A7:81 was not found. It may have been removed from BlueZ when scanning stopped.), connecting with scanner
16:00:45 ERROR [sampling] JKBt_32s(C8:47:80:07:A7:81,ESS Pack B) device not found, retry in 129 seconds

You must be logged in to vote
1 reply
Comment options

Well, I'm pretty convinced that the issue is range. Pack A seems to be connecting well and quite reliably now, but Pack B refuses and even shifting Pack B backward (to get a better line of sight) causes the connection to Pack A te drop... Sorry to bother you with the above... I'll have to see if I can get the antenna even closer. This topic can be closed as far as I'm concerned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /