Local Energy Management System
A lightweight local EMS runtime platform for distributed energy, microgrids, and energy storage cabinet scenarios
Online Demo · Quick Start · UI Preview · Contributing
LEMS is a local Energy Management System built for distributed energy, microgrids, energy storage cabinets, and edge energy gateway scenarios. It brings heterogeneous devices such as PCS, BMS, meters, PV, loads, and GPIO into one runtime through pluggable drivers, protocols, strategies, and data services, covering device integration, real-time monitoring, alarm handling, strategy control, automation linkage, tariff management, and external data integration.
It is not just a dashboard for charts. It is an EMS runtime platform that can actually be deployed on edge controllers, industrial gateways, industrial PCs, or on-site servers.
In a typical distributed energy project, the site usually contains:
- PCS, BMS, meters, PV, loads, and other devices from different vendors
- Different communication methods and industrial protocols
- Different control logic, runtime constraints, and strategy goals
- Telemetry, alarms, and operational data that must be pushed to upper-level platforms
LEMS addresses the core challenge of fragmented devices, protocols, data, and control. It consolidates these capabilities into one unified system:
- Southbound device integration: connect on-site devices through driver and protocol plugins
- Unified runtime model: bring points, states, alarms, and strategies into a common runtime
- Northbound capabilities: expose Web, MQTT, Modbus TCP, logs, and statistical interfaces
The following diagram shows the local EMS network topology for energy storage scenarios, suitable for storage cabinets, multi-cabinet deployments, and edge data acquisition gateways.
The following diagram shows how wind, solar, storage, load, touch panels, the cloud platform, and the mobile app are integrated in a microgrid scenario.
The cabinet detail page shows the internal topology, runtime status, and trend charts of an energy storage cabinet.
The system provides a unified feature entry page. The real-time data page shows device status, sub-device structure, and key points for operations teams.
The alarm page is suitable for checking active faults and historical issues, while the log page helps locate communication, push, and runtime details.
The statistics page is used for device comparison and trend analysis. The remote management page manages external services such as MQTT and Modbus.
These pages show that the system is not only for monitoring, but also for configuration, control, and management.
The system page shows CPU, memory, disk, network traffic, and uptime information, which is useful for post-deployment operations inspection.
- Pluggable driver system: easy to extend for different brands, models, and field device abstractions
- Pluggable protocol system: the repository currently includes
Modbus(TCP/RTU),CANBus,GPIO, and more - Real-time monitoring and alarms: supports device status, power, energy, SOC, timestamps, alarm records, and historical logs
- Strategies and automation: supports microgrid strategies, energy storage strategies, automation tasks, and local control parameter configuration
- Tariff and cost optimization: supports time-of-use tariff configuration for peak shaving, valley filling, and cost management
- External integration: supports MQTT uplink, Modbus TCP export, and remote service management
- Edge-friendly deployment: suitable for industrial gateways, industrial PCs, and edge servers
- Built-in Web management UI: accessible after build, with interactions optimized for tablet touch scenarios
- Energy storage cabinet EMS: single-cabinet operation, intra-cabinet linkage, status monitoring, and power control
- Multi-cabinet EMS: one edge gateway managing multiple storage systems
- Microgrid EMS: unified access and coordinated dispatch for wind, solar, storage, and load
- Integration gateway: normalize on-site heterogeneous device data before forwarding it to third-party platforms
- Edge O&M platform: provide alarms, logs, automation tasks, tariff management, and system status visibility
Pylon Tech US108BMSPylon Checkwattenergy storage related driverElecod MACPCSStar Charge 100EPCSGPIO In/Outbase driversAmmeter / PV / ESS / Loaddemo drivers
plugins/plug_protocols/p_modbusplugins/plug_protocols/p_canbusplugins/plug_protocols/p_gpiodservices/s_export_mqttservices/s_export_modbusservices/s_automationservices/s_priceservices/s_policy
The "algorithm" capabilities in this repository are not just a few scheduled rules. They are formed by time-slot matching, strategy parameter models, a strategy execution framework, and prediction algorithm interfaces.
- Time slot and priority matching: the tariff service filters enabled configurations first, then picks the currently effective tariff by date range, time range, and priority; cross-day ranges are handled correctly
- Local strategy parameter models: exposes typical EMS decision parameters such as SOC limits, charge/discharge efficiency, transformer capacity, safety factors, demand control, and dynamic expansion
- Energy storage strategy execution framework: supports date ranges, time ranges, and hourly target setpoints, and can dispatch controls based on device lists, device types, and current status
- Automation linkage mechanism: supports time-based and condition-based task triggering to connect strategy decisions with field actions
- Forecasting extension interfaces:
@cpp/hexlibprovides aC++ / CGObasedMPC + Kalmanpredictor interface suitable for forecasting power, load, generation, and other time series
A more precise description is that LEMS already provides algorithmic foundations, a strategy framework, and extensible forecasting capabilities, with room reserved for more advanced closed-loop microgrid optimization and energy storage dispatch.
- Demo URL: https://lems.hexems.com/
- Admin password:
888888
For the best experience, use landscape tablet mode. The current UI layout, touch interactions, and core O&M flows have been optimized for tablet scenarios.
After cloning the public repository, you can build directly in application/.
- Go
1.25+ - Linux or macOS is recommended for development
- If CGO-related capabilities are enabled, install
GCCorClang
git clone git@github.com:OpenLoaf/OpenLEMS.git
cd OpenLEMSgo work synccd application
go build -o ./bin/lems .If you want to validate the entire Go workspace in one shot, run this in the repository root:
./script/build-workspace.shcd application
go run . --web=true --driver-path=resources/driverAfter startup, the default address is:
http://localhost:8000
cd application
go run . --web=true --demo=true --driver-path=resources/driver| Flag | Short | Description |
|---|---|---|
--web |
-w |
Enable the Web service |
--demo |
- | Mark the runtime as demo mode |
--driver-path |
-dp |
Driver file directory |
--device-name |
-d |
Device configuration name |
--runtime-path |
-rp |
Runtime database path |
--db-path |
-cp |
Configuration database path |
--language |
-l |
Global language |
--profile |
- | Configuration profile, such as dev or prod |
--force |
- | Force startup by ignoring PID checks |
OpenLEMS/
├── application/ # Main program entry, APIs, controllers, and Web service
├── common/ # Shared interfaces, base device/protocol types, and utilities
├── plugins/
│ ├── plug_drivers/ # Device driver plugins
│ ├── plug_protocols/ # Communication protocol plugins
│ ├── plug_policy/ # Strategy plugins
│ ├── plug_push/ # Push plugins
│ └── plug_storages/ # Storage plugins
├── services/ # Service orchestration layer, such as drivers, automation, tariffs, and remote export
├── docs/ # Project docs and screenshot assets
└── script/ # Workspace build and validation scripts
./script/build-workspace.shDrivers are organized in a plugin-based pattern. It is recommended to start from the existing implementations in:
plugins/plug_drivers/bms/plugins/plug_drivers/pcs/plugins/plug_drivers/ess/plugins/plug_drivers/gpio/plugins/plug_drivers/demo/
If you want to extend protocols or external data integration capabilities, start with:
plugins/plug_protocols/p_modbusplugins/plug_protocols/p_canbusservices/s_export_mqttservices/s_export_modbusservices/s_automationservices/s_price
- Software positioning and capability overview
- Remote API docs
- Automation service guide
- MQTT data push guide
- Modbus TCP export guide
Issues and pull requests are welcome.
Before submitting, it is recommended to read:
Local validation commands:
./script/build-workspace.sh
./script/test-workspace.sh- Email:
zz@hexems.com
For project cooperation, solution consulting, private deployment, or technical exchange, contact us by email or scan the WeChat QR code below:
This project is licensed under AGPL-3.0-only.


















