jblance / mpp-solar

Python package to communicate to MPP Solar PIP-4048MS inverters (and similar)
MIT License
365 stars 151 forks source link

jiabaida bms , bluetooth not able to connect #252

Open ouinouin opened 2 years ago

ouinouin commented 2 years ago

Hi, im trying to connect to my Jiabaida BMS with JKBMS, unfortunately there seems to be differences with UUIDS or notify mecanism.

while running the command i get :

jkbms -p A4:C1:38:1B:16:29 Traceback (most recent call last): File "/usr/local/bin/jkbms", line 8, in sys.exit(main()) File "/home/ouinouin/mpp-solar-docker/src/mppsolar/mppsolar/init.py", line 417, in main results = _device.run_command(command=_command) File "/home/ouinouin/mpp-solar-docker/src/mppsolar/mppsolar/devices/device.py", line 316, in run_command raw_response = self._port.send_and_receive( File "/home/ouinouin/mpp-solar-docker/src/mppsolar/mppsolar/inout/jkbleio.py", line 37, in send_and_receive response = self.ble_get_data(full_command) File "/home/ouinouin/mpp-solar-docker/src/mppsolar/mppsolar/inout/jkbleio.py", line 94, in ble_get_data serviceNotify = self._device.getServiceByUUID(serviceNotifyUuid) File "/usr/local/lib/python3.9/dist-packages/bluepy/btle.py", line 490, in getServiceByUUID raise BTLEGattError("Service %s not found" % (uuid.getCommonName()), rsp) bluepy.btle.BTLEGattError: Service ffe0 not found

i actually grab the data of this bms with another tool but i would like to use jkbms and JBD to have a more centralized setup. i use this script uccessfully :bmsinfo i also use this successfully to forward messages to nodered bmstcp

in this code they use those uuids :


device_information_service = next(
            s for s in self.services
            if s.uuid == '0000ff00-0000-1000-8000-00805f9b34fb')

        self.bms_read_characteristic = next(
            c for c in device_information_service.characteristics
            if c.uuid == '0000ff01-0000-1000-8000-00805f9b34fb')

        self.bms_write_characteristic = next(
            c for c in device_information_service.characteristics
            if c.uuid == '0000ff02-0000-1000-8000-00805f9b34fb')

i ll try do dig your code to see if its just uuids to adapt or if the structure of bluetooth is greatly different. my coding skills are unfortunately very limited in this case to do more than few modifications, but i was having a deep look on the structure of the payload to be able ot interpret it on nodered side so i could help to implement jiabaida bms if interrested.

NeariX67 commented 3 weeks ago

You have a JBD BMS, not a JK BMS.