AGILEPI / SOFTWARE & AUTOMATION

Making all the
pieces work together.

A collection of Python applications, databases, APIs and services that collect energy information, monitor performance and automate battery operation.

PYTHONSQLITEFLASKMQTTLINUX
01 / THE SOFTWARE STACK

Different jobs.
One connected system.

I've gradually built up a number of small applications, each responsible for a particular part of the energy monitoring and control process.

↔

Data collection

Collecting information from EcoFlow equipment, electricity pricing services and weather forecasts.

INPUT
↓
▤

Data storage

SQLite databases store energy readings, price information and forecast data for later use.

STORAGE
↓
⌘

Processing and decisions

Python applications analyse the available information and plan battery operating modes.

LOGIC
↓
▥

Monitoring and presentation

Flask web applications, historical graphs and the Inky display make the information accessible.

OUTPUT
02 / THE MAIN COMPONENTS

The applications behind AgilePi.

Rather than one enormous program, the system is divided into individual applications that perform specific tasks.

</>01
ECOFLOW / MQTT

EcoFlow data collection

Python applications communicate with the EcoFlow equipment using MQTT and the available interfaces to collect battery, solar and power-flow information.

ecoflow_data.py
◉02
DATABASE / HISTORY

Historical data

Readings are recorded in SQLite so that battery performance, solar generation, power consumption and other measurements can be examined over time.

ecoflow_logdata.py
▤03
FLASK / WEB

Web monitoring

Lightweight Flask applications provide access to current system information and historical readings, including graphs covering different time periods.

ecoflow_web.py · ecoflow_history.py
⚡04
OCTOPUS / PRICING

Electricity prices

Price collection applications retrieve Octopus Agile electricity prices and gas tariff information for storage and analysis.

store_prices.py · store_pricesgas.py
☀05
WEATHER / FORECASTING

Weather forecasting

Weather forecast information is used to estimate future solar generation and help the controller plan how much energy may be needed from the grid.

store_forecast.py
03 / HOW THE CONTROLLER THINKS

It's about timing, not just charging.

One of the most interesting parts of AgilePi is the automated energy controller. Electricity prices change throughout the day, and the amount of solar energy available tomorrow is not always predictable.

The controller considers the available information and plans when to charge the battery, when to hold its stored energy and when it may be appropriate to allow discharge.

I have also built in safeguards and operating limits. I want the system to make sensible decisions, but I also want to understand what it is doing and why.

CONTROLLER INPUTS
01Live battery telemetrySOC / POWER
02Electricity pricesAGILE / PUBLISHED
03Solar forecastWEATHER DATA
04Operating constraintsSAFETY / LIMITS
PLANNED OPERATING STRATEGYCharge · Hold · Discharge
Illustration of the decision process, not live controller output.
04 / SERVICES & SCHEDULING

Small applications, running continuously.

Linux services keep the important applications running, while scheduled jobs take care of periodic tasks.

EcoFlow monitoringCollects and processes equipment data
SYSTEMD
EcoFlow history loggerRecords measurements in the database
SYSTEMD
Historical web applicationProvides access to stored energy readings
SYSTEMD
Inky displayUpdates the compact energy information display
SCHEDULED
Automated backupsProtects the system and historical data
SYSTEMD TIMER
05 / BUILT TO BE UNDERSTOOD

Not a black box.

I prefer to know what my software is doing. Logs, historical records and clear monitoring are important parts of AgilePi. When something goes wrong, I want to be able to investigate it rather than simply hope that it fixes itself.

That also means keeping the project organised, documenting changes and making backups before major updates. It's an ongoing learning process, and the software will continue to evolve as the project grows.

Explore the documentation →