Deya: smart control for a home solar station

A self-hosted web service that monitors a Deye hybrid inverter and charges the home battery intelligently. It decides how much to charge overnight on the cheap tariff so the next day can run on solar wherever possible.

Deya works with a Deye hybrid inverter. Its main job is to decide how much to charge the battery overnight on the cheap tariff. The decision is based on tomorrow's solar forecast: on a sunny day there is no point buying from the grid, on a cloudy one the battery has to be ready.

What it does

  • Shows in real time where energy flows: solar, battery, grid, house.
  • Pulls solar generation forecasts from three sources at once (Open-Meteo, Forecast.Solar, Solcast) and compares them.
  • Calculates an overnight charging plan every evening.
  • Writes settings to the inverter by itself, with value checks, limits and read-back verification.
  • Builds a 24-hour battery charge forecast with an uncertainty band. A what-if slider lets you compare options.
  • Keeps history: charts, daily energy flows, house power sources, a per-day table.
  • Records power outages and shows how long the battery lasted.
  • Shows a weekly weather forecast and electricity cost on a two-zone tariff.
  • Light and dark themes, Ukrainian and English interface.

How the overnight charge is calculated

The model runs pessimistic, average and optimistic solar scenarios. For each one it checks whether there will be enough energy for the day, then picks the minimum charge at which the house will barely need to buy electricity during the day. The battery is not topped up from the grid when tomorrow will be sunny anyway.

Writing a value to an inverter is easy. Writing it safely is harder: every command is checked against limits, and the result is read back.

Tech stack

Python, FastAPI, Django, PostgreSQL, Docker, Cloudflare Tunnel, Solarman V5 protocol (Modbus). The service runs on the home network with no cloud intermediaries and is protected from outside access.

Open source

The project is on GitHub: github.com/maciborka/deya-public. If you want similar automation for your own station or business, get in touch.