How davidusb-geek/emhass works
EMHASS is a home-energy management service for Home Assistant. A user configures an optimization through the web interface or API; the server dispatches a run, which retrieves household data, prepares forecasts, optimizes device schedules, and returns results for use in Home Assistant. The graph also shows the optional coordinator backend and its site-metering model, plus calibration and learning capabilities. Edges follow README statements and SOURCE INDEX references; unsampled subsystems are included where the tree supports them, without inferring their internal call paths.
Main entry points: command_line.py Run orchestration · web_server.py Web server · forecast.py Forecast generation · master.py Coordinator solver
Components 23
Access and orchestration
- Web server
src/emhass/web_server.py - API access control
src/emhass/api_auth.py - Run orchestration
src/emhass/command_line.py - Web UI
src/emhass/static/script.js
Data and forecasts
- Home data retrieval
src/emhass/retrieve_hass.py - WebSocket client
src/emhass/websocket_client.py - Forecast generation
src/emhass/forecast.py - ML forecaster
src/emhass/machine_learning_forecaster.py - ML regressor
src/emhass/machine_learning_regressor.py
Optimization
- Schedule optimization
src/emhass/optimization.py - Coordinator backend
src/emhass/coordinator/backend.py - Coordinator solver
src/emhass/coordinator/master.py - Site model
src/emhass/coordinator/model.py - Site metering
src/emhass/coordinator/submeter.py - Cost calculations
src/emhass/coordinator/costs.py
Learning and state
- Forecast calibration
src/emhass/forecast_calibration.py - PV bias calibration
src/emhass/pv_bias_calibration.py - Battery identification
src/emhass/battery_identification.py - Thermal planning
src/emhass/thermal_dp.py - Plan storage
src/emhass/plan_store.py - Last-run state
src/emhass/last_run.py
Other components
- Home operator
- Home Assistant
Connections 28
- Home operator → Web server: configures and runs
- Home operator → Web UI: uses
- Web UI → Web server: sends requests
- Web server → API access control: checks access
src/emhass/web_server.py - Web server → Run orchestration: dispatches runs
src/emhass/web_server.py - Run orchestration → Home data retrieval: retrieves data
src/emhass/command_line.py - Home data retrieval → WebSocket client: uses connection
src/emhass/retrieve_hass.py - Home Assistant → Home data retrieval: provides states
- Run orchestration → Forecast generation: generates forecasts
src/emhass/command_line.py - Forecast generation → Home data retrieval: reads history
src/emhass/forecast.py - Forecast generation → ML forecaster: uses forecaster
src/emhass/forecast.py - Forecast generation → ML regressor: uses regressor
src/emhass/forecast.py - Run orchestration → Schedule optimization: runs optimization
src/emhass/command_line.py - Schedule optimization → Coordinator backend: invokes coordinator
src/emhass/coordinator/backend.py - Coordinator backend → Coordinator solver: builds and solves
src/emhass/coordinator/backend.py - Coordinator backend → Site model: builds site model
src/emhass/coordinator/backend.py - Coordinator solver → Site model: uses site model
src/emhass/coordinator/master.py - Coordinator solver → Cost calculations: prices plans
src/emhass/coordinator/master.py - Coordinator solver → Site metering: evaluates meter flows
src/emhass/coordinator/master.py - Run orchestration → Forecast calibration: uses calibration
src/emhass/command_line.py - Run orchestration → PV bias calibration: uses calibration
src/emhass/command_line.py - Run orchestration → Battery identification: identifies batteries
src/emhass/command_line.py - Run orchestration → Plan storage: persists plans
src/emhass/command_line.py - Web server → Plan storage: reads and writes plans
src/emhass/web_server.py - Web server → Last-run state: reads run state
src/emhass/web_server.py - Plan storage → Last-run state: uses state helpers
src/emhass/plan_store.py - Run orchestration → Home Assistant: returns schedules
- Schedule optimization → Thermal planning: supports thermal planning