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:
parent
8dd80e0e3c
commit
a85808e325
81 changed files with 480 additions and 287 deletions
|
@ -1,6 +1,7 @@
|
|||
"""Support for UPnP/IGD Sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.const import TIME_SECONDS
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
@ -192,7 +193,7 @@ class PerSecondUPnPIGDSensor(UpnpSensor):
|
|||
@property
|
||||
def unit_of_measurement(self) -> str:
|
||||
"""Return the unit of measurement of this entity, if any."""
|
||||
return f"{self.unit}/s"
|
||||
return f"{self.unit}/{TIME_SECONDS}"
|
||||
|
||||
def _is_overflowed(self, new_value) -> bool:
|
||||
"""Check if value has overflowed."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue