https://github.com/ai-lampy/homebridge-octopus-energy-live
Live Octopus Energy smart meter power and energy in Apple Home through Homebridge Matter.
https://github.com/ai-lampy/homebridge-octopus-energy-live
apple applehome applehomekit homebridge homebridge-plugin matter octopus-energy octopus-energy-api smart-home smart-meter
Last synced: 3 months ago
JSON representation
Live Octopus Energy smart meter power and energy in Apple Home through Homebridge Matter.
- Host: GitHub
- URL: https://github.com/ai-lampy/homebridge-octopus-energy-live
- Owner: Ai-Lampy
- License: mit
- Created: 2026-07-31T17:30:47.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-08-08T23:46:58.000Z (4 months ago)
- Last Synced: 2026-08-09T07:39:58.550Z (4 months ago)
- Topics: apple, applehome, applehomekit, homebridge, homebridge-plugin, matter, octopus-energy, octopus-energy-api, smart-home, smart-meter
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/homebridge-octopus-energy-live
- Size: 317 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# Octopus Energy Live for Homebridge
[](https://www.npmjs.com/package/homebridge-octopus-energy-live) [](https://www.npmjs.com/package/homebridge-octopus-energy-live) [](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
Homebridge platform plugin that publishes live Octopus Energy electricity readings as a Matter energy-monitoring outlet. Optional gas readings remain available through classic HomeKit-compatible meter characteristics. Experimental Home Mini gas telemetry and a gas-to-Matter outlet can be enabled with the limitations described below.
## Data sources
- With an Octopus Home Mini and `accountNumber`, the plugin discovers the electricity meter's device ID and calls Octopus's authenticated GraphQL `smartMeterTelemetry` query. Current demand normally updates every 10 seconds at source; this plugin polls every 30 seconds by default to stay within Octopus's API limits.
- Without a Home Mini device ID, or whenever live telemetry is temporarily unavailable, the plugin falls back to Octopus's REST consumption endpoint. That endpoint contains half-hour intervals and is not truly live.
- A Home Mini (or another compatible CAD connected to the meter's Home Area Network) is therefore required for true near-real-time data.
- Gas uses Octopus's REST consumption endpoint by default. The plugin checks every 5 minutes for a newly published half-hour interval; this is not instantaneous gas flow, and Octopus may publish it after a delay.
- **Experimental Home Mini Gas Telemetry** uses the GSME `smartMeterTelemetry` feed to calculate today's usage from its cumulative register. It is opt-in for beta testing, auto-discovers the GSME device ID where possible, and falls back to REST on any failure.
- Octopus returns SMETS1 gas consumption in kWh and SMETS2 gas consumption in m³. The plugin detects the source unit and converts cubic metres to kWh using the UK correction-factor and calorific-value formula.
## Requirements
- Node.js 22, 24, or 26
- Homebridge 2.2.1 or newer for Apple Home energy data
- Matter enabled for the main bridge or this plugin's child bridge
- iOS 27 and a Matter-capable Apple home hub
- Octopus API key, electricity MPAN, and electricity meter serial
- Optional gas MPRN and gas meter serial
- Octopus Home Mini plus the electricity meter's EUI64 device ID for live readings
Homebridge 1.x remains compatible with the classic Outlet and Eve characteristics, but cannot publish the Matter electrical measurement clusters used by Apple Home.
## Installation
Install `homebridge-octopus-energy-live` from Homebridge UI, enable Matter in Homebridge settings (a child bridge is recommended), and restart Homebridge. Pair the Matter bridge with Apple Home using the Matter QR code shown by Homebridge.
To publish the classic HomeKit gas meter service as well, open the plugin's child bridge settings in Homebridge UI, enable **HAP**, save, and restart the child bridge. HAP is controlled by Homebridge rather than by the plugin. Pairing the HAP child bridge is optional and separate from Matter. The custom **Gas Consumption Today** characteristic is visible in Homebridge and compatible third-party HomeKit apps; Apple Home normally ignores custom characteristics.
### Recommended child bridge Matter setting
If Matter discovery or subscriptions are unreliable, enable **Disable IPv4 (Matter)** in this plugin's Homebridge child bridge settings and restart Homebridge. Matter uses IPv6, and this option prevents Matter's optional IPv4 mDNS listener from competing with services such as Avahi on some installations.
Leave the option disabled if Matter devices cannot be discovered on your network after enabling it. The plugin does not change this Homebridge setting automatically because network requirements vary between installations.
## Configuration
```json
{
"platform": "OctopusEnergyLive",
"name": "Octopus Energy Live",
"apiKey": "sk_live_your_key",
"accountNumber": "A-12345678",
"pollSeconds": 30,
"import": {
"name": "Electricity Meter",
"mpan": "YOUR_IMPORT_MPAN",
"meterSerial": "IMPORT_SERIAL"
},
"gas": {
"name": "Gas Meter",
"mprn": "YOUR_GAS_MPRN",
"meterSerial": "GAS_SERIAL",
"unit": "auto",
"exposeToMatter": false,
"exposeDailyUsageToMatter": false,
"useLiveTelemetry": false,
"pollMinutes": 5
},
"export": {
"name": "Octopus Export",
"mpan": "YOUR_EXPORT_MPAN",
"meterSerial": "EXPORT_SERIAL"
}
}
```
Electricity import is required; gas and electricity export are optional. The settings screen calls the required section **Electricity Meter**, while its JSON key remains `import` so existing installations and cached Apple Home accessories keep working. The plugin normally discovers the Home Mini meter device ID from `accountNumber`, MPAN, and meter serial. If discovery does not work, `homeMiniDeviceId` can be set manually to the EUI64 of the physical electricity meter connected to the Home Mini. It is not the MPAN, printed meter serial, or Home Mini serial, and is usually formatted as eight hexadecimal byte pairs separated by hyphens.
Gas uses an **MPRN** (Meter Point Reference Number), not an MPAN. Leave `unit` set to `auto` when an account number is configured. If Octopus cannot return the meter's `consumptionUnits`, choose `m3` for a SMETS2 meter or `kWh` for a SMETS1 meter. Enabling `useLiveTelemetry` attempts to discover the GSME EUI64 automatically. The optional nested `homeMiniDeviceId` setting is only an override for that gas device ID.
When experimental gas telemetry is enabled, electricity live polling is limited to 60 seconds and gas remains on its configured 5–30 minute check interval. This keeps the combined calls below Octopus's documented 125-request-per-user hourly limit.
Treat the API key as a password. The plugin exchanges it for a short-lived Kraken token in memory and never logs either credential.
## Apple Home and Matter
When Matter is enabled, each configured electricity meter is registered as a Matter `OnOffOutlet` with:
- `ElectricalPowerMeasurement.activePower` in milliwatts
- `ElectricalEnergyMeasurement.cumulativeEnergyImported` for import
- `ElectricalEnergyMeasurement.cumulativeEnergyExported` for export
At registration, the plugin logs the intended Matter device types and cluster IDs. Homebridge debug logging additionally records that Homebridge assigns the endpoint number and supplies `PowerTopology` (`0x009C`) using `TreeTopology`. These diagnostics confirm that measurement data belongs to a bridged outlet endpoint rather than Matter Endpoint 0.
Matter and Homebridge do not currently expose a native gas-meter device type. Gas is therefore not published to Matter by default. If **Experimental Matter Outlet** is enabled, the plugin represents gas as an always-on electrical outlet with `ElectricalEnergyMeasurement.cumulativeEnergyImported`. With Home Mini gas telemetry enabled, the endpoint retains `ElectricalPowerMeasurement` for Apple Home's monitored-outlet classification but marks active power unavailable because GSME readings are delayed energy intervals rather than instantaneous demand. Apple Home still presents it as a power socket rather than a native gas meter.
The opt-in **Show Today's Usage in Matter (Beta)** setting additionally publishes `periodicEnergyImported`, with UK-local day-start and observation timestamps, for the current day's gas total. Home Mini gas telemetry refreshes this value every 30 minutes. This is the correct Matter representation for period energy, but Apple Home decides whether to display it. Enabling it changes the gas endpoint profile and replaces the previous experimental gas endpoint; electricity endpoints are unaffected.
One Matter setup code commissions the whole Homebridge child bridge. Electricity, optional export, and an enabled experimental gas outlet are endpoints inside that bridge; individual endpoints do not receive separate setup codes.
The plugin also keeps read-only HomeKit Outlet services with Eve characteristics. Third-party HomeKit apps can use these values even when Matter is disabled.
## Limitations
- This is cloud polling, not a direct local connection to the Home Mini.
- Octopus live telemetry can be unavailable or rate-limited. The last value remains visible while the plugin retries and uses interval data where possible.
- Some smart meter models do not provide live export. In that case export power can remain at zero even though delayed export energy is available.
- Default gas readings are half-hourly and can arrive late; checking every five minutes only discovers new intervals sooner. Experimental Home Mini gas telemetry depends on Octopus exposing a GSME telemetry device for the account and is not available to every meter.
- Matter has no native gas meter type in Homebridge's public plugin API. The experimental gas endpoint is therefore presented as an electrical outlet, not a true gas meter.
- SMETS2 gas is converted from m³ using a representative calorific value of 39.2 MJ/m³. The official app or bill can differ slightly because the billing calorific value varies by region and day.
- Apple Home can show current watts supplied by a Matter outlet, but its Energy Summary does not automatically list every accessory that exposes Matter electrical-measurement clusters. Apple's documented unified Energy experience uses entitled EnergyKit apps, which a Homebridge plugin cannot provide.
- Homebridge's Matter bridge is community software and is not a certified Matter product, so Apple Home may show an uncertified-accessory warning.
## Development and GitHub builds
```bash
npm ci
npm run lint
npm test
npm pack --dry-run
```
`npm test` compiles TypeScript into `dist/` before running the unit tests. The GitHub Actions workflow runs this sequence on Node.js 22, 24, and 26 for every pull request and every push to `main`. Publishing to npm is intentionally not automated; a repository maintainer should review and publish a release explicitly.
Running the manual **Publish to npm** workflow publishes the package version and then creates a matching `vX.Y.Z` GitHub Release. The release body is taken from that version's section in `CHANGELOG.md`, followed by a direct link to the published npm package. Re-running the workflow is safe when npm publication succeeded but release creation did not; it also repairs the notes on an existing matching GitHub Release.
## Links
- [Octopus Energy API documentation](https://developer.octopus.energy/)
- [Apple EnergyKit documentation](https://developer.apple.com/documentation/EnergyKit)
- [Homebridge Matter documentation](https://github.com/homebridge-plugins/homebridge-matter/wiki)
- [GitHub repository](https://github.com/Ai-Lampy/homebridge-octopus-energy-live)
## Project status and attribution
Octopus Energy Live is an independent community project maintained by `lxmitch`. It is not affiliated with or endorsed by Octopus Energy, Apple, or the Homebridge project.
This project began from the MIT-licensed `icebondx/homebridge-octopus-energy` codebase and retains attribution to its original contributor. The live telemetry, Matter electrical sensor integration, tests, current configuration interface, and release infrastructure are maintained in this independent project.
## License
MIT