Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batmon not connecting to JK inverter BMS #280

Open
Simon-Kasper opened this issue Feb 15, 2025 · 0 comments
Open

Batmon not connecting to JK inverter BMS #280

Simon-Kasper opened this issue Feb 15, 2025 · 0 comments

Comments

@Simon-Kasper
Copy link

Simon-Kasper commented Feb 15, 2025

Thanks for creating this addition to HA! It seems like a very neat way to monitor my batteries closer!

The last days I have been trying to get Batmon to work with my two JK inverter BMS (JK_PB1A16S10P) batteries with very mixed results.

In fact I started trying Batmon about half a year ago, also with mixed results. Back then I bought an external bluetooth dongle with better range but this did not solve it. After that I let it rest for a while.

Recently, after setting the BMS type to jk_32s it was detecting the first BMS quite well for a day or so (Pack A) but not the second one (Pack B). I thought this was due to range issues so I bought a USB extension cable to be able to put the bluetooth antenna right on top of the battery packs. Now nothing works anymore... The log keeps showing errors. I can connect to both BMS just fine with the JK phone app, also from multiple metres away and through walls.

I would greatly appreciate if somebody could take a look at the below data and maybe give me some pointers? I am having trouble understanding where things go wrong at this stage. Do I need to buy a different external bluetooth dongle? Is the config wrong? Some fault in the software / bleak? I would be glad to provide more data on request.

What i've done / tried:

  • external bluetooth antenna added
  • disabled the internal antenna
  • USB extension to put the antenna on top of the batteries
  • tried using either "jk" or "jk_32s" as the bms type
  • tried "keep-alive" and "concurrent sampling" on or off
  • tried power cycling the bluetooth adapter
  • tried different sample periods (currently at 30s)
  • I've restarted HA multiple times
  • rebuild batmon add-on and stop/start
  • re-install the batmon add-on
  • I'm at the latest batmon and HA OS and Core versions (I'm running HA standalone on a raspberry Pi).
  • The scan does show the bluetooth id for both BMSes so bluetooth seems to work.

My config:

  • address: C8:47:80:-censored-
    type: jk
    alias: ESS Pack A
    adapter: hci1
  • address: C8:47:80:-censored-
    type: jk
    alias: ESS Pack B
    adapter: hci1

Logfile:

10:09:36 INFO [main] Started in pair-only mode (bleak 0.20.2)
10:09:36 INFO [main] No PSK, nothing to pair
10:09:36 INFO [main] exit signal handler... (), {}, shutdown was False
10:09:36 INFO [bt] BT Discovery:
10:09:41 INFO [bt] BT 5A:CB:E5:CC:A7:45 5A-CB-E5-CC-A7-45
10:09:41 INFO [bt] BT 68:C8:72:91:D7:06 68-C8-72-91-D7-06
10:09:41 INFO [bt] BT C8:47:80:07:A7:7E BMS Pack A-00
10:09:41 INFO [bt] BT 5E:18:55:91:19:CD 5E-18-55-91-19-CD
10:09:41 INFO [bt] BT 6D:E1:FB:70:C7:C0 6D-E1-FB-70-C7-C0
10:09:41 INFO [bt] BT C8:47:80:07:A7:81 BMS Pack B-01
10:09:41 INFO [bt] BT D0:4F:7E:25:1A:14 D0-4F-7E-25-1A-14
10:09:41 INFO [bt] BT FA:01:33:EE:EB:AF SmartShunt HQ23036DDZU
10:09:41 INFO [bt] BT 54:76:D7:D5:2B:F2 54-76-D7-D5-2B-F2
10:09:41 INFO [bt] BT 34:29:8F:66:05:77 34-29-8F-66-05-77
10:09:41 INFO [bt] BT 43:ED:E2:5F:8E:E4 ESS
10:09:41 INFO [bt] BT E0:34:33:8A:DB:2B E0-34-33-8A-DB-2B
10:09:41 INFO [main] Bleak version 0.20.2, BtBackend version bluez-v5.79
10:09:41 INFO [main] connecting mqtt mqtt-user@core-mosquitto
10:09:42 INFO [main] Fetching 2 BMS + 0 virtual + 0 others serially, period=30.00s, keep_alive=True
10:09:42 INFO [sampling] connecting bms JKBt_32s(C8:47:80:07:A7:7E,ESS Pack A)
10:09:48 INFO [jikong] ESS Pack A normal connect failed (<class 'TimeoutError'>), connecting with scanner
10:10:57 ERROR [sampling] ESS Pack A error (#1): <class 'TimeoutError'>
Traceback (most recent call last):
File "/app/venv/lib/python3.12/site-packages/bleak/backends/bluezdbus/client.py", line 204, in connect
reply = await self._bus.call(
^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/dbus_fast/aio/message_bus.py", line 390, in call
await future
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
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 141, in connect
async with async_timeout(timeout):
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/timeouts.py", line 115, in aexit
raise TimeoutError from exc_val
TimeoutError
10:10:57 INFO [sampling] ESS Pack A bms debug data: {'resp': {}, 'char_w': None, 'char_r': None}
10:10:57 INFO [sampling] Bleak version 0.20.2
10:10:57 INFO [sampling] connecting bms JKBt_32s(C8:47:80:07:A7:81,ESS Pack B)
10:11:04 INFO [jikong] ESS Pack B normal connect failed (<class 'TimeoutError'>), connecting with scanner
10:12:23 ERROR [sampling] ESS Pack B error (#1): <class 'TimeoutError'>
Traceback (most recent call last):
File "/app/venv/lib/python3.12/site-packages/bleak/backends/bluezdbus/client.py", line 204, in connect
reply = await self._bus.call(
^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/dbus_fast/aio/message_bus.py", line 390, in call
await future
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
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 141, in connect
async with async_timeout(timeout):
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/timeouts.py", line 115, in aexit
raise TimeoutError from exc_val
TimeoutError
10:12:23 INFO [sampling] ESS Pack B bms debug data: {'resp': {}, 'char_w': None, 'char_r': None}
10:12:23 INFO [sampling] Bleak version 0.20.2
10:12:23 INFO [sampling] connecting bms JKBt_32s(C8:47:80:07:A7:7E,ESS Pack A)
10:12:29 INFO [jikong] ESS Pack A normal connect failed (<class 'TimeoutError'>), connecting with scanner
10:13:49 ERROR [sampling] ESS Pack A error (#2): <class 'TimeoutError'>
Traceback (most recent call last):
File "/app/venv/lib/python3.12/site-packages/bleak/backends/bluezdbus/client.py", line 204, in connect
reply = await self._bus.call(
^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.12/site-packages/dbus_fast/aio/message_bus.py", line 390, in call
await future
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
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 141, in connect
async with async_timeout(timeout):
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/timeouts.py", line 115, in aexit
raise TimeoutError from exc_val
TimeoutError
10:13:49 INFO [sampling] ESS Pack A bms debug data: {'resp': {}, 'char_w': None, 'char_r': None}
10:13:49 INFO [sampling] Bleak version 0.20.2
10:13:49 INFO [sampling] connecting bms JKBt_32s(C8:47:80:07:A7:81,ESS Pack B)
10:13:55 INFO [jikong] ESS Pack B normal connect failed (<class 'TimeoutError'>), connecting with scanner

@Simon-Kasper Simon-Kasper changed the title Batman not connecting to JK inverter BMS Batmon not connecting to JK inverter BMS Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant