Monitoring Bluetti Systems

MrGPS

New Member
Joined
Aug 3, 2022
Messages
14
I also have the AC200Max and a setup with bluetti-mqtt, Mosquitto, Telegraf and Grafana which just works fine. Only current downside is: As long as the Raspberry is connected via Bluetooth, I can' connect with the Bluetti app to turn AC on/off as the Bluetti can only be connected to one device at a time.

Any hints how to approach that?
I think that this is a limit how Bluetti implemented the Bluetooth conversation.
I am running the MQTT Server in home assistant and that makes it possible to turn the Powerstation outputs on/off via the Home Assistant App or WebGui or e.g. it is possible to automatically turn AC-Output off if battery is below 10% and turn it on again if it is above 50%.
Tip: According to the Home Assistant Website it is also possible to run Grafana inside HA and use the same database as HA.
 

ra-ma

New Member
Joined
Nov 6, 2022
Messages
2
I am running the MQTT Server in home assistant and that makes it possible to turn the Powerstation outputs on/off via the Home Assistant App or WebGui or e.g. it is possible to automatically turn AC-Output off if battery is below 10% and turn it on again if it is above 50%.
Tip: According to the Home Assistant Website it is also possible to run Grafana inside HA and use the same database as HA.
Thanks, but doesn't it mean that the Bluetti AC can be turned on via an MQTT command? If yes it should be possible to do that also without Homeassistant!?
 

MrGPS

New Member
Joined
Aug 3, 2022
Messages
14
Thanks, but doesn't it mean that the Bluetti AC can be turned on via an MQTT command? If yes it should be possible to do that also without Homeassistant!?
It is not bound to HA, i am using HA since i already had it running. The bluetti_mqtt software described here collects the data and sends it to an mqtt server. you can decide on which platform you run this server.
 

twister36

New Member
Joined
Sep 26, 2022
Messages
9
Hey guys, I recorded a video on how to install and use the Bluetti-MQTT service in hopes that this make things a little clearer for new users to get started with their own deployments.

 

BESA

New Member
Joined
Dec 2, 2022
Messages
1
Hi,
I don't have a running HA system, so I connected the BLUETTI-MQTT to my IOBROKER MQTT Instance. I can see all the status in my IOBROKER objects but I can't change values from my IOBROKER. I like to switch on / off DC power and also AC power, but I don't know how.

I don't see e.g.

bluetti/command/DEVICE_ID/ac_output_on - supports setting to ON or OFF

in my MQTT server. No "command" folder.

Okay got it. Defined those topics with Node-Red and now it works

Greetings

Bernd

PS: I own a AC500+2xB300S system
 
Last edited:

Martin42

New Member
Joined
Dec 29, 2022
Messages
1
Location
Leonberg
As far as I can tell only DC1 details are available over bluetooth. In theory there might be some way to switch it from reporting DC1 to DC2 to get both, but I haven't been able to figure out how to do that.
Hello together,
as we get "DC_INPUT_POWER" (both inputs together) and DC1 input ("INTERNAL_DC_INPUT_POWER") separately it should be correct to calculate the value for DC2 :)

I'm using https://github.com/mariolukas/Bluetti_ESP32_Bridge and have implemented it like that in PayloadParser.cpp:

Code:
...
int16_t last_solar_sum=(-1);
int16_t last_solar_dc1=(-1);
...

        if(bluetti_device_state[i].f_name == DC_INPUT_POWER) last_solar_sum=parse_uint_field(data_payload_field);
        if(bluetti_device_state[i].f_name == INTERNAL_DC_INPUT_POWER) last_solar_dc1=parse_uint_field(data_payload_field);     
        if( (bluetti_device_state[i].f_name == DC_INPUT_POWER) || (bluetti_device_state[i].f_name == INTERNAL_DC_INPUT_POWER) )
        {
          if( (last_solar_sum >= last_solar_dc1) && (last_solar_sum >= 0) && (last_solar_dc1 >= 0) ) publishTopic(CALC_DC2_INPUT_POWER, String(last_solar_sum - last_solar_dc1));
        }
...

Seems to work very well.

Greetings,
Martin
 

twister36

New Member
Joined
Sep 26, 2022
Messages
9
Hello together,
as we get "DC_INPUT_POWER" (both inputs together) and DC1 input ("INTERNAL_DC_INPUT_POWER") separately it should be correct to calculate the value for DC2 :)

I'm using https://github.com/mariolukas/Bluetti_ESP32_Bridge and have implemented it like that in PayloadParser.cpp:

Code:
...
int16_t last_solar_sum=(-1);
int16_t last_solar_dc1=(-1);
...

        if(bluetti_device_state[i].f_name == DC_INPUT_POWER) last_solar_sum=parse_uint_field(data_payload_field);
        if(bluetti_device_state[i].f_name == INTERNAL_DC_INPUT_POWER) last_solar_dc1=parse_uint_field(data_payload_field);    
        if( (bluetti_device_state[i].f_name == DC_INPUT_POWER) || (bluetti_device_state[i].f_name == INTERNAL_DC_INPUT_POWER) )
        {
          if( (last_solar_sum >= last_solar_dc1) && (last_solar_sum >= 0) && (last_solar_dc1 >= 0) ) publishTopic(CALC_DC2_INPUT_POWER, String(last_solar_sum - last_solar_dc1));
        }
...

Seems to work very well.

Greetings,
Martin
This "works" only to some extent. The DC total and DC Input 1 might not update at the same time and will give a slight inaccurate reading on wattage during that time. Also this doesn't allow for the amp/volts to be identified for DC2, which is very important for PV.
 

Dorfkind

New Member
Joined
Jan 8, 2023
Messages
4
Location
Somewhere
Hi,
found this site digging the internet in search for "bluetti monitoring". Hi anyone :cool:
I'm totally new to this MQTT and Home Automation stuff, so please forgive me my maybe dumb questions...

What I did so far:
- Bought an AC200M (Location: basement)
- Bought a Bananapi, installed Armbian (Location: basement). Is talking bluetooth to the Bluetti and is reachable via Wifi from my PC (Linux) in the livingroom
- Installed bluetti-mqtt on the Bananapi. Finds the Bluetti:
Code:
root@bananapi:~# bluetti-mqtt --scan

Scanning....

Found AC200Mwhatsoever: address 00:11:22:33:44:55

But if I try to connect, I end up with
 
Last edited:

Dorfkind

New Member
Joined
Jan 8, 2023
Messages
4
Location
Somewhere
Code:
root@bananapi:~# bluetti-mqtt --broker 127.0.0.1 --username banana --password banana 00:11:22:22:44:55
2023-01-09 07:44:56 INFO     Connecting to MQTT broker...
2023-01-09 07:44:56 INFO     Starting to poll clients...
2023-01-09 07:44:56 INFO     Connecting to clients: ['00:11:22:33:44:55']
2023-01-09 07:44:56 ERROR    MQTT error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/bluetti_mqtt/mqtt_client.py", line 447, in run
    async with Client(
  File "/usr/local/lib/python3.11/dist-packages/asyncio_mqtt/client.py", line 822, in __aenter__
    await self.connect()
  File "/usr/local/lib/python3.11/dist-packages/asyncio_mqtt/client.py", line 390, in connect
    raise MqttError(str(error)) from None
asyncio_mqtt.error.MqttError: [Errno 111] Connection refused
2023-01-09 07:44:58 ERROR    Error connecting to device 00:11:22:22:44:55:
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/bluetti_mqtt/bluetooth/client.py", line 40, in run
    await self.client.connect()
  File "/usr/local/lib/python3.11/dist-packages/bleak/__init__.py", line 471, in connect
    return await self._backend.connect(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/bleak/backends/bluezdbus/client.py", line 190, in connect
    assert_reply(reply)
  File "/usr/local/lib/python3.11/dist-packages/bleak/backends/bluezdbus/utils.py", line 20, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] le-connection-abort-by-local
2023-01-09 07:44:59 INFO     Retrying connection to 00:11:22:22:44:55
2023-01-09 07:45:00 ERROR    Error connecting to device 00:11:22:22:44:55:
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/bluetti_mqtt/bluetooth/client.py", line 40, in run
    await self.client.connect()
  File "/usr/local/lib/python3.11/dist-packages/bleak/__init__.py", line 471, in connect
    return await self._backend.connect(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/bleak/backends/bluezdbus/client.py", line 190, in connect
    assert_reply(reply)
  File "/usr/local/lib/python3.11/dist-packages/bleak/backends/bluezdbus/utils.py", line 20, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] le-connection-abort-by-local

What am I doing wrong?
Thanks in advance

Edit: Doing this without user/pass doesn´t change anything...
 

Dorfkind

New Member
Joined
Jan 8, 2023
Messages
4
Location
Somewhere
Code:
root@bananapi:~# bluetti-mqtt --broker 127.0.0.1 --username banana --password banana 00:11:22:22:44:55
2023-01-09 07:44:56 INFO     Connecting to MQTT broker...
2023-01-09 07:44:56 INFO     Starting to poll clients...
2023-01-09 07:44:56 INFO     Connecting to clients: ['00:11:22:33:44:55']
2023-01-09 07:44:56 ERROR    MQTT error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/bluetti_mqtt/mqtt_client.py", line 447, in run
    async with Client(
  File "/usr/local/lib/python3.11/dist-packages/asyncio_mqtt/client.py", line 822, in __aenter__
    await self.connect()
  File "/usr/local/lib/python3.11/dist-packages/asyncio_mqtt/client.py", line 390, in connect
    raise MqttError(str(error)) from None
asyncio_mqtt.error.MqttError: [Errno 111] Connection refused
2023-01-09 07:44:58 ERROR    Error connecting to device 00:11:22:22:44:55:
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/bluetti_mqtt/bluetooth/client.py", line 40, in run
    await self.client.connect()
  File "/usr/local/lib/python3.11/dist-packages/bleak/__init__.py", line 471, in connect
    return await self._backend.connect(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/bleak/backends/bluezdbus/client.py", line 190, in connect
    assert_reply(reply)
  File "/usr/local/lib/python3.11/dist-packages/bleak/backends/bluezdbus/utils.py", line 20, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] le-connection-abort-by-local
2023-01-09 07:44:59 INFO     Retrying connection to 00:11:22:22:44:55
2023-01-09 07:45:00 ERROR    Error connecting to device 00:11:22:22:44:55:
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/bluetti_mqtt/bluetooth/client.py", line 40, in run
    await self.client.connect()
  File "/usr/local/lib/python3.11/dist-packages/bleak/__init__.py", line 471, in connect
    return await self._backend.connect(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/bleak/backends/bluezdbus/client.py", line 190, in connect
    assert_reply(reply)
  File "/usr/local/lib/python3.11/dist-packages/bleak/backends/bluezdbus/utils.py", line 20, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] le-connection-abort-by-local

What am I doing wrong?
Thanks in advance

Edit: Doing this without user/pass doesn´t change anything...
*bump*

really no one?
 

chromedshark

New Member
Joined
Apr 3, 2022
Messages
31
Hi,
found this site digging the internet in search for "bluetti monitoring". Hi anyone :cool:
I'm totally new to this MQTT and Home Automation stuff, so please forgive me my maybe dumb questions...

What I did so far:
- Bought an AC200M (Location: basement)
- Bought a Bananapi, installed Armbian (Location: basement). Is talking bluetooth to the Bluetti and is reachable via Wifi from my PC (Linux) in the livingroom
- Installed bluetti-mqtt on the Bananapi. Finds the Bluetti:
Code:
root@bananapi:~# bluetti-mqtt --scan

Scanning....

Found AC200Mwhatsoever: address 00:11:22:33:44:55

But if I try to connect, I end up with

So it looks like there are two errors here:
1. The first error is that it cannot connect to an MQTT broker. You must install an MQTT broker like Mosquitto separately (or use the MQTT broker integration for Home Assistant if you want to go that route). By default they won't have a username or password.
2. The second error appears to be a connection error. The good old "turn it off and back on" advice some times fixes these kinds of things - turn off bluetooth on your AC200M and then turn it back on again.
 

Dorfkind

New Member
Joined
Jan 8, 2023
Messages
4
Location
Somewhere
Hi @chromedshark,

thanks for help, you brought me in the right direction. My wrong assumption was, that bluetti-mqtt itself is a MQTT broker, silly me...
So I just installed mosquitto on the bananapi, found a better position for it to join bluetooth and, tada:

Code:
root@bananapi:~# bluetti-mqtt --broker 127.0.0.1 00:11:22:33:44:55
2023-01-17 16:58:46 INFO     Connecting to MQTT broker...
2023-01-17 16:58:46 INFO     Starting to poll clients...
2023-01-17 16:58:46 INFO     Connecting to clients: ['00:11:22:33:44:55']
2023-01-17 16:58:46 INFO     Connected to MQTT broker
2023-01-17 16:58:46 INFO     Sent discovery message of AC200M-xxxxxxxxxxx to Home Assistant
2023-01-17 16:58:46 WARNING  filtered_messages() is deprecated and will be removed in a future version. Use messages() together with Topic.matches() instead.
2023-01-17 16:58:46 INFO     Connected to device: 00:11:22:33:44:55

My home assistant on my working PC is not finding the MQTT broker on the bananapi, maybe a (hidden) setting on mosquitto...

Again, thanks so far

Ha, got it:
Code:
listener 1883 0.0.0.0
allow_anonymous true
in the mosquitto.conf (y)
 
Last edited:
Top