giovanne123 / EB3A_Bluetti_ESP32_HA

Interface between Bluetti-EB3A and HA by using a ESP32 with Bluetooth and MQTT
GNU General Public License v3.0
4 stars 0 forks source link

17.07.2024, I have no longer a Bluetti EB3A, so will no longer support this repo/project


EB3A_Bluetti_ESP32_HA

Interface between Bluetti-EB3A and HA by using a ESP32 with Bluetooth and MQTT (see below original)

Extended with focus to EB3A

(- controlling will be done in HA by Automations, ...)

!!! Lot's is Quick&Dirty because needed the EB3A running for Solar over-production redirection ;-) !!!


Example: HA and MQTT


Example: Servo

Todo:

(Have put everything in new repository because too much implemented Quick & Dirty for EB3A)


Initial ideas by and thanks to:

Original from above:


About

This is an ESP32 based Bluetooth to MQTT Bride for BLUETTI power stations. The project is based on https://github.com/warhammerkid/bluetti_mqtt The code is tested on a AC300. Other Powerstations should also work but are untested yet. The discussion on https://diysolarforum.com/threads/monitoring-bluetti-systems.37870/ was a great help for understanding the protocol.

Community

Join the Discord Server https://discord.gg/6ukb8rnk

Features

Getting Started

Compiling and Flashing to ESP32

Arduino IDE

You will need to install a board support package for your ESP32. Additionally the following libraries are needed:

Change the partition scheme with Tools -> Partition Scheme to

Wifi Manager start menu

This setting is required because the Bluetooth stack already uses a lot of the ESP32 memory.

Optional: Do changes in config.h file. The device can be set by changing 'BLUETTI_TYPE'.

Finally upload the Sketch to your ESP32.

INFO: Until now only BLUETTI_AC300, BLUETTI_EP500P was tested. If you own one of the supported devices please let me know if it works.

PlatformIO

Compiling

$ pio run

Flashing Factory Image

$ esptool.py write_flash 0x0 build/Bluetti_ESP32_Bridge.factory.bin

Updating only App (don't delete settings)

# Write Partition A
$ esptool.py write_flash 0x10000 build/Bluetti_ESP32_Bridge.ota.bin
...
# Write Partition B
$ esptool.py write_flash 0x1F0000 build/Bluetti_ESP32_Bridge.ota.bin

The configuration interface also offers OTA updates. You can flash also build/Bluetti_ESP32_Bridge.ota.bin there. If you already configured your device you can use http://<ip_address/update to update your firmware (no-reconfiguration needed)

Usage

Just connect the ESP32 to a power supply or the power station itself. Connect your mobile phone or computer to the Wifi mangaer of the ESP32 firmware, it should show up as "ESP32_Bluetti".

After the connection to the hotspot is established a wifi manager popup will appear. Otherwise open 192.168.4.1 in your local webbrowser.

Select "Configure WiFi"

Wifi Manager start menu

Configure your WiFi and set the address of your MQTT server and enter the Bluetooth ID of your Bluetti Device. Optionally you can specify username and password to protect the web OTA interface. You can use a mobile phone and/or the Bluetti APP for finding the correct Bluetooth ID of your device.

Wifi Manager start menu

Save the settings. The ESP32 starts sending messages to your MQTT server.

Example ( ioBroker ): MQTT ioBroker

MQTT Topics

Commands

Commands are subscribed from

State

States are published to

TODO

Disclaimer

The code within this repository comes with no guarantee, use it on your own risk.

Don't touch these firmwares if you don't know how to put the device in the programming mode if something goes wrong. As per the GPL v3 license, I assume no liability for any damage to you or any other person or equipment.