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
81 changed files with 480 additions and 287 deletions

View File

@@ -2,6 +2,7 @@
from datetime import timedelta
from unittest.mock import patch
from homeassistant.const import TIME_SECONDS
from homeassistant.setup import async_setup_component
import homeassistant.util.dt as dt_util
@@ -181,7 +182,7 @@ async def test_suffix(hass):
"source": "sensor.bytes_per_second",
"round": 2,
"unit_prefix": "k",
"unit_time": "s",
"unit_time": TIME_SECONDS,
}
}