Skip to content

About

home battery control for home assistant with 5 min check pricing cadence

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

247 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

House Battery Control

HACS HA License: MIT

A deterministic Home Assistant custom integration for optimising Tesla Powerwall battery usage. Uses a Linear Programming solver to minimise daily electricity costs based on real-time Amber Electric or Flow Power spot pricing, Solcast or forecast.solar solar forecasts, and historical load patterns.

Added Features

FlowPower Pricing, Manual Control, Plan Graphs, Import Price Limit, Export Priority Threshold.

What It Does

Every 5 minutes, HBC collects your current energy tariffs, solar production forecast, and household load history. It feeds this data into an LP solver that calculates the mathematically optimal battery charge/discharge schedule for the next 24 hours, then sends the appropriate command to your Powerwall.

24-Hour Plan — the solver's optimal schedule with pricing, state, SoC, and cost projections

Manual Override Panel Chart Panels Chart Panels

Prerequisites

Requirement Purpose Integration
Home Assistant 2024.1+ Platform —
HACS Installation hacs.xyz
Amber Electric 5-minute spot pricing (Supports Standard & Amber Express) Amber Electric
FlowPower HA 5-minute spot pricing FlowPower HACS
Solcast Solar production forecast Solcast HACS
Tesla Powerwall Battery control Teslemetry or similar
Weather Temperature forecast (optional) Any HA weather entity

Installation

HACS (Recommended)

  1. Open HACS in Home Assistant
  2. Click the ⋮ menu → Custom repositories
  3. Add: https://github.com/dw0011/home-battery-control (Category: Integration)
  4. Search for House Battery Control and click Download
  5. Restart Home Assistant
  6. Go to Settings → Devices & Services → Add Integration → House Battery Control

Manual

cp -r custom_components/house_battery_control /config/custom_components/
ha core restart

Configuration

The integration uses a 3-step config flow. For full details on every field, see docs/configuration.md.

Step What You Configure
1. Telemetry Battery SoC, Battery Power, Solar Power, Grid Power sensors (with inversion options)
2. Energy & Metrics Cumulative energy sensors, temperature thresholds, battery specs, tariff & weather entities
3. Control Charge/discharge scripts, panel visibility toggle

You can also configure via YAML import on Step 1.

Verifying It Works

After configuration:

  1. Sidebar — Look for the HBC entry (battery icon) in the sidebar
  2. Panel — Click it to see the power flow diagram and system status
  3. Sensors — Check Settings → Devices → House Battery Control for sensor.hbc_state and sensor.hbc_projected_cost
  4. API — Visit /hbc/api/status (requires admin auth) for full diagnostic JSON

Documentation

Document Description
Configuration Reference Every config option explained
How It Works Data pipeline, solver objectives, I/O detail
Troubleshooting Common issues and fixes
Architecture Module map and contributor guide

Development

pip install -r requirements_test.txt
python -m pytest tests/ -v      # 213 tests
ruff check custom_components/ tests/

License

MIT

About

home battery control for home assistant with 5 min check pricing cadence

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages