#Creating custom units of measurement/scaling MQTT sensor values

1 messages · Page 1 of 1 (latest)

cinder lichen
#

I'm setting up my first HA installation, and I'm trying to add the energy consumption from my electrical meter. I can get the raw values over SDR with rtl_433, which is publishing them to HA's own Mosquitto server; that part is working just fine.

The problem is that my electric meter reports values not in kWh or Wh, but rather in hundredths of a kWh; this means that the unit is technically decawatt-hours, or daWh, but HA doesn't understand the "daWh" unit.

What's the best way to get the right value into HA? I'd expect either a way to define custom units of measurement or a way to do a premultiplication of the raw MQTT value, but based on my quick look at the source, the former seems like it'll require some amount of monkey-patching, and I don't see any mention of value scaling in the docs or the UI.

Ideally I could just mark this as kWh and give it a scaling multiplier of 0.01; is that supported somehow in the undocumented featureset?

ebon hinge
#

I’d suggest you bring in a “raw” sensor with your value and then use a template sensor to convert it with the right UoM, device class etc.

#

When using a defined device class, you have to use the defined UoM’s for that particular one.