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

Refactored deprecated UNITS (#97368)

This commit is contained in:
Meow
2023-08-03 21:12:01 +02:00
committed by GitHub
parent e7e68907fa
commit 6fd60024cc
9 changed files with 165 additions and 128 deletions

View File

@@ -19,15 +19,15 @@ from homeassistant.components import group
from homeassistant.config import async_process_ha_core_config
from homeassistant.const import (
ATTR_UNIT_OF_MEASUREMENT,
LENGTH_METERS,
LENGTH_MILLIMETERS,
MASS_GRAMS,
STATE_ON,
STATE_UNAVAILABLE,
TEMP_CELSIUS,
VOLUME_LITERS,
UnitOfLength,
UnitOfMass,
UnitOfPrecipitationDepth,
UnitOfPressure,
UnitOfSpeed,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import TemplateError
@@ -52,12 +52,12 @@ def _set_up_units(hass: HomeAssistant) -> None:
"""Set up the tests."""
hass.config.units = UnitSystem(
"custom",
accumulated_precipitation=LENGTH_MILLIMETERS,
accumulated_precipitation=UnitOfPrecipitationDepth.MILLIMETERS,
conversions={},
length=LENGTH_METERS,
mass=MASS_GRAMS,
length=UnitOfLength.METERS,
mass=UnitOfMass.GRAMS,
pressure=UnitOfPressure.PA,
temperature=TEMP_CELSIUS,
temperature=UnitOfTemperature.CELSIUS,
volume=VOLUME_LITERS,
wind_speed=UnitOfSpeed.KILOMETERS_PER_HOUR,
)