Predbat (Home Battery Prediction) is a tool designed to optimize the charging and discharging of home batteries. By leveraging real-time data such as electricity prices, solar production, and household energy consumption, Predbat automates battery management to reduce costs and maximize efficiency.
This repository documents my setup and configuration for integrating Predbat with Home Assistant.
I am not an expert in programming, energy management, or automation. This setup is based on personal experience and experimentation. Use the code at your own risk—I do not take responsibility for issues or damages caused by implementing this setup. Test thoroughly in your environment before applying changes.
- Battery Optimization: Automates charging during low-price periods and prioritizes discharging during high-price periods.
- Cost Reduction: Reduces energy costs by strategically utilizing stored solar energy and optimizing grid usage.
- Flexible Integration: Supports multiple inverters, including Huawei.
- Home Assistant serves as the platform managing all automations and integrations.
- Fetches real-time electricity prices, enabling Predbat to optimize battery usage.
- A Huawei inverter paired with a 10kW battery provides the foundation for storing solar energy and managing energy flow in the home.
- Predicts solar energy production, helping Predbat optimize battery charging in anticipation of upcoming solar availability.
- I now use a custom Home Assistant blueprint that implements hysteresis control for more stable battery charging/discharging behavior. This prevents rapid on/off switching and includes cooldown periods for improved system stability.
- Blueprint: Predbat Charging & Discharging Control (Huawei Solar) — hysteresis + cooldown
Follow the installation instructions provided in the official Predbat GitHub Repository.
- Set up electricity prices using the Nordpool or Tibber integrations.
- Add solar production forecasts via Solcast or similar tools.
- Configure battery sensors and energy usage data in Home Assistant.
Create automations in Home Assistant to trigger battery charging or discharging based on Predbat's predictions. I use a custom blueprint that adds hysteresis control to prevent oscillation and improve charging stability.
- Working Features:
- Automating battery charging during off-peak hours.
- Optimizing discharging during peak-price periods.
- Leveraging solar production forecasts to prioritize renewable energy usage.
- Stable charging control with hysteresis to prevent rapid on/off switching.
- Ongoing Improvements:
- Refining automations for greater stability and precision.
- Enhancing integration with Nordpool and Solcast for better predictions.
- Dynamic Adjustments: Automate additional devices based on Predbat's predictions.
- Advanced Dashboards: Add real-time monitoring of battery performance in Home Assistant.
- Documentation: Share detailed setup guides for easier replication by others.
- Predbat Repository: GitHub
- Nordpool Integration: GitHub
- Solcast Integration: GitHub
- Home Assistant: Official Site
Thanks to:
- springfall2008 for creating Predbat.
- The Home Assistant Community for their invaluable resources.