Units for energy consumption by distance #1163
Replies: 4 comments 4 replies
-
Hi there @jschlyter 👋 Thanks for opening an arch discussion. The proposal makes sense in a way. However, we only want to add support for things like this. There are multiple integrations available in our current core codebase that can leverage this. Which ones would those be? ../Frenck |
Beta Was this translation helpful? Give feedback.
-
I suggest we add a more generic support for inverse units while doing this. There's some sample code in https://github.com/jschlyter/home-assistant/blob/9ef4b3c766e2c05596a88b6bc4744926a02614f9/homeassistant/util/unit_conversion.py#L248 and similar for |
Beta Was this translation helpful? Give feedback.
-
Any updates on this issue? Is there anything I can do to move things ahead? |
Beta Was this translation helpful? Give feedback.
-
@jschlyter we discussed the proposal, while we're positive it's too vague to make a decision on. Please update it so it's clear:
This proposal is a good reference: #1124 |
Beta Was this translation helpful? Give feedback.
-
Home Assistant currently has no units for measuring energy consumption by distance (e.g., kWh/100km or mi/kWh). Energy consumption per time unit , e.g. kWh/h is usually written as kW so that is already covered.
Energy consumed by electric cars is typically measured in kWh/100km in Europe and in mi/kWh in US/Canada. This is similar to fuel consumption with l/10km in Europe and miles/gallon in US/Canada. I have a draft PR introducing energy distance units supporting all these units and conversion between them.
Proposal
Add an
energy_distance
sensor device class with support for unit conversion between metric and US customary energy consumption units by distance, including their inverses (Europe normally uses energy per distance whereas US/UK uses distance per energy). The following units should be supported:kWh/100km
kWh/100mi
mi/kWh
km/kWh
Preliminary code available at home-assistant/core@dev...jschlyter:home-assistant:energy_distance_units with conversion between any of the four units above.
Integrations which can benefit from the proposal
Integrations that can benefit are primarily for electric vehicles.
Other work
To be consistent one can also consider a
volume_distance
sensor device class (e.g.,l/km
) for vehicles running on liquid fuel, but that should be addressed separately. Similar to this ismass_distance
(e.g.,kg/100km
) used for LNG/CNG vehicles.Beta Was this translation helpful? Give feedback.
All reactions