A HACS custom integration that brings your Slovenian electricity metering data from Moj Elektro into Home Assistant, including the Energy Dashboard.
The Moj Elektro API publishes consumption once per day with a ~24 hour delay, so this integration imports long-term statistics using each reading's real timestamp — your usage lands on the correct day in the Energy Dashboard rather than on the day it happened to be fetched.
- Config flow (UI): enter your API token, then pick a metering point.
- Daily consumption sensor + accurate Energy Dashboard statistic
(
moj_elektro:<meter>_energy_consumption), timestamped on the real day of use. - Solar export, peak/off-peak split, 5 network time-blocks, and 15-minute detail — each as sensors and/or long-term statistics (see below).
- Helper sensors: current tariff block (1–5), monthly peak power, agreed power per block.
- Bundled dashboard card — add "Moj Elektro" from the card picker, no YAML.
- Everything beyond the daily total is toggleable in the integration's Configure dialog.
All enabled by default; turn off what you don't need (e.g. export if you have no solar):
| Group | Sensors | Statistics |
|---|---|---|
| Solar export (A−) | daily export total/peak/off-peak | …_daily_export* → Return to grid |
| Peak/off-peak split | daily consumption peak / off-peak | …_daily_consumption_peak/_offpeak |
| 5 time-blocks | daily kWh per block (1–5) | …_blok_1…5 |
| 15-minute detail | — | …_import_15min, …_export_15min (hourly) |
| Helper sensors | current tariff block, monthly peak power, agreed power per block | — |
Energy Dashboard mapping: keep …_energy_consumption as your grid consumption
source and …_daily_export as return to grid. Peak/off-peak and per-block statistics
are for their own history/cards — don't add two overlapping totals as consumption. The
15-minute statistics are a finer-resolution alternative to the daily total, not an addition.
- Log in at mojelektro.si.
- Go to Moj Profil → Kreiraj žeton (Create token), choose unlimited expiration, and create it.
- Copy the token. You will also need your metering-location id (merilno mesto) shown in your account.
- In HACS → three-dot menu → Custom repositories, add
https://github.com/golaz777/HAMojElektrowith category Integration. - Install Moj Elektro, then restart Home Assistant.
- Settings → Devices & Services → Add Integration → Moj Elektro, enter the token and metering-location id, and pick the metering point.
Updates then arrive through HACS like any other integration.
Original brand assets live in custom_components/moj_elektro/brand/
(icon.png, icon@2x.png, logo.png, logo@2x.png). Home Assistant 2026.3+ serves
these natively from the brand/ folder via its local brands proxy — the icon/logo
appear on the device and integration pages automatically, no brands-repo submission needed.
The integration bundles several Moj Elektro cards and registers them with the frontend automatically. Add them from the UI:
Dashboard → Edit → + Add card → search "Moj Elektro"
You can use the single combined card, or mix and match the smaller per-section cards:
| Card type | Shows |
|---|---|
custom:moj-elektro-card |
Everything — daily-usage graph + all sections |
custom:moj-elektro-daily-card |
Daily usage (kWh) bar chart only |
custom:moj-elektro-consumption-card |
Consumption total / peak / off-peak |
custom:moj-elektro-export-card |
Solar export |
custom:moj-elektro-blocks-card |
Current block + daily kWh per block |
custom:moj-elektro-power-card |
Monthly peak + agreed power |
All auto-discover their sensors — no YAML. If a card doesn't show right after updating, hard-refresh the browser (Ctrl/Cmd-Shift-R) to clear the cached resource.
Optional config (all optional):
type: custom:moj-elektro-card
title: Moj Elektro
prefix: sensor.moj_elektro_ # change only if HA gave your entities a different prefix
sections: [consumption, export, blocks, power] # limit which groups to show
daily_graph: true # show/hide the daily-usage kWh chart
days_to_show: 30A plain built-in-cards version (no custom card) is also available as
dashboards/moj_elektro_card.yaml for manual pasting.
After setup, go to Settings → Dashboards → Energy → Add consumption and
select moj_elektro:<meter>_energy_consumption. Because data is delayed ~24h, the
most recent day fills in the following day.
- Data is ~24 h delayed — the most recent complete day is yesterday, so today's usage appears tomorrow. The integration polls every 12 h by default (configurable).
- Every long-term statistic (import/export/tariff, time-blocks, 15-min→hourly) is a
from-zero running sum of per-period consumption, continued from the recorder's last
stored point. Starting at zero keeps the first day's
changesmall instead of showing the whole meter reading as a false first-day spike. - Reactive energy (R±) and reactive power (Q±) are available in the API but not yet
surfaced — see
frlequ/homeassistant-mojelektrofor reference implementations.