Add and use more unit constants (#32122)

* Add and use speed constants

* Add and use meter based volume and area constants

* Add and use more mass unit constants

* Add and use concentration unit constants

* Add and use watts per square meter constant

* Use more time constants

* Use more data constants
This commit is contained in:
Ville Skyttä 2020-02-25 03:52:14 +02:00 committed by GitHub
parent c98f50115d
commit 496bd3dddf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 422 additions and 177 deletions

View file

@ -19,8 +19,8 @@ from homeassistant.const import (
CONF_LONGITUDE,
CONF_MONITORED_CONDITIONS,
CONF_NAME,
SPEED_KILOMETERS_PER_HOUR,
TEMP_CELSIUS,
TIME_HOURS,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
@ -59,7 +59,7 @@ SENSOR_TYPES = {
"cloud_type_id": ["Cloud Type ID", None],
"cloud_type": ["Cloud Type", None],
"delta_t": ["Delta Temp C", TEMP_CELSIUS],
"gust_kmh": ["Wind Gust kmh", f"km/{TIME_HOURS}"],
"gust_kmh": ["Wind Gust kmh", SPEED_KILOMETERS_PER_HOUR],
"gust_kt": ["Wind Gust kt", "kt"],
"air_temp": ["Air Temp C", TEMP_CELSIUS],
"dewpt": ["Dew Point C", TEMP_CELSIUS],
@ -76,7 +76,7 @@ SENSOR_TYPES = {
"vis_km": ["Visability km", "km"],
"weather": ["Weather", None],
"wind_dir": ["Wind Direction", None],
"wind_spd_kmh": ["Wind Speed kmh", f"km/{TIME_HOURS}"],
"wind_spd_kmh": ["Wind Speed kmh", SPEED_KILOMETERS_PER_HOUR],
"wind_spd_kt": ["Wind Speed kt", "kt"],
}