Add and use time related constants (#32065)

* Add and use time related constants

* Sort time constants and reuse them in data rate constants

* Fix greeneyemonitor import

* Fix greeneyemonitor import V2

* Fix failing here_travel_time test

* Add TIME_MONTHS and TIME_YEARS

* Use TIME_MINUTES in opentherm_gw and isy994

* Add and use TIME_MILLISECONDS

* Change inconsistent ones

* Add TIME_MICROSECONDS and TIME_WEEKS

* Use constants in apcupsd and travisci

* Fix import error in upnp sensor.py

* Fix isy994 sensor.py using TIME_YEARS

* Fix dyson tests

* Use TIME_SECONDS in more places

* Use TIME_DAYS in google wifi
This commit is contained in:
springstan 2020-02-23 21:09:24 +01:00 committed by GitHub
parent 8dd80e0e3c
commit a85808e325
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
81 changed files with 480 additions and 287 deletions

View file

@ -20,6 +20,7 @@ from homeassistant.const import (
CONF_MONITORED_CONDITIONS,
CONF_NAME,
TEMP_CELSIUS,
TIME_HOURS,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
@ -59,7 +60,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", "km/h"],
"gust_kmh": ["Wind Gust kmh", f"km/{TIME_HOURS}"],
"gust_kt": ["Wind Gust kt", "kt"],
"air_temp": ["Air Temp C", TEMP_CELSIUS],
"dewpt": ["Dew Point C", TEMP_CELSIUS],
@ -76,7 +77,7 @@ SENSOR_TYPES = {
"vis_km": ["Visability km", "km"],
"weather": ["Weather", None],
"wind_dir": ["Wind Direction", None],
"wind_spd_kmh": ["Wind Speed kmh", "km/h"],
"wind_spd_kmh": ["Wind Speed kmh", f"km/{TIME_HOURS}"],
"wind_spd_kt": ["Wind Speed kt", "kt"],
}