Package: bluetti-mqtt
This tool provides an MQTT interface to Bluetti power stations. State will be
published to thebluetti/state/[DEVICENAME]/[PROPERTY]topic, and commands
can be sent to thebluetti/command/[DEVICENAME]/[PROPERTY]topic.Installation$pipinstallbluetti_mqttUsage$bluetti-mqtt--scanFoundAC3001234567890123:address00:11:22:33:44:55$bluetti-mqtt--broker[MQTT_BROKER_HOST]00:11:22:33:44:55If your MQTT broker has a username and password, you can pass those in.$bluetti-mqtt--broker[MQTT_BROKER_HOST]--usernameusername--passwordpass00:11:22:33:44:55By default the device is polled as quickly as possible, but if you’d like to
collect less data, the polling interval can be adjusted.# Poll every 60s$bluetti-mqtt--broker[MQTT_BROKER_HOST]--interval6000:11:22:33:44:55If you have multiple devices within bluetooth range, you can monitor all of
them with just a single command. We can only talk to one device at a time, so
you may notice some irregularity in the collected data, especially if you have
not set an interval.$bluetti-mqtt--broker[MQTT_BROKER_HOST]00:11:22:33:44:5500:11:22:33:44:66Background ServiceIf you are running on a platform with systemd, you can use the following as a
template. It should be placed in/etc/systemd/system/bluetti-mqtt.service.
Once you’ve written the file, you’ll need to runsudo systemctl startbluetti-mqtt. If you want it to run automatically after
rebooting, you’ll also need to runsudo systemctl enablebluetti-mqtt.[Unit]Description=BluettiMQTTAfter=network.targetStartLimitIntervalSec=0[Service]Type=simpleRestart=alwaysRestartSec=30TimeoutStopSec=15User=your_username_hereExecStart=/home/your_username_here/.local/bin/bluetti-mqtt--broker[MQTT_BROKER_HOST]00:11:22:33:44:55[Install]WantedBy=multi-user.targetHome Assistant IntegrationIf you have configured Home Assistant to use the same MQTT broker, then by
default most data and switches will be automatically configured there. This is
possible thanks to Home Assistant’s support for automatic MQTT discovery, which
is enabled by default with the discovery prefix ofhomeassistant.This can be controlled with the--ha-configflag, which defaults to
configuring most fields (“normal”). Home Assistant MQTT discovery can also be
disabled, or additional internal device fields can be configured with the
“advanced” option.Reverse EngineeringFor research purposes you can also use thebluetti-loggercommand to poll
the device and log in a standardised format.$bluetti-logger--logthe-log-file.log00:11:22:33:44:55While the logger is running, change settings on the device and take note of the
time when you made the change, waiting ~ 1 minute between changes. Note that
not every setting that can be changed on the device can be changed over
bluetooth.If you’re looking to add support to control something that the app can change
but cannot be changed directly from the device screen, both iOS and Android
support collecting bluetooth logs from running apps. Additionally, with the
correct hardware Wireshark can be used to collect logs. With these logs and a
report of what commands were sent at what times, this data can be used to
reverse engineer support.For supporting new devices, thebluetti-discoverycommand is provided. It
will scan from 0 to 12500 assuming MODBUS-over-Bluetooth. This will take a
while and requires that the scanned device be in close Bluetooth range for
optimal performance.$bluetti-discovery--scanFoundAC3001234567890123:address00:11:22:33:44:55$bluetti-discovery--logthe-log-file.log00:11:22:33:44:55