diy solar

diy solar

Monitoring Bluetti Systems

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.
 
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!?
 
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.
 
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:
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
 
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.
 
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:
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...
 
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?
 
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.
 
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:
Hi to all,
I finally made it to install the bluetti to mqtt on my HA (running as a VM on a Synology NAS). All good, Bluetooth integrated, Bluetti AC500 connected, data is coming in (at least I can see the information in the protocol), bute there is no entity created which I can use. Any Ideas where to look? Regards Tapo
 
Hi to all,
I finally made it to install the bluetti to mqtt on my HA (running as a VM on a Synology NAS). All good, Bluetooth integrated, Bluetti AC500 connected, data is coming in (at least I can see the information in the protocol), bute there is no entity created which I can use. Any Ideas where to look? Regards Tapo
You have to install the MQTT addon at the HA. Did you do that ?
And create a user/pw for the service and use that when starting the bluetti_mqtt.
The Bluetti_Mqtt Service does not directly talk to HA, It sends its data to an mqtt server and HA automatically detects that and then integrates the entities.
 
Last edited:
You have to install the MQTT addon at the HA. Did you do that ?
And create a user/pw for the service and use that when starting the bluetti_mqtt.
The Bluetti_Mqtt Service does not directly talk to HA, It sends its data to an mqtt server and HA automatically detects that and then integrates the entities.
Hi, Thanks a lot. I did and linked it to the Mosquito MQTT Broker. Now the entity has been created and data is coming in. !Perfect! :) - Would be super helpful for each noob like me - to have these steps or prerequisites listed somewhere. Final question now - how to modify/add the DC charging Watt to KwH - to make it available for the batterie gauge within the energy dashboard - Where do I have to make this change? Regards Tapo
 
Hi, Thanks a lot. I did and linked it to the Mosquito MQTT Broker. Now the entity has been created and data is coming in. !Perfect! :) - Would be super helpful for each noob like me - to have these steps or prerequisites listed somewhere. Final question now - how to modify/add the DC charging Watt to KwH - to make it available for the batterie gauge within the energy dashboard - Where do I have to make this change? Regards Tapo
Discussion and solution is on the previous page ;)
 
here you can find a description for HA and HACS in German
I tested it with the AC300 and it works perfectly


here the GitHub- link

from Readme:
"This add-on was created as an easy method to get Bluetti data into Home Assistant, without having to setup [bluetti_mqtt](https://github.com/warhammerkid/bluetti_mqtt) on a separate device."
 
Last edited:
I had the bluetetti_mqtt running on my Raspi for e few months without any problems.
But since my HomeAssistant runs on an Intel Mini PC (Beelink S) i testet now the HACS integration.
But unfortunately it stops somewhere between a few minutes and a few hours.
I testet the none HACS integration before on another hardware (Beeline Pro 4) and had the same problem, so at least the cause could not be a defective hardware.
The Mini PC and the Raspi are located on the Top of my EP500Pro, so the Bluetooth connection should be very good.
I tried also to move the Mini PC 2m away from my Bluetti because I thought it might be too close. But still same problem.
Any idea how to pinpoint the problem ? I turned debug on and attached is the bluetti_mktt HA integration log:
 

Attachments

  • Debug-Log 20230228.txt
    6.1 KB · Views: 4
@MrGPS
Since I'm currently reassembling my Home Assistant, I've only tested it briefly and unfortunately can't say anything about a longer runtime.
I will test this over a longer period of time and then report back here.
 
Back
Top