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ä authored and GitHub committed 2020-02-24 17:52:14 -08:00
1 parent c98f50115d
commit 496bd3dddf
44 files changed
+422 -177

No files matched your search

+9 -4
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),