Monday, 20 July 2026

Trying to talk to all three 24v LFP batteries over BLE

I have three 24v nominal LFP batteries.

Can I use Python3 code to access each over BLE ?

First, "SP10S009-L8S-100A-B-U" A4:C1:37:10:00:D2

Second, "BR2262e-s" 04:7F:0E:00:1A:7C

Third. "????" xx:xx  (daly BMS)


Starting with with First do I write to characteristic 0xFF01 of service 0xFF00 ?


./gatt-python could discover but not connect to "B" or "S"

pi@sionnach:~/gatt-python $ python3 ./discover.py 

Discovered [41:3c:6e:a0:75:f1] 41-3C-6E-A0-75-F1

Discovered [40:00:59:aa:b7:e0] 40-00-59-AA-B7-E0

Discovered [a4:c1:37:10:00:d2] SP10S009-L8S-100A-B-U

Discovered [a4:c1:37:10:00:d2] SP10S009-L8S-100A-B-U

Discovered [04:7f:0e:00:1a:7c] BR2262e-s

Discovered [a4:c1:37:10:00:d2] SP10S009-L8S-100A-B-U

Discovered [a4:c1:37:10:00:d2] SP10S009-L8S-100A-B-U


pi@sionnach:~/gatt-python $ 

pi@sionnach:~/gatt-python $ python3 ./connects_S.py 

[a4:c1:37:10:00:d2] Connection failed: Device does not exist, check adapter name and MAC address.


(2026_05_bleak) pi@sionnach:~/2026_05_bleak also failed.

2026_05_bleak) pi@sionnach:~/2026_05_bleak $ nano scanner_S.py 

(2026_05_bleak) pi@sionnach:~/2026_05_bleak $ 

(2026_05_bleak) pi@sionnach:~/2026_05_bleak $ python3 ./scanner_S.py 

Traceback (most recent call last):

  File "/home/pi/2026_05_bleak/./scanner_S.py", line 37, in <module>

    asyncio.run(main(address))

  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run

    return runner.run(main)

           ^^^^^^^^^^^^^^^^

  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run

    return self._loop.run_until_complete(task)


This directory was also no good...


(24v_battery) pi@sionnach:~/24v_battery/bin $ ./gattctl 

Module 'dbus' not found

Please run: sudo apt-get install python3-dbus

See also: https://github.com/getsenic/gatt-python#installing-gatt-sdk-for-python

(24v_battery) pi@sionnach:~/24v_battery/bin $ 


(24v_battery) pi@sionnach:~/jbdtool/build $ 

(24v_battery) pi@sionnach:~/jbdtool/build $ ls ..

battery.h  build.h  changelog  dsfuncs.h  jbd_info.c  list.h    module.h  pack.h    README.md  utils.h

bt.c       can.c    config.h   ip.c       jbd_info.h  main.c    mqtt.c    parson.c  serial.c   uuid.h

buffer.h   cfg.c    daemon.c   jbd.c      LICENSE     Makefile  mqtt.h    parson.h  si.h       worker.h

build      cfg.h    debug.h    jbd.h      list.c      module.c  mybmm.h   r         utils.c

(24v_battery) pi@sionnach:~/jbdtool/build $ 

Also no good



Also no good

(JBD_BMS_BTLE) pi@sionnach:~/JBD_BMS_BTLE $ cd ..


Didn't try aiobmsble as it looks incomplete as no runnable .py script!


Didn't try ANT_BMS as it uses serial port


smart_bms also failed..

docs  dumb_test.py  examples  LICENSE.txt  README.md  requirements.txt  smart_bms  test.py

pi@sionnach:~/smart_bms $ vim test.py 

pi@sionnach:~/smart_bms $ python3 ./test.py 

('A4:C1:37:10:00:D2', 'SP10S009-L8S-100A-B-U', 'Jikong')

WALSH: Running bluetootchctl command <disconnect A4:C1:37:10:00:D2>

WALSH: Running bluetootchctl command <power on>

Traceback (most recent call last):

  File "/usr/lib/python3.11/asyncio/tasks.py", line 490, in wait_for

    return fut.result()

           ^^^^^^^^^^^^

  File "/home/pi/smart_bms/smart_bms/TransportBLE.py", line 70, in _read_inner

    data = [await self._read_queue.get()]




pi@sionnach:~/solar-bt-monitor $ nano solar-bt-monitor.ini

pi@sionnach:~/solar-bt-monitor $ nano solar-bt-monitor.ini.B

pi@sionnach:~/solar-bt-monitor $ 

pi@sionnach:~/solar-bt-monitor $ python3 ./solar-bt-monitor.py 

DEBUG: [CONFIG] mac_addr: A4:C1:37:10:00:D2

DEBUG: [CONFIG] alias: SP10S009-L8S-100A-B-U

DEBUG: [CONFIG] adapter: hci0

DEBUG: [CONFIG] reconnect: True

DEBUG: [CONFIG] continuous_monitor: True

DEBUG: [CONFIG] data_read_interval: 30

DEBUG: [CONFIG] logger_type: prometheus

INFO: Starting Prometheus Server

INFO: Adapter status - Powered: True

INFO: Starting discovery...

INFO: Devices found: 5

INFO: Found bt1 device SP10S009-L8S-100A-B-U  [A4:C1:37:10:00:D2]

INFO: Found bt1 device SP10S009-L8S-100A-B-U  [a4:c1:37:10:00:d2]

DEBUG: Found. So connecting...

DEBUG: _connect() run manager...

INFO: [a4:c1:37:10:00:d2] Discovered, alias = SP10S009-L8S-100A-B-U

INFO: [A4:C1:37:10:00:D2] Connected

INFO: [a4:c1:37:10:00:d2] Discovered, alias = SP10S009-L8S-100A-B-U

INFO: [A4:C1:37:10:00:D2] Resolved services

DEBUG: resolved services

DEBUG: request_data...

DEBUG: create_read_request 256 => [255, 3, 1, 0, 0, 34, 209, 241]

ERROR: Exception in handler for D-Bus signal:

Traceback (most recent call last):

  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 218, in maybe_handle_message

    self._handler(*args, **kwargs)

  File "/home/pi/.local/lib/python3.11/site-packages/gatt/gatt_linux.py", line 398, in properties_changed

    self.services_resolved()

  File "/home/pi/solar-bt-monitor/SolarDevice.py", line 63, in services_resolved

    self.resolved_callback()

  File "/home/pi/solar-bt-monitor/BTOneApp.py", line 95, in on_resolved

    self.request_data()

  File "/home/pi/solar-bt-monitor/BTOneApp.py", line 91, in request_data

    self.device.characteristic_write_value(request)

  File "/home/pi/solar-bt-monitor/SolarDevice.py", line 79, in characteristic_write_value

    self.write_characteristic.write_value(value)

    ^^^^^^^^^^^^^^^^^^^^^^^^^

AttributeError: 'SolarDevice' object has no attribute 'write_characteristic'

INFO: [a4:c1:37:10:00:d2] Discovered, alias = SP10S009-L8S-100A-B-U



^CDEBUG: _connect() keyboard exception...

INFO: gracefully_exit

INFO: Exit: Disconnecting device: SP10S009-L8S-100A-B-U [A4:C1:37:10:00:D2]

pi@sionnach:~/solar-bt-monitor $ 

pi@sionnach:~/solar-bt-monitor $ 

pi@sionnach:~/solar-bt-monitor $ date

Mon 20 Jul 17:40:23 IST 2026

pi@sionnach:~/solar-bt-monitor $ # Got further may be worth debugging?

pi@sionnach:~/solar-bt-monitor $ 

pi@sionnach:~/solar-bt-monitor $ 

Or should I use a wired connection to each BMS ? Scary


What does Android app make of them ?


daly

jbd

xiaoxiang




Hurrah!!!!



(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ vim jbd_bms_bleak2.py 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ vim ./jbd_bms_bleak2.py 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ python3 ./jbd_bms_bleak2.py 

INFO:__main__:Found device: SP10S009-L8S-100A-B-U (A4:C1:37:10:00:D2)

INFO:__main__:Updating BMS data...

INFO:__main__:BMS data: {'voltage': 25.99,

        'current': 0.0,

        'cycle_charge': 0.14,

        'design_capacity': 100,

        'cycles': 584,

        'balancer': 0,

        'problem_code': 4096,

        'battery_level': 0,

        'chrg_mosfet': True,

        'dischrg_mosfet': False,

        'temp_sensors': 2,

        'temp_values': [TempSensor(22.6,

        <T.GENERIC: 0>),

        TempSensor(22.7,

        <T.GENERIC: 0>)],

        'cell_voltages': [3.249,

        3.25,

        3.247,

        3.249,

        3.248,

        3.248,

        3.248,

        3.253],

        'delta_voltage': 0.006,

        'cell_count': 8,

        'cycle_capacity': 3.639,

        'power': 0.0,

        'battery_charging': False,

        'temperature': 22.65,

        'problem': True}

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ date

Mon 20 Jul 2026 19:16:20 IST

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 


Now lets try that on a Raspberry Pi!

Pythoin version only 3.11 needs to be at least 3.12



(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ python3 ./jbd_S_bms_bleak.py 

INFO:__main__:Found device: SP10S009-L8S-100A-B-U (A4:C1:37:10:00:D2)

INFO:__main__:Updating BMS data...

INFO:__main__:BMS data: {'voltage': 25.99,

        'current': 0.0,

        'cycle_charge': 0.14,

        'design_capacity': 100,

        'cycles': 584,

        'balancer': 0,

        'problem_code': 4096,

        'battery_level': 0,

        'chrg_mosfet': True,

        'dischrg_mosfet': False,

        'temp_sensors': 2,

        'temp_values': [TempSensor(22.6,

        <T.GENERIC: 0>),

        TempSensor(22.7,

        <T.GENERIC: 0>)],

        'cell_voltages': [3.249,

        3.25,

        3.247,

        3.249,

        3.248,

        3.248,

        3.248,

        3.253],

        'delta_voltage': 0.006,

        'cell_count': 8,

        'cycle_capacity': 3.639,

        'power': 0.0,

        'battery_charging': False,

        'temperature': 22.65,

        'problem': True}

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ nano jbd_B_bms_bleak.py 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ vim jbd_B_bms_bleak.py 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ 

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ python3 ./jbd_B_bms_bleak.py 

ERROR:root:Device 'BR2262e-s' not found.

(jbd_bms_bleak) (base) coderdojo@rhubarb:~/jbd_bms_bleak$ date

Mon 20 Jul 2026 19:27:29 IST






















No comments:

Post a Comment