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

@ -12,6 +12,7 @@ from homeassistant.const import (
CONF_API_KEY,
CONF_MONITORED_CONDITIONS,
CONF_SCAN_INTERVAL,
TIME_SECONDS,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
@ -30,7 +31,7 @@ SCAN_INTERVAL = timedelta(seconds=30)
# sensor_type [ description, unit, icon ]
SENSOR_TYPES = {
"last_build_id": ["Last Build ID", "", "mdi:account-card-details"],
"last_build_duration": ["Last Build Duration", "sec", "mdi:timelapse"],
"last_build_duration": ["Last Build Duration", TIME_SECONDS, "mdi:timelapse"],
"last_build_finished_at": ["Last Build Finished At", "", "mdi:timetable"],
"last_build_started_at": ["Last Build Started At", "", "mdi:timetable"],
"last_build_state": ["Last Build State", "", "mdi:github-circle"],