Official Bluetti Device API Survey

This one?

+1, we need this, can’t do any automation without it

3 Likes

Recently got a new AC180, after the old one started playing. Really disappointed to find it has stopped working with Home Assistant, with the warhammer, and others, integration. I feel it is imperative, that it is controllable within Home assistant, as there are so many user in the same position, as demonstrated already by the number of availabe efforts on Github.
The only output is via bluetooth, so, some how this needs to be readable by home assistant. Whereas, at the moment, with the warhammer integration, we have to run a python script in the background on a PC, that then sends MQTT to home assistant.
Or
Something like the " hassio-bluetti-bt", which does not now connect to new encrypted machines.
Or
Perhaps, if Bluetti could produce , something like an ESPHome, type of dongle, that could connect to the power station, via bluetooth and then, that information could be availabe via wifi sent to Home assistant, maybe.
.
But ultimately, I agree we need “an official MQTT/HomeAssistant/HomeAutomation integration for Bluetti products”. I can’t believe it would be that difficult for the team at Bluetti, who have all the required information, rather than relying, on independent users to hack into the sytem,
.
Anyone who reads these post, I would strongly urge, to comment, to let Bluetti, know the strength of feeling.
Apologies, if this is a bit longwinded.

They work on it. Bluetti already provide a encryption module

Thats the main problem. Every function needs to be reverse engineered. The devs know all the modbus registers and could easily merge new function into projects

Well, the encryption module is, in it’s current state, quite useless. it runs on x86 systems only, i guess >90% of all home assistant installations are on arm systems like raspberry pi.

Also i’m not quite comfortable with installing proprietary, closed source software on my systems. i prefer to be in control of my devices, not the other way around.

Yeah, i already mention this on their repo. There is a fork of one of the Bluetti MQTT Projects that implement the encryption feature without the Bluetti provided part (based on reverse engineering?) Works perfectly. Sadly i dont find this repo anymore

Falls du es findest, lass es mich bitte wissen :smiley:

@corefusion Think i found it:

GitHub - nhurman/bluetti_mqtt: MQTT interface for Bluetti power stations

Atleast it have the commit for supporting V2 Devices and encryption.

Ah, i know that one. Unfortunately i cant get it to work. :frowning:

hmm, i use it for the logging part and was able to pull the modbus commands from encrypted and unencrypted units without problem (on raspberry Pi 3). So the basic function seems to be there.

What you error with it?

Well, in the end it comes down to the fact that i’m propably too stupid to work with docker images :joy:
i have HAOS running on my pi and the bluetti2mqtt addon always reverts back to the original bluetti_mqtt by warhammerkid

You are not alone.
I’ve tried installing nhurman version. I get errors running it
.
C:\Windows\System32>bluetti-mqtt --scan
Traceback (most recent call last):
File “< frozen runpy>”, line 198, in run_module_as_main
File “< frozen runpy>”, line 88, in run_code
File “C:\Program Files\Python313\Scripts\bluetti-mqtt.exe_main
.py”, line 4, in
from bluetti_mqtt.server_cli import main
File “C:\Program Files\Python313\Lib\site-packages\bluetti_mqtt\server_cli.py”, line 9, in
from bluetti_mqtt.bluetooth import scan_devices
File “C:\Program Files\Python313\Lib\site-packages\bluetti_mqtt\bluetooth_init
.py”, line 7, in
from .client import BluetoothClient
File “C:\Program Files\Python313\Lib\site-packages\bluetti_mqtt\bluetooth\client.py”, line 9, in
from .encryption import Connection, PassthroughConnection, EncryptedConnection
File “C:\Program Files\Python313\Lib\site-packages\bluetti_mqtt\bluetooth\encryption.py”, line 60, in
from cryptography.exceptions import InvalidSignature
ModuleNotFoundError: No module named ‘cryptography’
.
I find it difficult to understand the vagaries of Python. Different versions for different platforms, different versions within these platforms, different “PIP”. I copied the nhurman version to my “C:\Program Files\Python313\Lib\site-packages”, uninstalled the warhammer version, I think! And installed using the path “C:\Program Files\Python313\Lib\site-packages\bluetti_mqtt_main”, that pointed to the nhurman version. And it seemed to install, but get the errors as above. So no further forward.
I’m a hardware person, I am taking my EB3A apart, to see if I can find somewhere to tap in to the signal before bluetooth mashes it up.

@bres55 @corefusion Im really active on this topic and try to find a solution with Bluettis R&D Team. This survey was the first step.

If there is any news on this topic, i will let you guys now!

2 Likes

I feel one shouldn’t need to be a tech wizard to make it work.
Maybe, in between, while we wait, an alternative from Bluretti, could be to give more options within the app.
Like,
Set a discharge level, to switch off AC, and another for DC.
A trigger based on SOC level for AC and another for DC, to switch on.
Maybe have a Solar minimum maximum trigger too.
Definitely some history graph of inputs and outputs.
You get the idea. Give us more control.
I am also flumoxed why the bluetooth signal is so weak, and drops off all the time, even standing right next to it.
Happy to try any suggestions, from Bluetti, or others, to find solutions.

Sure, they could put a lot of work in the App. In my opinion, such a API is much easier for them. Instead of note every little feature people want to see, they just provide a API and people build exactly what they need with it.

Well, i did it.

Using this repo. Had to hack around as root a bit on my Pi, but now it seems to work just fine.

here’s the diff of what i have changed

bluetti_mqtt/bluetooth/__init__.py
13c13
< DEVICE_NAME_RE = re.compile(r'^(AC180|AC200M|AC300|AC500|AC60|EP500P|EP500|EP600|EB3A)(\d+)$')
---
> DEVICE_NAME_RE = re.compile(r'^(AC180P|AC180|AC200M|AC300|AC500|AC60|EP500P|EP500|EP600|EB3A)(\d+)$')
30a31,32
>     if match[1] == 'AC180P':
>         return V2Device(address, match[2], 'AC180P')

Hope this info is of use to someone.
be carefull with root, everything you do is at your own risk :grin:

In your case you’re missing the crypthography package.
install it with

pip install cryptography==44.0.0

also make sure you’ve installed all the other packages as listed in the requirements.txt file that came with bluetti_mqtt.
hope that helps :slight_smile:

Thanks for that.
I’m sure I installed all the requirments previously, and then, when errors occured, started again, must have missed it second time around.
It got me further.
.

C:\Windows\System32>bluetti-mqtt --scan
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Program Files\Python313\Scripts\bluetti-mqtt.exe\__main__.py", line 7, in <module>
    sys.exit(main())
             ~~~~^^
TypeError: main() missing 1 required positional argument: 'argv'

.
I can’t see anything looking like main.py so not sure what’s missing.

Hmmm… Since im no expert in python whatsoever, i dont know what’s wrong there. I would suggest to remove and reinstall the bluetti_mqtt package via pip. maybe that will help you solving the issue.

That’s exactly how I did it.

C:\Windows\System32>pip uninstall bluetti_mqtt
Found existing installation: bluetti-mqtt 0.15.0
Uninstalling bluetti-mqtt-0.15.0:
  Would remove:
    c:\program files\python313\lib\site-packages\bluetti_mqtt-0.15.0.dist-info\*
    c:\program files\python313\lib\site-packages\bluetti_mqtt\*
    c:\program files\python313\scripts\bluetti-discovery.exe
    c:\program files\python313\scripts\bluetti-logger.exe
    c:\program files\python313\scripts\bluetti-mqtt.exe
 Successfully uninstalled bluetti-mqtt-0.15.0

C:\Windows\System32>pip install "C:\Program Files\Python313\Lib\site-packages\bluetti_mqtt_main"
Processing c:\program files\python313\lib\site-packages\bluetti_mqtt_main
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: asyncio-mqtt in c:\program files\python313\lib\site-packages (from bluetti_mqtt==0.15.0) (0.12.1)
Requirement already satisfied: bleak in c:\program files\python313\lib\site-packages (from bluetti_mqtt==0.15.0) (0.22.3)
Requirement already satisfied: crcmod in c:\program files\python313\lib\site-packages (from bluetti_mqtt==0.15.0) (1.7)
Requirement already satisfied: paho-mqtt>=1.6.0 in c:\program files\python313\lib\site-packages (from asyncio-mqtt->bluetti_mqtt==0.15.0) (1.6.1)
Requirement already satisfied: winrt-Windows.Devices.Bluetooth<3,>=2 in c:\program files\python313\lib\site-packages (from bleak->bluetti_mqtt==0.15.0) (2.3.0)
Requirement already satisfied: winrt-Windows.Devices.Bluetooth.Advertisement<3,>=2 in c:\program files\python313\lib\site-packages (from bleak->bluetti_mqtt==0.15.0) (2.3.0)
Requirement already satisfied: winrt-Windows.Devices.Bluetooth.GenericAttributeProfile<3,>=2 in c:\program files\python313\lib\site-packages (from bleak->bluetti_mqtt==0.15.0) (2.3.0)
Requirement already satisfied: winrt-Windows.Devices.Enumeration<3,>=2 in c:\program files\python313\lib\site-packages (from bleak->bluetti_mqtt==0.15.0) (2.3.0)
Requirement already satisfied: winrt-Windows.Foundation<3,>=2 in c:\program files\python313\lib\site-packages (from bleak->bluetti_mqtt==0.15.0) (2.3.0)
Requirement already satisfied: winrt-Windows.Foundation.Collections<3,>=2 in c:\program files\python313\lib\site-packages (from bleak->bluetti_mqtt==0.15.0) (2.3.0)
Requirement already satisfied: winrt-Windows.Storage.Streams<3,>=2 in c:\program files\python313\lib\site-packages (from bleak->bluetti_mqtt==0.15.0) (2.3.0)
Requirement already satisfied: winrt-runtime<3,>=2 in c:\program files\python313\lib\site-packages (from bleak->bluetti_mqtt==0.15.0) (2.3.0)
Building wheels for collected packages: bluetti_mqtt
  Building wheel for bluetti_mqtt (pyproject.toml) ... done
  Created wheel for bluetti_mqtt: filename=bluetti_mqtt-0.15.0-py3-none-any.whl size=44080 sha256=283c6db554679de632842f921ed33badb3cbb5555a42eeb8eea014631b543dec
  Stored in directory: C:\Users\micha\AppData\Local\Temp\pip-ephem-wheel-cache-th0tcu25\wheels\08\45\e2\59a23d3fdd112998c5a88405090be030ceb3c3fcc8127608ca
Successfully built bluetti_mqtt
Installing collected packages: bluetti_mqtt
Successfully installed bluetti_mqtt-0.15.0

[notice] A new release of pip is available: 25.0.1 -> 25.1.1
[notice] To update, run: python.exe -m pip install --upgrade pip

C:\Windows\System32>bluetti-mqtt --scan
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Program Files\Python313\Scripts\bluetti-mqtt.exe\__main__.py", line 7, in <module>
    sys.exit(main())
             ~~~~^^
TypeError: main() missing 1 required positional argument: 'argv'

C:\Windows\System32>

I’m the same about Python, and not really in the frame of mind to get too involved with it.
But I do appreciate your suggestions.