Any way to convert values in a dashboard?

Is there an easy way to multiply all values from an entity by a constant before displaying in a dashboard? For example, to convert between metric and imperial units?

I have a sensor that records measurements in one set of units, and I’m used to thinking about these measurements in a different set of units. Conversion is simple multiplication by a constant. I don’t need to change the underlying entity, but I’d love to pre-process it before displaying in a dashboard (as numbers or as a historical graph).

For example, if my sensor is MikesSensorValue and it reads in imperial, is there a way to create a “virtual” entity named MikesSensorValueInMetric that is always populated with the values from MikesSensorValue multiplied by a constant conversion factor? (Then I could just display MikeSensorValueInMetric in my dashboards…)

Thanks!

Look up template sensor

If your problem is I have a thing and I want to show it as another thing that I can math somehow…

Template sensor.

1 Like

If you sometimes want to use it in one units then other times want to use it in another then the template sensor that @NathanCu is the way to go.

But if you always want to use it in metric then you can go to the entity’s properties and change the unit of measure. Can do it all from the UI in a couple seconds.

Settings – entities – pick your entity – hit the gear icon on the upper right.

1 Like

Hmmm, in my tests a value was NOT changing for units like “Hz” and “KHz” (frequency).
Only for Celsius ↔ Fahrenheit a value was changed.
May be for “metric - imperials” it will change, no idea.

that’s strange… i don’t have any distance measurement entities, but i tested for things like kWh, GJ, V, and they all properly converted the values.

well… @mike15 , try it and let us know! we’ll learn something!

Thank you! This is exactly what I was looking for.

(For others who might have this question, here is an example of doing this: to convert between between two different units of Radon levels Bq/m^3 to pCi/L, you divide by 37.)

Thanks!