1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add calories to energy sensor device class (#122796)

* added calories to energy class

* changes

* temporarily solving the problem with conversion accuracy

* add tests

* added calories to energy class

* changes

* add tests

* Update homeassistant/util/unit_conversion.py

Co-authored-by: Robert Resch <robert@resch.dev>

* Update homeassistant/util/unit_conversion.py

Co-authored-by: Robert Resch <robert@resch.dev>

* apply suggestions

* Update homeassistant/util/unit_conversion.py

---------

Co-authored-by: Robert Resch <robert@resch.dev>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
Sergey Dudanov
2024-09-10 14:22:15 +04:00
committed by GitHub
parent 9f284c0582
commit dcd7830a35
5 changed files with 42 additions and 20 deletions

View File

@@ -693,11 +693,17 @@ _DEPRECATED_POWER_VOLT_AMPERE_REACTIVE: Final = DeprecatedConstantEnum(
class UnitOfEnergy(StrEnum):
"""Energy units."""
GIGA_JOULE = "GJ"
KILO_WATT_HOUR = "kWh"
JOULE = "J"
KILO_JOULE = "kJ"
MEGA_JOULE = "MJ"
MEGA_WATT_HOUR = "MWh"
GIGA_JOULE = "GJ"
WATT_HOUR = "Wh"
KILO_WATT_HOUR = "kWh"
MEGA_WATT_HOUR = "MWh"
CALORIE = "cal"
KILO_CALORIE = "kcal"
MEGA_CALORIE = "Mcal"
GIGA_CALORIE = "Gcal"
_DEPRECATED_ENERGY_KILO_WATT_HOUR: Final = DeprecatedConstantEnum(