API or Web Server power status

Previously, I’ve asked Bluetti about an API, but the response I received seemed to suggest no plans or consideration was being given to opening up an API.

My primary desire is to be able to log solar input, grid input and output and take appropriate automated actions based on these to manage loads and alerts (I have the actions/alerts already in place). At the most basic level, I would even be content if the device home screen was available via a simple HTTP server.

I noticed when the EP500Pro is connected to wifi it has a listening socket on port 80. Has anyone been able to run any packet captures to determine if it’s possible to extract this information? I noticed that at least one competing product had an API available. I’m happy with my units, but I’d hate to have to have to setup external monitoring clamps on PV, Grid and Output just to get this, when I know it’s already available (but just not exposed).

4 Likes

I can recommend using an app named Wireshark to listen to the packets being transmitted. Port 80 is the common port for HTTP and maybe the Bluetti app uses it, to

I agree that Bluetti should allow other apps to access the power station status. I need to monitor all alarms and certain parameters, such as battery charge, DC and AC inputs and outputs so I can create my own alarms on my Samsung tablet to warn me when something happens.

I’ve been working on an API for a few months now in my spare time, and have made some progress, but also have a ways to go. There’s more detail over at the thread I created, but basically I figured out how to control and monitor the device over either wifi or bluetooth and I’m currently working on putting something together to release. My current rough plan is to release something that runs on Linux and exposes an MQTT interface to Home Assistant by using the bluetooth interface. If you have thoughts about what you’d like, feel free to share them over there.

If you’d like to help out, feel free to DM your email and I can send you a script to run that can log your device info. You’ll need a computer with bluetooth running Linux (I’m using a raspberry pi). I don’t have access to an EP500, and I’m assuming it works similarly to the AC300 (and AC200MAX), but more info is always useful.

5 Likes

Hi @Chromedshark thank you for the response. I’ve managed to take a tcpdump after enabling port mirror on my switch. I’ll DM you the relevant portion and try to help in anyway I can.

The MQTT interface sounds good, REST API would also be good. Hopefully your design can handle multiple units of the same type. I’m curious about the split phase operation modes as well.

Let me know how I can help… I’m would be interested in this ability as well.

One thing I’ve noticed since allowing the AC300’s on my network are warning from my security system about the AC300. It calls it a “Shanghai High-Flying Smart Plug” and says that it’s authentication procedure uses unencrypted (plain text) authentication… this is actually being flagged by my network monitoring as a high risk item.

1 Like

And yet… https://api.bluettipower.com/ exists. There is an API, we just lack the public endpoints to make it usable for us.

I installed the bluetti_mqtt package, but when I try to run the following command I get this error:
bluetti_mqtt --scan

Traceback (most recent call last):
File “<pyshell#8>”, line 1, in
bluetti_mqtt --scan
NameError: name ‘scan’ is not defined

It appears that you’re running this from inside the Python shell, when the command should be run from inside PowerShell or the Command Prompt on Windows. It should also be bluetti-mqtt --scan, without the underscore.

I got your email…

It looks like the variable “bluetti-mqtt” was not mapped in my windows system environment variables. I had to run sysdm.cpl and add the keyword “bluetti-mqtt” to map to the location of the bluetti-mqtt.exe file.

So I see both AC300 after my scan… but is this going through my computers WIFI or Bluetooth?

The Bluetti EP500 Pro does not have the possibility to log data such as the solar energy coming in via solar panels, the additional grid energy at low capacity level, the current consumption or the current capacity in a database.

However, the data logged in a database would allow for a variety of interesting analyses. For example, numerous statistics and interesting graphs can be generated from the data. If I integrate over the logged data in certain time periods, I can calculate the total energy harvested or consumption during that period. This data in turn can be used to calculate monthly statistics or how differently the plant performs in the 4 seasons.

Basically anything can be calculated that is possible with a little SQL and a few tables.

Also a fancy website would be possible, where you can see from anywhere in the world what the energy production and usage at home is doing.

For this reason I developed the Bluetti DB Bridge. An ESP32 based device that makes contact with the Bluetti via Bluetooth, gets the data I mentioned and then some, and transmits it directly via WiFi to a MySQL database located on a Raspberry Pi where it is stored in a table. This was only possible with some initial help about the codes from Chromedshark!

In addition, the Bluetti DB Bridge allows me to display the most important data directly at my workstation!

3 Likes

Absolutely amazing, guys! Looking forward to whatever will be coming out of these efforts :partying_face:

That’s pretty cool! Would you be willing to share the parts list so I could go ahead and try to build one?

I’m running Home Assistant on a Raspberry Pi but I have never done anything with an ESP32 device.

My setup these days basically involves one Raspberry Pi running the MQTT service I wrote in bluetooth range of my AC300+B300 and connected over wifi to my “server” Raspberry Pi running my MQTT broker, Prometheus for data storage, Grafana, and a script I wrote to publish data from the MQTT broker to Prometheus. This gives me pretty charts for monitoring my setup, as well as historical records, which is all I really need at the moment.

3 Likes

You only need a TTGO T-Display and a little bit programming skills.

I have to give props to @Chromedshark I’m using his project. The default setup and integration with Home Assistant allows one to easily gather and chart the data without much manual setup. Pretty much the MQTT integration with HA provides everything needed for decent analysis.

This is from Home Assistant for two EP500Ps with minor customization (top charts are for DC in and bottom for AC out):

If you need to capture into another mysql database, this is also pretty easy to do just with the previously mentioned project. Using a little python script mqttdb.py, you can capture it all into a database. Once you have that you can use Grafana or other utilities to plot anything you like.

Some people may be wondering, how useful is it to plot the data?
For reference, I’m using a few solar panels to charge the batteries, then running the inverter for a few hours a day during sunlight as well as charge back up the batteries until the next day. I’ve learned from the data on the EP500Ps I’ve monitored. The resting voltage you leave the battery charged up at and the way you taper the charge matters at how quickly the battery discharges until the next day. Check out the red and green nightly drops:

Again, much thanks go to @Chromedshark his contirbution is greatly appreciated!

Any chance this could integrate with IFTTT? I posted separately about my interest in triggering grid charging when the Bluetti battery level got too low.

You can already do this (trigger grid charging when battery level becomes predefined low) with the latest release in Home Assistant (no need for IFTTT). Since Home Assistant already supports IFTTT anyway, it’s entirely possible to tie that in if you choose to do something with that anyway.

1 Like

Hi @Chromedshark - wow you did an amazing work!! I just struggle with the server.rb to get the data into my Prometheus db. Can you help with that? Thanks already!!!

hello folks - any new news on this thread? Or other solutions? Seems like a big gap with the Bluetti app and easy to fix.

At current time I use a combination of scheduled AC charging and manually monitoring via the iOS app - then using the remote switch to top it up as needed. (I had issues the last time I accidentally ran it down to 0%)

It would be great to have an IFTTT or SmartThings visibility to battery levels (which would also allow a connection into Amazon Echo, etc).