energy-device-gateway
v0.1.0
Published
Energy device gateway for meter, inverter, and gateway integration testing.
Maintainers
Readme
Energy Device Gateway
energy-device-gateway is a Node.js + TypeScript gateway from EnergyMeterHub, built as the Docker and server-hosted counterpart to energy-device-edge.
It reads supported LAN energy devices, normalizes their output into one payload shape, serves an authenticated web console and API, and can forward data to IAMMETER Cloud or a compatible local endpoint.
The current release includes IAMMETER, Fronius SunSpec, and Shelly Pro 3EM support, and the project is intended to grow into a broader gateway for many energy-device integrations over time.
This repository is one of EnergyMeterHub's in-house open-source projects.
Supported Devices
| Device | Type String | Protocol | Default Port |
| --- | --- | --- | --- |
| IAMMETER WEM3080T | IAMMETER_WEM3080T | Modbus TCP | 502 |
| Fronius SunSpec Inverter | FRONIUS_SUNSPEC | SunSpec Modbus TCP | 502 |
| Shelly Pro 3EM | SHELLY_3EM | Shelly RPC HTTP | 80 |
Legacy aliases are normalized automatically:
IAMMETER->IAMMETER_WEM3080TFRONIUS->FRONIUS_SUNSPECFRONIUS_GEN24->FRONIUS_SUNSPECSHELLY->SHELLY_3EMSHELLY_PRO_3EM->SHELLY_3EM
API
The gateway keeps the main edge-compatible endpoints:
GET /api/configPOST /api/configPOST /api/sourcePOST /api/networkGET /api/meter/dataGET /api/wifi/scanPOST /api/restartPOST /api/factory-resetPOST /api/ota
GET /api/meter/data returns the IAMMETER-style upload payload shape used by the existing edge UI.
Gateway-specific endpoints:
POST /api/auth/bootstrapPOST /api/auth/loginPOST /api/auth/logoutGET /api/auth/sessionGET /api/runtime/statusGET /api/runtime/historyGET /api/runtime/eventsGET /api/meter/normalized
Web Console
The web console has two views:
Livefor runtime status, power trend, phase detail, recent events, and payload inspectionSettingsfor source setup, upload target changes, password management, and service controls
The screenshots below use demo runtime data, and the upload SN is masked.
Live

Settings

Development
Requirements:
- Node.js
22.6.0or newer
Run directly from npm without cloning:
npx energy-device-gatewayInstall and run:
npm install
npm run typecheck
npm test
npm run devDefault server:
http://127.0.0.1:8080
Runtime Configuration
Environment variables:
PORT- HTTP port, default8080HOST- bind host, default0.0.0.0ENERGY_DEVICE_GATEWAY_CONFIG_PATH- config file path, default./data/config.jsonENERGY_DEVICE_GATEWAY_PASSWORD_HASH- preferred environment-managed password hash for the built-inadminaccountENERGY_DEVICE_GATEWAY_PASSWORD- optional plaintext password override for local/dev compatibility; prefer the hash variable for published deploymentsENERGY_DEVICE_GATEWAY_POLL_INTERVAL_MS- live polling interval, default5000ENERGY_DEVICE_GATEWAY_UPLOAD_INTERVAL_MS- upload interval, default60000ENERGY_DEVICE_GATEWAY_SELF_RESTART- iftrue, restart and factory-reset endpoints exit the process after responding
Authentication
This project includes login protection for all gateway operations.
- the built-in username is always
admin - there is no built-in default password
- when no password is configured, the login screen switches to a one-time bootstrap flow and asks you to set the administrator password
- local passwords are stored as one-way
scrypthashes in the config file - when
ENERGY_DEVICE_GATEWAY_PASSWORD_HASHorENERGY_DEVICE_GATEWAY_PASSWORDis set, that password is environment-managed and the UI cannot change it - when running without an environment override, the password can be rotated from the web UI after login
Generate a password hash for ENERGY_DEVICE_GATEWAY_PASSWORD_HASH:
npm run auth:hash -- "correct horse battery staple"Bootstrap example:
cp data/config.example.json data/config.json
npm run devEnvironment-managed example:
ENERGY_DEVICE_GATEWAY_PASSWORD_HASH="$(npm run --silent auth:hash -- 'change-me-now')" npm run devDocker
Build and run:
docker build -t energy-device-gateway .
docker run --rm -p 8080:8080 -e ENERGY_DEVICE_GATEWAY_PASSWORD_HASH="$(npm run --silent auth:hash -- 'change-me-now')" energy-device-gatewayPull the published image from Docker Hub:
docker pull energymeterhub/energy-device-gateway:latestMount a persistent config directory if needed:
docker run --rm -p 8080:8080 -v "$PWD/data:/app/data" energy-device-gatewayContainer images are published to Docker Hub at energymeterhub/energy-device-gateway.
Release Automation
GitHub Actions can publish npm and Docker Hub releases whenever you push a version tag such as v0.1.0.
Required repository secrets:
NPM_TOKENAn npm automation token or granular access token that can publish the package.DOCKERHUB_USERNAMEThe Docker Hub account or org name.DOCKERHUB_TOKENA Docker Hub access token with push access toenergymeterhub/energy-device-gateway.
Release flow:
npm version patch
git push origin main --follow-tagsThe release workflow verifies the tag matches package.json, runs typecheck/build/tests, publishes the npm package, pushes Docker tags, and updates the Docker Hub description from docs/dockerhub/README.md.
Notes
- Wi-Fi fields remain in the API for compatibility, but are metadata only in the Docker-oriented gateway runtime.
- OTA uploads are stored under
data/uploads/latest-upload.bininstead of flashing firmware directly. - Restart and factory reset endpoints can optionally terminate the process so Docker can handle restart policy.
data/config.example.jsonis safe to commit; runtime data underdata/stays ignored.- The gateway now carries its own logo asset and no longer depends on files from a sibling repository.
