Hi everyone! I wanted to share a method I developed for integrating my Bluetti power station with Homey. It’s been a fantastic way to monitor and control my energy setup directly from my smartphone. Here’s how I did it:
What You’ll Need:
- An ESP32 board with custom firmware to bridge Bluetooth data to JSON format.
- The Device Capabilities app.
- The HomeyScript app.
Step-by-Step Guide:
-
Set Up the ESP32 Bridge:
- Flash your ESP32 with my custom firmware fork, which converts Bluetti data into JSON format. You can find the firmware on GitHub.
- Configure the ESP32 to connect to your Bluetti device and ensure it’s on the same network as your Homey.
-
Create a Virtual Device:
- Use the Device Capabilities app to create a new virtual device. This will mimic the functionality of your Bluetti power station within Homey.
- Define the capabilities your virtual device will have, such as monitoring solar power, home power, grid power, and battery levels.
-
Configure HomeyScript:
- Write a script to fetch data from your ESP32 bridge and update the virtual device. Here’s a sample script I used:
javascript
const b_ip = ‘YOUR_ESP32_BRIDGE_IP’;
const b_baseurl = ‘http://’ + b_ip + ‘/getData’;
// Function to format numbers
function toFixed(num) {
return Math.trunc((num / 1000) * 100) / 100;
}// Fetch data from ESP32
try {
const res = await fetch(b_baseurl);
if (res.ok) {
const data = await res.json();
// Update virtual device tags with fetched data
if (data[‘dc_input_power’] != null) {
bluetti.solar_power = toFixed(data[‘dc_input_power’]);
}
// Continue updating other parameters…
}
} catch (err) {
// Handle errors
} - Write a script to fetch data from your ESP32 bridge and update the virtual device. Here’s a sample script I used:
-
Link Everything Together:
- Use flows in Homey to automate actions based on your Bluetti’s data. For example, you could set up a flow to turn on lights when the battery level drops below a certain threshold.
Why This Setup Works:
- It provides real-time monitoring of your power station’s performance.
- It integrates seamlessly with Homey’s ecosystem, allowing for custom automation.
- It’s cost-effective and leverages existing hardware like the ESP32.
I hope this guide helps someone looking to optimize their energy monitoring setup. Let me know if you have any questions or suggestions for improvement! ![]()