Skip to content

v1.2.0 — Power sensor unit conversion (kW, MW)

Choose a tag to compare

@martinarva martinarva released this 02 May 12:34

Power sensor kW/MW support (#229)

Affected users: Anyone whose source power sensor reports in kW or MW rather than the default W. Examples: many EV chargers (Easee, Wallbox, Zaptec), some heat-pump integrations, large industrial meters. With prior versions the realtime cost was scaled 1000x (kW) or 1000000x (MW) too low.

What changed

RealTimeCostSensor previously hard-coded a power_usage / 1000 factor, implicitly assuming the source sensor reports in W. v1.2.0 now reads the source sensor's unit_of_measurement attribute and applies the correct conversion to kW.

Power sensor unit Conversion factor
W × 0.001 (legacy default)
kW × 1.0
MW × 1000
missing/unrecognised × 0.001 (backward compatible)

This mirrors the same pattern already used for energy sensors (Wh / kWh / MWh) and price sensors (/Wh / /kWh / /MWh). All combinations (e.g. kW power × EUR/MWh price) work correctly.

Compatibility

  • ✅ Existing setups with W power sensors — behaviour unchanged
  • ✅ Power sensors without unit_of_measurement — defaults to W (legacy default)
  • ✅ Mixed unit setups (e.g. kW power + EUR/MWh price) — both conversions apply

Upgrading

Update via HACS and restart Home Assistant. No configuration changes needed. If your power sensor was already in kW you'll see realtime cost suddenly jump 1000x — that's the correct value, finally.

Full changelog: v1.1.5...v1.2.0