Skip to content

Development of home load energy prediction #15

Closed

Description

@markoceri

As can be seen from the DDD analysis, the Home Energy Monitoring domain plays a key role and is considered a major subdomain.

Its main purpose is to predict household energy consumption of one or more appliances (e.g. Washing machine, Dishwasher, Boiler, EV Charger) and provide the forecast to the optimizer to allow the miner to operate (limiting its power) without exceeding the limits of the energy production plant.

An interesting projects that can offer an idea for implementation is this: EHMASS

Historical data can be retrieved from Home Assistant. Energy consumption of individual devices could be used (if this is monitored individually) or of the entire home (if there are no individual power sensors). Can be used Machine Learning algorithms to analyze historical data and predict future energy consumption.

I would like to use this place to discuss possible implementations 🙂​.

Activity

  1. transferred this issue fromedge-mining/coreon May 6, 2026
  2. markoceri commented on Jun 28, 2026

    @markoceri
    CollaboratorAuthor

    Home load energy prediction — implemented ✅

    The Home Consumption Analytics subdomain described here is now implemented in the codebase (edge_mining/domain/home_load/ + edge_mining/adapters/domain/home_load/). It models household consumption, learns from historical data and forecasts future load so the optimizer can drive the miner without exceeding the production plant limits.

    What's in place

    Domain model

    • HomeLoadsProfile aggregate grouping one or more LoadDevice entities, each classified by consumption pattern via LoadDeviceCategory: controllable (washing machine, dishwasher), continuous (fridge, boiler), seasonal (heating/AC), occasional.
    • Time-series and forecast value objects (HomeLoadPowerPoint, HomeLoadEnergyInterval, LoadEnergyConsumption) and the LoadConsumptionModel entity holding a trained ML model + its metrics.
    • Clean ports/adapters separation (EnergyLoadHistoryProviderPort, EnergyLoadForecastProviderPort, repositories for profiles, providers, per-device history and trained models).

    History ingestion (from Home Assistant)

    • home_assistant_api_history provider pulls historical consumption from Home Assistant — per individual device when a dedicated power sensor exists, or whole-home otherwise — with resumable fetching and aggregation into hourly intervals. A dummy provider is available for development.

    Forecast providers (selectable per device via EnergyLoadForecastProviderAdapter)

    • Baseline/statistical (no extra deps): naive_last_hour, naive_persistence, seasonal_baseline, typical_profile.
    • ML-based: statsmodels (Holt-Winters), xgboost, skforecast (auto-regressive multi-step over any scikit-learn regressor).
    • Each provider declares its minimum required history and degrades gracefully / falls back to fit-on-the-fly when no trained model is available.

    Machine learning pipeline

    • LoadForecastModelTrainingService runs nightly via the scheduler: for every enabled device with enough history it trains the candidate ML models, evaluates them on a 24h holdout, runs Optuna hyperparameter tuning and rolling-window backtesting, then promotes the best model (lowest MAE) to active. Inactive models are kept for audit/comparison.

    Persistence & API

    • SQLAlchemy repositories with Alembic migrations for profiles, providers, per-device history time series and trained models.
    • Full REST API under /api/v1: CRUD for profiles and devices, forecast/history provider management with type & config-schema discovery, history-collection triggers, training triggers and trained-model inspection.

    Integration with the optimizer

    • The forecast is exposed to the policy/rule engine so the miner power can be limited based on predicted household demand.

    Documentation

    A detailed reference for all forecast providers (algorithms, parameters, model lifecycle, provider-selection guide) lives at docs/home_load/home_load_forecast_providers.md.

    Closing this issue as the requested functionality is implemented. Further refinements/new providers can be tracked in dedicated follow-up issues.

    Image Image Image Image
  3. self-assigned this
    on Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions