jblance/mpp-solar

Most time connect error BLE

Closed this issue · 1 comments

I read every 5 minute the status of my battery and had most time the following error. To solve it, i disable bluetooth and enable it, then i try it 3 times to get the data.
I dont know of it is a timing-problem or software-problem.

The command i use on remote server is:ssh user@192.168.178.17 -tt "date '+%Y-%m-%d %H:%M:%S ';/home/user/.local/bin/mpp-solar -p xx:xx:xx:xx:xx:xx -P jkv11" >/tmp/akkustatus1.txt

`2024-04-03 17:03:50
2024-04-03 17:03:51,812:WARNING:jkbleio:ble_connect@67: Cannot connect to mac xx:xx:xx:xx:xx:xx - exceeded 3 attempts
2024-04-03 17:03:51,813:ERROR:jkbleio:send_and_receive@46: Failed to connect to xx:xx:xx:xx:xx:xx
Command: getCellData - BLE Cell Data inquiry

Parameter Value Unit
validity_check Error: Response was empty

orTraceback (most recent call last):
File "/home/user/.local/bin/mpp-solar", line 8, in
sys.exit(main())
File "/home/user/.local/lib/python3.10/site-packages/mppsolar/init.py", line 426, in main
results = _device.run_command(command=_command)
File "/home/user/.local/lib/python3.10/site-packages/mppsolar/devices/device.py", line 92, in run_command
raw_response = self._port.send_and_receive(
File "/home/user/.local/lib/python3.10/site-packages/mppsolar/inout/jkbleio.py", line 43, in send_and_receive
response = self.ble_get_data(full_command)
File "/home/user/.local/lib/python3.10/site-packages/mppsolar/inout/jkbleio.py", line 134, in ble_get_data
if self._device.waitForNotifications(1.0):
File "/usr/local/lib/python3.10/dist-packages/bluepy/btle.py", line 560, in waitForNotifications
resp = self._getResp(['ntfy','ind'], timeout)
File "/usr/local/lib/python3.10/dist-packages/bluepy/btle.py", line 407, in _getResp
resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
File "/usr/local/lib/python3.10/dist-packages/bluepy/btle.py", line 362, in _waitResp
raise BTLEDisconnectError("Device disconnected", resp)
bluepy.btle.BTLEDisconnectError: Device disconnected`

My system is Odroid-c4 with
`armbian
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
uname -a
Linux odroidc4 6.6.16-current-meson64 #1 SMP PREEMPT Fri Feb 23 08:25:28 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux

mpp-solar -v
Solar Device Command Utility, version: 0.16.29, python version: 3.10.12
lsusb
Bus 002 Device 002: ID 2109:0817 VIA Labs, Inc. USB3.0 Hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 010: ID 1d50:606f OpenMoko, Inc. Geschwister Schneider CAN adapter
Bus 001 Device 009: ID 0bda:c820 Realtek Semiconductor Corp. 802.11ac NIC
Bus 001 Device 008: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 007: ID 1d50:606f OpenMoko, Inc. Geschwister Schneider CAN adapter
Bus 001 Device 002: ID 2109:2817 VIA Labs, Inc. USB2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

JKBMS B2A23S20P
`
Thank you for a hint or solution
Bruno

I think the problem is solved. I was a timing problem of running 2 requests at same time for 2 different batteries.

Please close the issue.