bluetti_mqtt: Error retrieving device name on MacOS
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 © (22F770820d)
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 16
@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.