Problem
Home Assistant 2026.3 rejects 6 MQTT discovery entities from smahub's HA-MQTT sink because of invalid device_class + unit_of_measurement combinations:
| Entity |
device_class |
unit |
HA Error |
| Reactive power consumption |
reactive_power |
VAR |
VAR is not valid with reactive_power |
| Reactive power supply |
reactive_power |
VAR |
same |
| Reactive power consumption counter |
energy |
kVAh |
kVAh is not valid with energy |
| Reactive power supply counter |
energy |
kVAh |
same |
| Apparent power consumption counter |
energy |
kVAh |
same |
| Apparent power supply counter |
energy |
kVAh |
same |
The entities are never created in HA. All other SHM2 entities (active power, frequency, apparent power, phase angle) work correctly.
HA Error Log
ERROR [homeassistant.components.mqtt.entity] Error 'The unit of measurement `VAR` is not valid together with device class `reactive_power`' when processing MQTT discovery message topic: 'homeassistant/sensor/SMA-Sunny-Home-Manager-2/Reactive-power-consumption/config'
Root Cause
HA's sensor platform validates device_class against allowed unit_of_measurement values. As of HA 2026.3:
reactive_power device class only accepts var (lowercase), not VAR
energy device class does not accept kVAh (volt-ampere-hours are apparent energy, not active energy)
Suggested Fix
For reactive power sensors: Change unit_of_measurement from VAR to var (lowercase). HA expects SI-style lowercase for this unit.
For reactive/apparent energy counters: Either:
- Remove
device_class: energy (these are not active energy) and use a generic sensor, or
- Use
device_class: None with state_class: total_increasing to keep long-term statistics without device class validation
Environment
- smahub: v1.6.2 (container
ghcr.io/anotherdaniel/smahub:v1.6.2)
- Home Assistant: 2026.3.4
- SMA device: Sunny Home Manager 2 (EM/SHM/SHM2, firmware 2.17.4.R)
- MQTT sink:
HA_MQTT_ENABLED=true
Problem
Home Assistant 2026.3 rejects 6 MQTT discovery entities from smahub's HA-MQTT sink because of invalid
device_class+unit_of_measurementcombinations:reactive_powerVARVARis not valid withreactive_powerreactive_powerVARenergykVAhkVAhis not valid withenergyenergykVAhenergykVAhenergykVAhThe entities are never created in HA. All other SHM2 entities (active power, frequency, apparent power, phase angle) work correctly.
HA Error Log
Root Cause
HA's sensor platform validates
device_classagainst allowedunit_of_measurementvalues. As of HA 2026.3:reactive_powerdevice class only acceptsvar(lowercase), notVARenergydevice class does not acceptkVAh(volt-ampere-hours are apparent energy, not active energy)Suggested Fix
For reactive power sensors: Change
unit_of_measurementfromVARtovar(lowercase). HA expects SI-style lowercase for this unit.For reactive/apparent energy counters: Either:
device_class: energy(these are not active energy) and use a generic sensor, ordevice_class: Nonewithstate_class: total_increasingto keep long-term statistics without device class validationEnvironment
ghcr.io/anotherdaniel/smahub:v1.6.2)HA_MQTT_ENABLED=true