warhammerkid / bluetti_mqtt

MQTT interface for Bluetti power stations
MIT License
139 stars 53 forks source link

Error on EP500 #6

Closed nightmare-rg closed 2 years ago

nightmare-rg commented 2 years ago

Hello,

I tried bluetti-logger for EP500 but got this error:

➜ bluetti-logger --scan                                                 
Scanning....
Found EP5002204000017278: address 346F6730-082F-B776-9A09-70C5CBC8C6AD
➜ bluetti-logger --log log-file.log 346F6730-082F-B776-9A09-70C5CBC8C6AD
Connecting to 346F6730-082F-B776-9A09-70C5CBC8C6AD
Waiting for connection...
/_virtual_envs/bluetti/lib/python3.7/site-packages/bleak/backends/corebluetooth/client.py:318: UninitializedDeallocWarning: leaking an uninitialized object of type _NSPlaceholderData
value = NSData.alloc().initWithBytes_length_(data, len(data))
Task exception was never retrieved
future: <Task finished coro=<BluetoothClient.run() done, defined at /_virtual_envs/bluetti/lib/python3.7/site-packages/bluetti_mqtt/bluetooth/client.py:36> exception=TypeError("object of type 'QueryRangeCommand' has no len()")>
Traceback (most recent call last):
File "/_virtual_envs/bluetti/lib/python3.7/site-packages/bluetti_mqtt/bluetooth/client.py", line 43, in run
await self._perform_commands(self.client)
File "/_virtual_envs/bluetti/lib/python3.7/site-packages/bluetti_mqtt/bluetooth/client.py", line 67, in _perform_commands
self.current_command)
File "/_virtual_envs/bluetti/lib/python3.7/site-packages/bleak/backends/corebluetooth/client.py", line 318, in write_gatt_char
value = NSData.alloc().initWithBytes_length_(data, len(data))
TypeError: object of type 'QueryRangeCommand' has no len()

I checked also bluetooth connection from iPhone and Bluetti App via Packetlogger and your results from https://diysolarforum.com/threads/monitoring-bluetti-systems.37870/ are the same for EP500. I am only wondering about the address. Not a typical mac address, but my magic mouse and other bl devices are also shown with this type of address. I tried it also with the mac from the Packetlogger but no Connection. I'm working on MacBook Pro M1 with PyCharm and use buildin BL. Any idea what's wrong and this error happened?

warhammerkid commented 2 years ago

@nightmare-rg There's probably some slight difference between Bluetooth on macOS and Linux (where I've done most of my testing). I have access to a mac that I can use to test, and that error message gives me a pretty good idea of what's going wrong. Once I have some time I should be able to fix this and put up a new build.

nightmare-rg commented 2 years ago

This would be great. I want to use my Mac Mini M1 Server to collect stats from my EP500. Here are some additional information:

macOS Monterey 12.4 tested on MacBook Pro M1 Max Python 3.7

warhammerkid commented 2 years ago

@nightmare-rg This will be fixed in the next version released some time later today (I still have some work I want to do).