Summary
In contrib/etc/ebusd/mqtt-hassio.cfg, the type_switch-number rule that assigns device_class: energy + state_class: total_increasing only matches the unit Wh, not kWh (or MWh).
Detail
The rule (around line 197):
sensor,energy,total_increasing = energy|,Wh$
matches if the message/field name contains energy or the unit matches ,Wh$. The switch key is %name%field,%unit, so a kWh field produces a key ending in ,kWh, and the pattern ,Wh$ (comma immediately followed by Wh) does not match because of the k.
The neighbouring power rule already handles the k-prefix explicitly (,kW$|,W$); the energy (and yield) rules do not.
Effect
Any energy reading in kWh whose name does not contain "energy" gets no device_class and no state_class, so it is excluded from long-term statistics and the Energy dashboard. Real example: Vaillant StatFuelSum (gas counter, unit kWh) is published as a plain sensor.
Fix
See PR — change the unit alternative to also match kWh. The yield rule on the next line (total*,Wh$) has the same limitation.
Summary
In
contrib/etc/ebusd/mqtt-hassio.cfg, thetype_switch-numberrule that assignsdevice_class: energy+state_class: total_increasingonly matches the unitWh, notkWh(orMWh).Detail
The rule (around line 197):
matches if the message/field name contains
energyor the unit matches,Wh$. The switch key is%name%field,%unit, so a kWh field produces a key ending in,kWh, and the pattern,Wh$(comma immediately followed byWh) does not match because of thek.The neighbouring
powerrule already handles the k-prefix explicitly (,kW$|,W$); theenergy(andyield) rules do not.Effect
Any energy reading in kWh whose name does not contain "energy" gets no
device_classand nostate_class, so it is excluded from long-term statistics and the Energy dashboard. Real example: VaillantStatFuelSum(gas counter, unit kWh) is published as a plain sensor.Fix
See PR — change the unit alternative to also match
kWh. Theyieldrule on the next line (total*,Wh$) has the same limitation.