warhammerkid / bluetti_mqtt

MQTT interface for Bluetti power stations
MIT License
142 stars 55 forks source link

Error retrieving device name on MacOS #89

Open yugrinkov opened 1 year ago

yugrinkov commented 1 year ago

Hi guys,

I have encountered with next issue using this package on my workstation.

bluetti-mqtt --scan                                                       
We renamed asyncio-mqtt to aiomqtt and released a version 1.0.0 in the process. This is the last release under the asyncio-mqtt name. You can find the new repository at https://github.com/sbtinstruments/aiomqtt
Scanning....
Found EB3AXXXXXXXX: address CD9BF1CC-4B49-7811-68E2-570B5A7D0CB0

The address looks like invalid. Do you have any ideas what went wrong?

macOS Ventura Version 13.4.1 (c) (22F770820d)

TylerBizz commented 1 year ago

Also running on Mac OS 13.5.2

I have a similar issue with an AC500 and the same type of address. bluetti-mqtt --scan is returning the longer UUID, as in B8001FB6-0675-A28E-1781-XXXXXXXXXXXX. All the examples I have seen are returning the shortened version. I'm not able to connect.

bluetti-mqtt --scan We renamed asyncio-mqtt to aiomqtt and released a version 1.0.0 in the process. This is the last release under the asyncio-mqtt name. You can find the new repository at https://github.com/sbtinstruments/aiomqtt Scanning.... Found AC500XXXXXXXXXXXXX: address B800XXXX-0675-A28E-1781-XXXXXXXXXXXX

bluetti-mqtt --broker XXX.XXX.XX.XXX --username XXXXXXXX --password XXXXXXXXXX --interval 15 B800XXXX-0675-A28E-1781-XXXXXXXXXXXX We renamed asyncio-mqtt to aiomqtt and released a version 1.0.0 in the process. This is the last release under the asyncio-mqtt name. You can find the new repository at https://github.com/sbtinstruments/aiomqtt 2023-09-28 17:05:02 INFO Connecting to MQTT broker... 2023-09-28 17:05:02 INFO Starting to poll clients... 2023-09-28 17:05:02 INFO Connecting to clients: ['B800XXXX-0675-A28E-1781-XXXXXXXXXXXX'] 2023-09-28 17:05:02 INFO Connected to MQTT broker 2023-09-28 17:05:02 WARNING filtered_messages() is deprecated and will be removed in a future version. Use messages() together with Topic.matches() instead. 2023-09-28 17:05:08 INFO Connected to device: B800XXXX-0675-A28E-1781-XXXXXXXXXXXX 2023-09-28 17:05:08 ERROR Error retrieving device name B800XXXX-0675-A28E-1781-XXXXXXXXXXXX: Traceback (most recent call last): File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bluetti_mqtt/bluetooth/client.py", line 90, in _get_name name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/init.py", line 711, in read_gatt_char return await self._backend.read_gatt_char(char_specifier, kwargs) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/backends/corebluetooth/client.py", line 276, in read_gatt_char raise BleakError("Characteristic {} was not found!".format(char_specifier)) bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found! 2023-09-28 17:05:08 WARNING Delayed reconnect to B800XXXX-0675-A28E-1781-XXXXXXXXXXXX after error 2023-09-28 17:05:17 INFO Connected to device: B800XXXX-0675-A28E-1781-XXXXXXXXXXXX 2023-09-28 17:05:17 ERROR Error retrieving device name B800XXXXX-0675-A28E-1781-XXXXXXXXXXXX: Traceback (most recent call last): File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bluetti_mqtt/bluetooth/client.py", line 90, in _get_name name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/init.py", line 711, in read_gatt_char return await self._backend.read_gatt_char(char_specifier, kwargs) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/backends/corebluetooth/client.py", line 276, in read_gatt_char raise BleakError("Characteristic {} was not found!".format(char_specifier)) bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found!

bobthebuilder4711 commented 1 year ago

You are able to connect as evident by this line:

2023-09-28 17:05:17 INFO Connected to device: B800XXXX-0675-A28E-1781-XXXXXXXXXXXX

After the Bluetooth client connects, it asks the device for its name by using "00002a00-0000-1000-8000-00805f9b34fb". And that's where the error is produced:

bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found!

I've got no macOS, so I wouldn't be able to reproduce this error even if I knew what I was doing.

What you can try is to create a Bluetooth log as explained in the readme.rst so maybe others can help figure out what needs to be done.

TylerBizz commented 1 year ago

You are able to connect as evident by this line:

2023-09-28 17:05:17 INFO Connected to device: B800XXXX-0675-A28E-1781-XXXXXXXXXXXX

After the Bluetooth client connects, it asks the device for its name by using "00002a00-0000-1000-8000-00805f9b34fb". And that's where the error is produced:

bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found!

I've got no macOS, so I wouldn't be able to reproduce this error even if I knew what I was doing.

What you can try is to create a Bluetooth log as explained in the readme.rst so maybe others can help figure out what needs to be done.

Thanks and agreed - I missed that it was connecting. I managed to get a virtual machine with Windows setup and installed Bluetti-mqtt. The "bluetti-mqtt --scan" process produces different results when run on Mac and Windows. ie. The device name and address that it returns is different. So, I was able to get the address that looked more like others in videos and documentation however the same issue is experienced.

Looking at the error in terminal and watching the display on the AC500 I also noticed that it was connecting and then dropping a sec later and retrying but failing to retrieve the device name. I'll have a look at creating a bluetooth log.

bobthebuilder4711 commented 1 year ago

From what I've found online, macOS doesn't give out the MAC addresses of Bluetooth devices. Instead it gives you UUIDs. But the macOS version of the bleak library knows this and simply works with UUIDs instead of MAC addresses. So finding the MAC in Windows and then using that on macOS is likely going to fail.

The Bluetooth log might have the answer. Start the logging and then open bluetti's app and connect to your AC500 via Bluetooth. I haven't used the app in a long time, but I think it asks for the device's name, so there should be something about that in the log.

TylerBizz commented 1 year ago

Yeah, I've come to the same conclusion. I initially thought Bluetooth was more straight forward but its been an educational 24 hours :) I'll try the logging over the weekend.

TylerBizz commented 1 year ago

Hmmm … unable to connect for logging on Mac for my AC500. I also tried through virtual machine running Windows 11, scanned and then tried logging but also failing to retrieve device name. When trying on Windows VM, the AC500 briefly shows connect on the lcd but then disconnects with same error - failing to retrieve device name but then VM crashes. Will post the error shortly.

TylerBizz commented 1 year ago

On Mac OS 13.5.2 Python 3.10.6

bluetti-mqtt --scan

We renamed asyncio-mqtt to aiomqtt and released a version 1.0.0 in the process. This is the last release under the asyncio-mqtt name. You can find the new repository at https://github.com/sbtinstruments/aiomqtt Scanning.... Found AC500XXXXXXXXXXXXX: address B8001FB6-0675-A28E-1781-DD57522D886F

bluetti-logger --log the-log-file.log B8001FB6-0675-A28E-1781-DD57522D886F

Connecting to B8001FB6-0675-A28E-1781-DD57522D886F Waiting for connection... Waiting for connection... ERROR:root:Error retrieving device name B8001FB6-0675-A28E-1781-DD57522D886F: Traceback (most recent call last): File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bluetti_mqtt/bluetooth/client.py", line 90, in _get_name name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/init.py", line 711, in read_gatt_char return await self._backend.read_gatt_char(char_specifier, kwargs) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/backends/corebluetooth/client.py", line 276, in read_gatt_char raise BleakError("Characteristic {} was not found!".format(char_specifier)) bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found! WARNING:root:Delayed reconnect to B8001FB6-0675-A28E-1781-DD57522D886F after error Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... ERROR:root:Error retrieving device name B8001FB6-0675-A28E-1781-DD57522D886F: Traceback (most recent call last): File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bluetti_mqtt/bluetooth/client.py", line 90, in _get_name name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/init.py", line 711, in read_gatt_char return await self._backend.read_gatt_char(char_specifier, kwargs) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/backends/corebluetooth/client.py", line 276, in read_gatt_char raise BleakError("Characteristic {} was not found!".format(char_specifier)) bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found! WARNING:root:Delayed reconnect to B8001FB6-0675-A28E-1781-DD57522D886F after error Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... ERROR:root:Error retrieving device name B8001FB6-0675-A28E-1781-DD57522D886F: Traceback (most recent call last): File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bluetti_mqtt/bluetooth/client.py", line 90, in _get_name name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/init.py", line 711, in read_gatt_char return await self._backend.read_gatt_char(char_specifier, kwargs) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/backends/corebluetooth/client.py", line 276, in read_gatt_char raise BleakError("Characteristic {} was not found!".format(char_specifier)) bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found! WARNING:root:Delayed reconnect to B8001FB6-0675-A28E-1781-DD57522D886F after error Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... ERROR:root:Error retrieving device name B8001FB6-0675-A28E-1781-DD57522D886F: Traceback (most recent call last): File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bluetti_mqtt/bluetooth/client.py", line 90, in _get_name name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/init.py", line 711, in read_gatt_char return await self._backend.read_gatt_char(char_specifier, kwargs) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/backends/corebluetooth/client.py", line 276, in read_gatt_char raise BleakError("Characteristic {} was not found!".format(char_specifier)) bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found! WARNING:root:Delayed reconnect to B8001FB6-0675-A28E-1781-DD57522D886F after error Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... ERROR:root:Error retrieving device name B8001FB6-0675-A28E-1781-DD57522D886F: Traceback (most recent call last): File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bluetti_mqtt/bluetooth/client.py", line 90, in _get_name name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/init.py", line 711, in read_gatt_char return await self._backend.read_gatt_char(char_specifier, kwargs) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/backends/corebluetooth/client.py", line 276, in read_gatt_char raise BleakError("Characteristic {} was not found!".format(char_specifier)) bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found! WARNING:root:Delayed reconnect to B8001FB6-0675-A28E-1781-DD57522D886F after error Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... ERROR:root:Error retrieving device name B8001FB6-0675-A28E-1781-DD57522D886F: Traceback (most recent call last): File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bluetti_mqtt/bluetooth/client.py", line 90, in _get_name name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/init.py", line 711, in read_gatt_char return await self._backend.read_gatt_char(char_specifier, kwargs) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/backends/corebluetooth/client.py", line 276, in read_gatt_char raise BleakError("Characteristic {} was not found!".format(char_specifier)) bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found! WARNING:root:Delayed reconnect to B8001FB6-0675-A28E-1781-DD57522D886F after error Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... ERROR:root:Error retrieving device name B8001FB6-0675-A28E-1781-DD57522D886F: Traceback (most recent call last): File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bluetti_mqtt/bluetooth/client.py", line 90, in _get_name name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/init.py", line 711, in read_gatt_char return await self._backend.read_gatt_char(char_specifier, kwargs) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/backends/corebluetooth/client.py", line 276, in read_gatt_char raise BleakError("Characteristic {} was not found!".format(char_specifier)) bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found! WARNING:root:Delayed reconnect to B8001FB6-0675-A28E-1781-DD57522D886F after error Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... ERROR:root:Error retrieving device name B8001FB6-0675-A28E-1781-DD57522D886F: Traceback (most recent call last): File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bluetti_mqtt/bluetooth/client.py", line 90, in _get_name name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/init.py", line 711, in read_gatt_char return await self._backend.read_gatt_char(char_specifier, kwargs) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/backends/corebluetooth/client.py", line 276, in read_gatt_char raise BleakError("Characteristic {} was not found!".format(char_specifier)) bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found! WARNING:root:Delayed reconnect to B8001FB6-0675-A28E-1781-DD57522D886F after error Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... ERROR:root:Error retrieving device name B8001FB6-0675-A28E-1781-DD57522D886F: Traceback (most recent call last): File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bluetti_mqtt/bluetooth/client.py", line 90, in _get_name name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/init.py", line 711, in read_gatt_char return await self._backend.read_gatt_char(char_specifier, kwargs) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/backends/corebluetooth/client.py", line 276, in read_gatt_char raise BleakError("Characteristic {} was not found!".format(char_specifier)) bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found! WARNING:root:Delayed reconnect to B8001FB6-0675-A28E-1781-DD57522D886F after error Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... ERROR:root:Error retrieving device name B8001FB6-0675-A28E-1781-DD57522D886F: Traceback (most recent call last): File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bluetti_mqtt/bluetooth/client.py", line 90, in _get_name name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/init.py", line 711, in read_gatt_char return await self._backend.read_gatt_char(char_specifier, kwargs) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/backends/corebluetooth/client.py", line 276, in read_gatt_char raise BleakError("Characteristic {} was not found!".format(char_specifier)) bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found! WARNING:root:Delayed reconnect to B8001FB6-0675-A28E-1781-DD57522D886F after error Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... ERROR:root:Error retrieving device name B8001FB6-0675-A28E-1781-DD57522D886F: Traceback (most recent call last): File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bluetti_mqtt/bluetooth/client.py", line 90, in _get_name name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/init.py", line 711, in read_gatt_char return await self._backend.read_gatt_char(char_specifier, kwargs) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/backends/corebluetooth/client.py", line 276, in read_gatt_char raise BleakError("Characteristic {} was not found!".format(char_specifier)) bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found! WARNING:root:Delayed reconnect to B8001FB6-0675-A28E-1781-DD57522D886F after error Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... Waiting for connection... ERROR:root:Error retrieving device name B8001FB6-0675-A28E-1781-DD57522D886F: Traceback (most recent call last): File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bluetti_mqtt/bluetooth/client.py", line 90, in _get_name name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/init.py", line 711, in read_gatt_char return await self._backend.read_gatt_char(char_specifier, kwargs) File "/Users/vec/.pyenv/versions/3.10.6/lib/python3.10/site-packages/bleak/backends/corebluetooth/client.py", line 276, in read_gatt_char raise BleakError("Characteristic {} was not found!".format(char_specifier)) bleak.exc.BleakError: Characteristic 00002a00-0000-1000-8000-00805f9b34fb was not found! WARNING:root:Delayed reconnect to B8001FB6-0675-A28E-1781-DD57522D886F after error Waiting for connection... Waiting for connection... Waiting for connection...

TylerBizz commented 1 year ago

Any solution on running Bluetti_MQTT on Mac Silicon?? I'm still unable to connect - even just to run the logger.

yugrinkov commented 1 year ago

Any solution on running Bluetti_MQTT on Mac Silicon?? I'm still unable to connect - even just to run the logger.

The same for me. I have come to solution is buy raspberry pi and run it there.

TylerBizz commented 1 year ago

@yugrinkov I got mine to work last night.

The Bluetti_MQTT code is looking for the UUID 00002a00-0000-1000-8000-00805f9b34fb which is assuming it is standard across Bluetti devices. This is supposed to be a published bluetooth "characteristic" that the code then decodes to the device name. This is not happening per the error message. Not sure if it is a Mac thing.

The device address you are getting is not wrong and looks different to windows machines but it is a useable address on Mac.

What I did to get around the issue was locate the file called "client.py" in Bluetti-mqtt/bluetooth/ folder. You can find this by locating where your python library you are using is saved. Depends on how you have your environment setup.

Open that file in Xcode or text editor - you will see the reference to "DEVICE_NAME_UUID = '00002a00-0000-1000-8000-00805f9b34fb'" on line 25. I left that as is and edited line 90 & 91 from:

name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) self.name = name.decode('ascii')

to

name = 'AC5002312' self.name = 'AC5002312'

The 2312 is the first 4 digits on the serial number after the model number - this was needed as it didn't work with just AC500. The EB3A is listed in the code as one of the devices so for yours you should try 'EB3AXXXX' with the Xs being the first 4 digits after 'EB3A' the 'Bluetti-mqtt --scan' command returns to you as per your first comment. Save the file. If you want to retain the original lines then duplicate them and edit one version and comment out the other with a # in front of the line. So if something doesn't work you can always return the code to how it was. eg.

name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID)

name = 'AC5002312'

self.name = name.decode('ascii')

self.name = 'AC5002312'

This bypasses the search and return of the device name and forced it to use my known device name.

I tested this on the logger first, which for you should be: bluetti-logger --log the-log-file.log CD9BF1CC-4B49-7811-68E2-570B5A7D0CB0

If it works there then you should be able to go ahead with the mqtt service.

If it doesn't work then try only 3 numbers after EB3A as I don't know how many numbers are used to reference the model for that device. I worked mine out through trial and error.

yugrinkov commented 1 year ago

@yugrinkov I got mine to work last night.

The Bluetti_MQTT code is looking for the UUID 00002a00-0000-1000-8000-00805f9b34fb which is assuming it is standard across Bluetti devices. This is supposed to be a published bluetooth "characteristic" that the code then decodes to the device name. This is not happening per the error message. Not sure if it is a Mac thing.

The device address you are getting is not wrong and looks different to windows machines but it is a useable address on Mac.

What I did to get around the issue was locate the file called "client.py" in Bluetti-mqtt/bluetooth/ folder. You can find this by locating where your python library you are using is saved. Depends on how you have your environment setup.

Open that file in Xcode or text editor - you will see the reference to "DEVICE_NAME_UUID = '00002a00-0000-1000-8000-00805f9b34fb'" on line 25. I left that as is and edited line 90 & 91 from:

name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) self.name = name.decode('ascii')

to

name = 'AC5002312' self.name = 'AC5002312'

The 2312 is the first 4 digits on the serial number after the model number - this was needed as it didn't work with just AC500. The EB3A is listed in the code as one of the devices so for yours you should try 'EB3AXXXX' with the Xs being the first 4 digits after 'EB3A' the 'Bluetti-mqtt --scan' command returns to you as per your first comment. Save the file. If you want to retain the original lines then duplicate them and edit one version and comment out the other with a # in front of the line. So if something doesn't work you can always return the code to how it was. eg.

name = await self.client.read_gatt_char(self.DEVICE_NAME_UUID) name = 'AC5002312' #self.name = name.decode('ascii') self.name = 'AC5002312'

This bypasses the search and return of the device name and forced it to use my known device name.

I tested this on the logger first, which for you should be: bluetti-logger --log the-log-file.log CD9BF1CC-4B49-7811-68E2-570B5A7D0CB0

If it works there then you should be able to go ahead with the mqtt service.

If it doesn't work then try only 3 numbers after EB3A as I don't know how many numbers are used to reference the model for that device. I worked mine out through trial and error.

Thank you! Amazing job! It works for me now!

TylerBizz commented 1 year ago

@yugrinkov Awesome! :)

There still needs to be a correction in the code to find the UUID that responds with the Model Number on MacOS so I will leave this open to see if someone else can assist. I cannot get the characteristic required to show when scanning the device from a Mac for published bluetooth data. So maybe an adjustment that asks for the Model number based on the Bluetti machine type can be input on request when running the script if there is no other way to call it on a Mac. But this kind of fix is a little beyond my knowledge at this time. I have also reached out to Bluetti to see if there is a change in the bluetooth characteristics published and to see if they can provide any other data.