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

RPI 3 model b and JK BMS not working #171

Open
arzaman opened this issue Dec 6, 2023 · 2 comments
Open

RPI 3 model b and JK BMS not working #171

arzaman opened this issue Dec 6, 2023 · 2 comments

Comments

@arzaman
Copy link

arzaman commented Dec 6, 2023

Trying to connect my JK BMS via BT to RPI3 model B using embedded BT module but no way to connect
kindly ask for support

some notes
BT module seems correctly installed and detected by HA on hci0 adatper on my RPI
image

I have tried connection both with and without PIN "1234"

I have executed almost all the suggestinons (except power cycle JK bms since can't switch off the battery bank) in the troubleshooting section
-install_newer_bleak done
-bt_power_cycle on done

JK BMS is visible via BLE scanner and I have updated the address in the settings

image

this is my device configuration

  • address: C8:47:8C:E8:F2:62
    type: jk
    alias: LiFePo4 160Ah
    debug: true

Notice that I have RPI 3 connected via wifi ... I can't do differently since where battery is located no LAN cable :-(

these are the info from BMS

image

BEGIN
await scanner.start()
File "/usr/lib/python3.11/site-packages/bleak/backends/bluezdbus/scanner.py", line 145, in start
assert_reply(reply)
File "/usr/lib/python3.11/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply
raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.NotReady] Resource Not Ready

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/app/main.py", line 43, in fetch_loop
if await fn():
^^^^^^^^^^
File "/app/main.py", line 357, in fn
raise exceptions[0]
File "/app/main.py", line 352, in fn
await t()
File "/app/bmslib/sampling.py", line 153, in call
except bleak.exc.BleakDeviceNotFoundError:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'bleak.exc' has no attribute 'BleakDeviceNotFoundError'

17:35:04 INFO [sampling] connecting bms JKBt(C8:47:8C:E8:F2:62,LiFePo4 160Ah)
17:35:04 INFO [bt] connecting LiFePo4 160Ah (C8:47:8C:E8:F2:62) adapter=default timeout=6
17:35:04 DEBUG [client] Connecting to device @ C8:47:8C:E8:F2:62 with hci0
17:35:04 DEBUG [scanner] cached devices: {}
17:35:04 INFO [jikong] normal connect failed (module 'bleak.exc' has no attribute 'BleakDeviceNotFoundError'), connecting with scanner
17:35:04 DEBUG [bt] starting scan
17:35:04 DEBUG [scanner] cached devices: {}
17:35:04 ERROR [main] 1 exceptions occurred fetching BMSs
17:35:04 ERROR [main] Error (num 4, max 200) reading BMS: module 'bleak.exc' has no attribute 'BleakDeviceNotFoundError'
17:35:04 ERROR [main] Stack: Traceback (most recent call last):
File "/app/bmslib/bt.py", line 184, in _connect_client
await asyncio.wait_for(self.client.connect(timeout=timeout), timeout=timeout + 1)
File "/usr/lib/python3.11/asyncio/tasks.py", line 489, in wait_for
return fut.result()
^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/bleak/backends/bluezdbus/client.py", line 190, in connect
device = await BleakScannerBlueZDBus.find_device_by_address(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/bleak/backends/scanner.py", line 205, in find_device_by_address
return await cls.find_device_by_filter(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/bleak/backends/scanner.py", line 234, in find_device_by_filter
async with cls(detection_callback=apply_filter, **kwargs):
File "/usr/lib/python3.11/site-packages/bleak/backends/scanner.py", line 79, in aenter
await self.start()
File "/usr/lib/python3.11/site-packages/bleak/backends/bluezdbus/scanner.py", line 145, in start
assert_reply(reply)
File "/usr/lib/python3.11/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply
raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.NotReady] Resource Not Ready

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/app/bmslib/models/jikong.py", line 125, in connect
await super().connect(timeout=6)
File "/app/bmslib/bt.py", line 235, in connect
await self._connect_client(timeout=timeout)
File "/app/bmslib/bt.py", line 185, in _connect_client
except bleak.exc.BleakDeviceNotFoundError as exc:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'bleak.exc' has no attribute 'BleakDeviceNotFoundError'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/app/bmslib/sampling.py", line 149, in call
s = await self._sample_inner()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/bmslib/sampling.py", line 212, in _sample_inner
async with bms:
File "/app/bmslib/bt.py", line 343, in aenter
await self.connect()
File "/app/bmslib/models/jikong.py", line 128, in connect
await self._connect_with_scanner(timeout=timeout)
File "/app/bmslib/bt.py", line 259, in _connect_with_scanner
await scanner.start()
File "/usr/lib/python3.11/site-packages/bleak/backends/bluezdbus/scanner.py", line 145, in start
assert_reply(reply)
File "/usr/lib/python3.11/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply
raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.NotReady] Resource Not Ready

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/app/main.py", line 43, in fetch_loop
if await fn():
^^^^^^^^^^
File "/app/main.py", line 357, in fn
raise exceptions[0]
File "/app/main.py", line 352, in fn
await t()
File "/app/bmslib/sampling.py", line 153, in call
except bleak.exc.BleakDeviceNotFoundError:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'bleak.exc' has no attribute 'BleakDeviceNotFoundError'
END

@fl4p
Copy link
Owner

fl4p commented Dec 19, 2023

update to latest version and try again

@arzaman
Copy link
Author

arzaman commented Dec 20, 2023

Connection OK and stable with last version
Just one minor issue to highlight

Missing some entities in my JK bms device
in particular the "balance" entity
image

any idea how to fix it ?
br
Davide

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

2 participants