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

@ -17,7 +17,7 @@ from homeassistant.const import (
CONF_LONGITUDE,
CONF_MONITORED_CONDITIONS,
CONF_NAME,
TIME_HOURS,
SPEED_KILOMETERS_PER_HOUR,
__version__,
)
import homeassistant.helpers.config_validation as cv
@ -40,12 +40,17 @@ SENSOR_TYPES = {
"pressure": ("Pressure", "hPa", "LDstat hPa", float),
"pressure_sealevel": ("Pressure at Sea Level", "hPa", "LDred hPa", float),
"humidity": ("Humidity", "%", "RF %", int),
"wind_speed": ("Wind Speed", f"km/{TIME_HOURS}", f"WG km/{TIME_HOURS}", float),
"wind_speed": (
"Wind Speed",
SPEED_KILOMETERS_PER_HOUR,
f"WG {SPEED_KILOMETERS_PER_HOUR}",
float,
),
"wind_bearing": ("Wind Bearing", "°", "WR °", int),
"wind_max_speed": (
"Top Wind Speed",
f"km/{TIME_HOURS}",
f"WSG km/{TIME_HOURS}",
SPEED_KILOMETERS_PER_HOUR,
f"WSG {SPEED_KILOMETERS_PER_HOUR}",
float,
),
"wind_max_bearing": ("Top Wind Bearing", "°", "WSR °", int),