I’m trying to find a list of the valid units of measurement? In setting up a battery meter would it be “volt”, “volts” or “v”?
To be clear, unit_of_measurement
is just a string and can be anything you want. There are only a few “special” uom values, such as “°C” and “°F”, where HA actually converts values to your locale settings when it sees them. Otherwise, “Pigs Flying” is a perfectly acceptable unit_of_measurement
as far as HA is concerned.
Thanks Rob… That makes sense… What then controls HA treating it as a number and making this show as a line chart?
I can see that in the History area HA is treating it as a number…
Okay, apologies… It looks like the sensor had not yet received an update… Now that it has received an update it is showing as a line chart… Nice!
Right, it just needs to have some unit_of_measurement
, doesn’t matter what it is. Sometimes previous values without a uom can delay the graph displaying until they’re flushed out with new data.
Thank you for explaining. Is there a list of the “special” uom values which get converted?
I suspect that it’s these: core/unit_system.py at 0b4b071c0238999f5af5c4d391478ec87e545d21 · home-assistant/core · GitHub
Only c and f get converted. Everything else remains untouched
That’s what I thought, and then I saw the conversion functions for other things. I guess those are just helpers for integrations to use when they want. Incidentally, the frontend changes the icon when it sees a temperature unit: frontend/sensor_icon.ts at dc79fc2919d836ae28ce0c065aacd6ef52f47dc7 · home-assistant/frontend · GitHub
const unit = stateObj?.attributes.unit_of_measurement;
if (unit === UNIT_C || unit === UNIT_F) {
return "hass:thermometer";
}
To historize the states of my Venstar thermostat attribute: hvac_action
what unit_of_measurement should be used for different text strings like idle, cooling, etc.?
So far, with this configuration:
when I pull it up in history it’s trying to trend a numerical value.
To clarify, the variable is acquiring the data:
But the history is either not being stored or retrieved properly:
Is unit of measure the problem, or something else?
Ideally, the trend would show up like the weather forecast:
if you add a unit of measurement, it attempts to graph it. So don’t add a unit of measurement.
That’s it, THANK YOU!!!
i have a similar issue. i have no uom but i still see a line graph. any thoughts?
that’s the only thing that causes it unless something changed recently.
Would state_class:
being present perhaps cause this behaviour too?
It could. To be honest, I haven’t been paying attention to those details lately.
This doesn’t make sense. Does it mean that Home Assistant only supports dollars, euros and cents as currency unit of measurements? What about the rest of the world?