Use UnitOfTime in integrations (a-g) (#84288)
This commit is contained in:
parent
55a5e17cf2
commit
68857dc272
24 changed files with 73 additions and 93 deletions
|
@ -15,12 +15,12 @@ from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONCENTRATION_PARTS_PER_CUBIC_METER,
|
CONCENTRATION_PARTS_PER_CUBIC_METER,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
TIME_HOURS,
|
|
||||||
UV_INDEX,
|
UV_INDEX,
|
||||||
UnitOfLength,
|
UnitOfLength,
|
||||||
UnitOfPrecipitationDepth,
|
UnitOfPrecipitationDepth,
|
||||||
UnitOfSpeed,
|
UnitOfSpeed,
|
||||||
UnitOfTemperature,
|
UnitOfTemperature,
|
||||||
|
UnitOfTime,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
@ -95,7 +95,7 @@ FORECAST_SENSOR_TYPES: tuple[AccuWeatherSensorDescription, ...] = (
|
||||||
key="HoursOfSun",
|
key="HoursOfSun",
|
||||||
icon="mdi:weather-partly-cloudy",
|
icon="mdi:weather-partly-cloudy",
|
||||||
name="Hours of sun",
|
name="Hours of sun",
|
||||||
native_unit_of_measurement=TIME_HOURS,
|
native_unit_of_measurement=UnitOfTime.HOURS,
|
||||||
value_fn=lambda data, _: cast(float, data),
|
value_fn=lambda data, _: cast(float, data),
|
||||||
),
|
),
|
||||||
AccuWeatherSensorDescription(
|
AccuWeatherSensorDescription(
|
||||||
|
|
|
@ -10,7 +10,7 @@ from adguardhome import AdGuardHome, AdGuardHomeConnectionError
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
|
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import PERCENTAGE, TIME_MILLISECONDS
|
from homeassistant.const import PERCENTAGE, UnitOfTime
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
@ -83,7 +83,7 @@ SENSORS: tuple[AdGuardHomeEntityDescription, ...] = (
|
||||||
key="average_speed",
|
key="average_speed",
|
||||||
name="Average processing speed",
|
name="Average processing speed",
|
||||||
icon="mdi:speedometer",
|
icon="mdi:speedometer",
|
||||||
native_unit_of_measurement=TIME_MILLISECONDS,
|
native_unit_of_measurement=UnitOfTime.MILLISECONDS,
|
||||||
value_fn=lambda adguard: adguard.stats.avg_processing_time(),
|
value_fn=lambda adguard: adguard.stats.avg_processing_time(),
|
||||||
),
|
),
|
||||||
AdGuardHomeEntityDescription(
|
AdGuardHomeEntityDescription(
|
||||||
|
|
|
@ -26,8 +26,8 @@ from homeassistant.const import (
|
||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TIME_SECONDS,
|
|
||||||
UnitOfPressure,
|
UnitOfPressure,
|
||||||
|
UnitOfTime,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
@ -75,7 +75,7 @@ SENSOR_DESCRIPTIONS = {
|
||||||
key="update_interval",
|
key="update_interval",
|
||||||
name="Update Interval",
|
name="Update Interval",
|
||||||
device_class=SensorDeviceClass.DURATION,
|
device_class=SensorDeviceClass.DURATION,
|
||||||
native_unit_of_measurement=TIME_SECONDS,
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
# The interval setting is not a generally useful entity for most users.
|
# The interval setting is not a generally useful entity for most users.
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
|
|
|
@ -5,8 +5,8 @@ from homeassistant.const import (
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
TIME_HOURS,
|
|
||||||
UnitOfPressure,
|
UnitOfPressure,
|
||||||
|
UnitOfTime,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
@ -52,7 +52,7 @@ class AtagSensor(AtagEntity, SensorEntity):
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
TIME_HOURS,
|
UnitOfTime.HOURS,
|
||||||
):
|
):
|
||||||
self._attr_native_unit_of_measurement = coordinator.data.report[
|
self._attr_native_unit_of_measurement = coordinator.data.report[
|
||||||
self._id
|
self._id
|
||||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.components.sensor import (
|
||||||
SensorStateClass,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import TIME_DAYS, UnitOfInformation
|
from homeassistant.const import UnitOfInformation, UnitOfTime
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.device_registry import DeviceEntryType
|
from homeassistant.helpers.device_registry import DeviceEntryType
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
@ -113,13 +113,13 @@ SENSOR_DESCRIPTIONS: tuple[SensorValueEntityDescription, ...] = (
|
||||||
SensorValueEntityDescription(
|
SensorValueEntityDescription(
|
||||||
key="daysTotal",
|
key="daysTotal",
|
||||||
name="Billing cycle length",
|
name="Billing cycle length",
|
||||||
native_unit_of_measurement=TIME_DAYS,
|
native_unit_of_measurement=UnitOfTime.DAYS,
|
||||||
icon="mdi:calendar-range",
|
icon="mdi:calendar-range",
|
||||||
),
|
),
|
||||||
SensorValueEntityDescription(
|
SensorValueEntityDescription(
|
||||||
key="daysRemaining",
|
key="daysRemaining",
|
||||||
name="Billing cycle remaining",
|
name="Billing cycle remaining",
|
||||||
native_unit_of_measurement=TIME_DAYS,
|
native_unit_of_measurement=UnitOfTime.DAYS,
|
||||||
icon="mdi:calendar-clock",
|
icon="mdi:calendar-clock",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.components.number import (
|
||||||
NumberEntityDescription,
|
NumberEntityDescription,
|
||||||
NumberMode,
|
NumberMode,
|
||||||
)
|
)
|
||||||
from homeassistant.const import TIME_SECONDS
|
from homeassistant.const import UnitOfTime
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity import EntityCategory
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
@ -73,7 +73,7 @@ FAN_NUMBER_DESCRIPTIONS = (
|
||||||
native_min_value=ONE_MIN_SECS,
|
native_min_value=ONE_MIN_SECS,
|
||||||
native_max_value=HALF_DAY_SECS,
|
native_max_value=HALF_DAY_SECS,
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
native_unit_of_measurement=TIME_SECONDS,
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
value_fn=lambda device: cast(Optional[int], device.return_to_auto_timeout),
|
value_fn=lambda device: cast(Optional[int], device.return_to_auto_timeout),
|
||||||
mode=NumberMode.SLIDER,
|
mode=NumberMode.SLIDER,
|
||||||
),
|
),
|
||||||
|
@ -83,7 +83,7 @@ FAN_NUMBER_DESCRIPTIONS = (
|
||||||
native_min_value=ONE_MIN_SECS,
|
native_min_value=ONE_MIN_SECS,
|
||||||
native_max_value=ONE_DAY_SECS,
|
native_max_value=ONE_DAY_SECS,
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
native_unit_of_measurement=TIME_SECONDS,
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
value_fn=lambda device: cast(Optional[int], device.motion_sense_timeout),
|
value_fn=lambda device: cast(Optional[int], device.motion_sense_timeout),
|
||||||
mode=NumberMode.SLIDER,
|
mode=NumberMode.SLIDER,
|
||||||
),
|
),
|
||||||
|
@ -96,7 +96,7 @@ LIGHT_NUMBER_DESCRIPTIONS = (
|
||||||
native_min_value=ONE_MIN_SECS,
|
native_min_value=ONE_MIN_SECS,
|
||||||
native_max_value=HALF_DAY_SECS,
|
native_max_value=HALF_DAY_SECS,
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
native_unit_of_measurement=TIME_SECONDS,
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
value_fn=lambda device: cast(
|
value_fn=lambda device: cast(
|
||||||
Optional[int], device.light_return_to_auto_timeout
|
Optional[int], device.light_return_to_auto_timeout
|
||||||
),
|
),
|
||||||
|
@ -108,7 +108,7 @@ LIGHT_NUMBER_DESCRIPTIONS = (
|
||||||
native_min_value=ONE_MIN_SECS,
|
native_min_value=ONE_MIN_SECS,
|
||||||
native_max_value=ONE_DAY_SECS,
|
native_max_value=ONE_DAY_SECS,
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
native_unit_of_measurement=TIME_SECONDS,
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
value_fn=lambda device: cast(Optional[int], device.light_auto_motion_timeout),
|
value_fn=lambda device: cast(Optional[int], device.light_auto_motion_timeout),
|
||||||
mode=NumberMode.SLIDER,
|
mode=NumberMode.SLIDER,
|
||||||
),
|
),
|
||||||
|
|
|
@ -12,12 +12,7 @@ from homeassistant.components.sensor import (
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
SensorEntityDescription,
|
SensorEntityDescription,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import CONF_CURRENCY, CONF_DISPLAY_OPTIONS, UnitOfTime
|
||||||
CONF_CURRENCY,
|
|
||||||
CONF_DISPLAY_OPTIONS,
|
|
||||||
TIME_MINUTES,
|
|
||||||
TIME_SECONDS,
|
|
||||||
)
|
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
@ -65,7 +60,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="minutes_between_blocks",
|
key="minutes_between_blocks",
|
||||||
name="Time between Blocks",
|
name="Time between Blocks",
|
||||||
native_unit_of_measurement=TIME_MINUTES,
|
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="number_of_transactions",
|
key="number_of_transactions",
|
||||||
|
@ -74,7 +69,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="hash_rate",
|
key="hash_rate",
|
||||||
name="Hash rate",
|
name="Hash rate",
|
||||||
native_unit_of_measurement=f"PH/{TIME_SECONDS}",
|
native_unit_of_measurement=f"PH/{UnitOfTime.SECONDS}",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="timestamp",
|
key="timestamp",
|
||||||
|
|
|
@ -7,7 +7,7 @@ from bizkaibus.bizkaibus import BizkaibusData
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import CONF_NAME, TIME_MINUTES
|
from homeassistant.const import CONF_NAME, UnitOfTime
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
@ -47,7 +47,7 @@ def setup_platform(
|
||||||
class BizkaibusSensor(SensorEntity):
|
class BizkaibusSensor(SensorEntity):
|
||||||
"""The class for handling the data."""
|
"""The class for handling the data."""
|
||||||
|
|
||||||
_attr_native_unit_of_measurement = TIME_MINUTES
|
_attr_native_unit_of_measurement = UnitOfTime.MINUTES
|
||||||
|
|
||||||
def __init__(self, data, name):
|
def __init__(self, data, name):
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
|
|
|
@ -25,7 +25,6 @@ from homeassistant.const import (
|
||||||
LIGHT_LUX,
|
LIGHT_LUX,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
TIME_SECONDS,
|
|
||||||
UnitOfElectricCurrent,
|
UnitOfElectricCurrent,
|
||||||
UnitOfElectricPotential,
|
UnitOfElectricPotential,
|
||||||
UnitOfEnergy,
|
UnitOfEnergy,
|
||||||
|
@ -35,6 +34,7 @@ from homeassistant.const import (
|
||||||
UnitOfPressure,
|
UnitOfPressure,
|
||||||
UnitOfSpeed,
|
UnitOfSpeed,
|
||||||
UnitOfTemperature,
|
UnitOfTemperature,
|
||||||
|
UnitOfTime,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import EntityCategory
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
|
@ -207,7 +207,7 @@ SENSOR_DESCRIPTIONS = {
|
||||||
(BTHomeSensorDeviceClass.DURATION, Units.TIME_SECONDS): SensorEntityDescription(
|
(BTHomeSensorDeviceClass.DURATION, Units.TIME_SECONDS): SensorEntityDescription(
|
||||||
key=f"{BTHomeSensorDeviceClass.DURATION}_{Units.TIME_SECONDS}",
|
key=f"{BTHomeSensorDeviceClass.DURATION}_{Units.TIME_SECONDS}",
|
||||||
device_class=SensorDeviceClass.DURATION,
|
device_class=SensorDeviceClass.DURATION,
|
||||||
native_unit_of_measurement=TIME_SECONDS,
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
# Used for current sensor
|
# Used for current sensor
|
||||||
|
|
|
@ -41,10 +41,10 @@ from homeassistant.const import (
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
REVOLUTIONS_PER_MINUTE,
|
REVOLUTIONS_PER_MINUTE,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TIME_DAYS,
|
|
||||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||||
UnitOfEnergy,
|
UnitOfEnergy,
|
||||||
UnitOfPower,
|
UnitOfPower,
|
||||||
|
UnitOfTime,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
@ -232,7 +232,7 @@ SENSOR_TYPES = (
|
||||||
ComfoconnectSensorEntityDescription(
|
ComfoconnectSensorEntityDescription(
|
||||||
key=ATTR_DAYS_TO_REPLACE_FILTER,
|
key=ATTR_DAYS_TO_REPLACE_FILTER,
|
||||||
name="Days to replace filter",
|
name="Days to replace filter",
|
||||||
native_unit_of_measurement=TIME_DAYS,
|
native_unit_of_measurement=UnitOfTime.DAYS,
|
||||||
icon="mdi:calendar",
|
icon="mdi:calendar",
|
||||||
sensor_id=SENSOR_DAYS_TO_REPLACE_FILTER,
|
sensor_id=SENSOR_DAYS_TO_REPLACE_FILTER,
|
||||||
),
|
),
|
||||||
|
|
|
@ -7,14 +7,7 @@ from typing import Any, cast
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||||
from homeassistant.const import (
|
from homeassistant.const import CONF_NAME, CONF_SOURCE, UnitOfTime
|
||||||
CONF_NAME,
|
|
||||||
CONF_SOURCE,
|
|
||||||
TIME_DAYS,
|
|
||||||
TIME_HOURS,
|
|
||||||
TIME_MINUTES,
|
|
||||||
TIME_SECONDS,
|
|
||||||
)
|
|
||||||
from homeassistant.helpers import selector
|
from homeassistant.helpers import selector
|
||||||
from homeassistant.helpers.schema_config_entry_flow import (
|
from homeassistant.helpers.schema_config_entry_flow import (
|
||||||
SchemaConfigFlowHandler,
|
SchemaConfigFlowHandler,
|
||||||
|
@ -41,10 +34,10 @@ UNIT_PREFIXES = [
|
||||||
selector.SelectOptionDict(value="P", label="P (peta)"),
|
selector.SelectOptionDict(value="P", label="P (peta)"),
|
||||||
]
|
]
|
||||||
TIME_UNITS = [
|
TIME_UNITS = [
|
||||||
selector.SelectOptionDict(value=TIME_SECONDS, label="Seconds"),
|
selector.SelectOptionDict(value=UnitOfTime.SECONDS, label="Seconds"),
|
||||||
selector.SelectOptionDict(value=TIME_MINUTES, label="Minutes"),
|
selector.SelectOptionDict(value=UnitOfTime.MINUTES, label="Minutes"),
|
||||||
selector.SelectOptionDict(value=TIME_HOURS, label="Hours"),
|
selector.SelectOptionDict(value=UnitOfTime.HOURS, label="Hours"),
|
||||||
selector.SelectOptionDict(value=TIME_DAYS, label="Days"),
|
selector.SelectOptionDict(value=UnitOfTime.DAYS, label="Days"),
|
||||||
]
|
]
|
||||||
|
|
||||||
OPTIONS_SCHEMA = vol.Schema(
|
OPTIONS_SCHEMA = vol.Schema(
|
||||||
|
@ -61,7 +54,7 @@ OPTIONS_SCHEMA = vol.Schema(
|
||||||
vol.Required(CONF_UNIT_PREFIX, default="none"): selector.SelectSelector(
|
vol.Required(CONF_UNIT_PREFIX, default="none"): selector.SelectSelector(
|
||||||
selector.SelectSelectorConfig(options=UNIT_PREFIXES),
|
selector.SelectSelectorConfig(options=UNIT_PREFIXES),
|
||||||
),
|
),
|
||||||
vol.Required(CONF_UNIT_TIME, default=TIME_HOURS): selector.SelectSelector(
|
vol.Required(CONF_UNIT_TIME, default=UnitOfTime.HOURS): selector.SelectSelector(
|
||||||
selector.SelectSelectorConfig(options=TIME_UNITS),
|
selector.SelectSelectorConfig(options=TIME_UNITS),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,7 @@ from homeassistant.const import (
|
||||||
CONF_SOURCE,
|
CONF_SOURCE,
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
TIME_DAYS,
|
UnitOfTime,
|
||||||
TIME_HOURS,
|
|
||||||
TIME_MINUTES,
|
|
||||||
TIME_SECONDS,
|
|
||||||
)
|
)
|
||||||
from homeassistant.core import Event, HomeAssistant, State, callback
|
from homeassistant.core import Event, HomeAssistant, State, callback
|
||||||
from homeassistant.helpers import config_validation as cv, entity_registry as er
|
from homeassistant.helpers import config_validation as cv, entity_registry as er
|
||||||
|
@ -54,10 +51,10 @@ UNIT_PREFIXES = {
|
||||||
|
|
||||||
# SI Time prefixes
|
# SI Time prefixes
|
||||||
UNIT_TIME = {
|
UNIT_TIME = {
|
||||||
TIME_SECONDS: 1,
|
UnitOfTime.SECONDS: 1,
|
||||||
TIME_MINUTES: 60,
|
UnitOfTime.MINUTES: 60,
|
||||||
TIME_HOURS: 60 * 60,
|
UnitOfTime.HOURS: 60 * 60,
|
||||||
TIME_DAYS: 24 * 60 * 60,
|
UnitOfTime.DAYS: 24 * 60 * 60,
|
||||||
}
|
}
|
||||||
|
|
||||||
ICON = "mdi:chart-line"
|
ICON = "mdi:chart-line"
|
||||||
|
@ -71,7 +68,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||||
vol.Required(CONF_SOURCE): cv.entity_id,
|
vol.Required(CONF_SOURCE): cv.entity_id,
|
||||||
vol.Optional(CONF_ROUND_DIGITS, default=DEFAULT_ROUND): vol.Coerce(int),
|
vol.Optional(CONF_ROUND_DIGITS, default=DEFAULT_ROUND): vol.Coerce(int),
|
||||||
vol.Optional(CONF_UNIT_PREFIX, default=None): vol.In(UNIT_PREFIXES),
|
vol.Optional(CONF_UNIT_PREFIX, default=None): vol.In(UNIT_PREFIXES),
|
||||||
vol.Optional(CONF_UNIT_TIME, default=TIME_HOURS): vol.In(UNIT_TIME),
|
vol.Optional(CONF_UNIT_TIME, default=UnitOfTime.HOURS): vol.In(UNIT_TIME),
|
||||||
vol.Optional(CONF_UNIT): cv.string,
|
vol.Optional(CONF_UNIT): cv.string,
|
||||||
vol.Optional(CONF_TIME_WINDOW, default=DEFAULT_TIME_WINDOW): cv.time_period,
|
vol.Optional(CONF_TIME_WINDOW, default=DEFAULT_TIME_WINDOW): cv.time_period,
|
||||||
}
|
}
|
||||||
|
@ -144,7 +141,7 @@ class DerivativeSensor(RestoreEntity, SensorEntity):
|
||||||
time_window: timedelta,
|
time_window: timedelta,
|
||||||
unit_of_measurement: str | None,
|
unit_of_measurement: str | None,
|
||||||
unit_prefix: str | None,
|
unit_prefix: str | None,
|
||||||
unit_time: str,
|
unit_time: UnitOfTime,
|
||||||
unique_id: str | None,
|
unique_id: str | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the derivative sensor."""
|
"""Initialize the derivative sensor."""
|
||||||
|
|
|
@ -14,7 +14,7 @@ import requests
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import CONF_NAME, TIME_MINUTES
|
from homeassistant.const import CONF_NAME, UnitOfTime
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
@ -117,7 +117,7 @@ class DublinPublicTransportSensor(SensorEntity):
|
||||||
@property
|
@property
|
||||||
def native_unit_of_measurement(self):
|
def native_unit_of_measurement(self):
|
||||||
"""Return the unit this state is expressed in."""
|
"""Return the unit this state is expressed in."""
|
||||||
return TIME_MINUTES
|
return UnitOfTime.MINUTES
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def icon(self):
|
def icon(self):
|
||||||
|
|
|
@ -24,8 +24,8 @@ from homeassistant.const import (
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
TIME_DAYS,
|
|
||||||
UnitOfInformation,
|
UnitOfInformation,
|
||||||
|
UnitOfTime,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
|
@ -69,7 +69,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="days_left",
|
key="days_left",
|
||||||
name="Days left",
|
name="Days left",
|
||||||
native_unit_of_measurement=TIME_DAYS,
|
native_unit_of_measurement=UnitOfTime.DAYS,
|
||||||
icon="mdi:calendar-today",
|
icon="mdi:calendar-today",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
|
|
|
@ -12,7 +12,7 @@ from homeassistant.const import (
|
||||||
CONF_LONGITUDE,
|
CONF_LONGITUDE,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_SHOW_ON_MAP,
|
CONF_SHOW_ON_MAP,
|
||||||
TIME_MINUTES,
|
UnitOfTime,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
|
@ -190,7 +190,7 @@ class EnturPublicTransportSensor(SensorEntity):
|
||||||
@property
|
@property
|
||||||
def native_unit_of_measurement(self) -> str:
|
def native_unit_of_measurement(self) -> str:
|
||||||
"""Return the unit this state is expressed in."""
|
"""Return the unit this state is expressed in."""
|
||||||
return TIME_MINUTES
|
return UnitOfTime.MINUTES
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def icon(self) -> str:
|
def icon(self) -> str:
|
||||||
|
|
|
@ -24,8 +24,8 @@ from homeassistant.const import (
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
TIME_MINUTES,
|
|
||||||
UnitOfInformation,
|
UnitOfInformation,
|
||||||
|
UnitOfTime,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
|
@ -135,37 +135,37 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="talk_used",
|
key="talk_used",
|
||||||
name="Talk used",
|
name="Talk used",
|
||||||
native_unit_of_measurement=TIME_MINUTES,
|
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||||
icon="mdi:cellphone",
|
icon="mdi:cellphone",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="talk_limit",
|
key="talk_limit",
|
||||||
name="Talk limit",
|
name="Talk limit",
|
||||||
native_unit_of_measurement=TIME_MINUTES,
|
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||||
icon="mdi:cellphone",
|
icon="mdi:cellphone",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="talk_remaining",
|
key="talk_remaining",
|
||||||
name="Talk remaining",
|
name="Talk remaining",
|
||||||
native_unit_of_measurement=TIME_MINUTES,
|
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||||
icon="mdi:cellphone",
|
icon="mdi:cellphone",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="other_talk_used",
|
key="other_talk_used",
|
||||||
name="Other Talk used",
|
name="Other Talk used",
|
||||||
native_unit_of_measurement=TIME_MINUTES,
|
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||||
icon="mdi:cellphone",
|
icon="mdi:cellphone",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="other_talk_limit",
|
key="other_talk_limit",
|
||||||
name="Other Talk limit",
|
name="Other Talk limit",
|
||||||
native_unit_of_measurement=TIME_MINUTES,
|
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||||
icon="mdi:cellphone",
|
icon="mdi:cellphone",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="other_talk_remaining",
|
key="other_talk_remaining",
|
||||||
name="Other Talk remaining",
|
name="Other Talk remaining",
|
||||||
native_unit_of_measurement=TIME_MINUTES,
|
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||||
icon="mdi:cellphone",
|
icon="mdi:cellphone",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.number import NumberEntity
|
from homeassistant.components.number import NumberEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import TIME_MINUTES
|
from homeassistant.const import UnitOfTime
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import DeviceInfo, Entity, EntityCategory
|
from homeassistant.helpers.entity import DeviceInfo, Entity, EntityCategory
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
@ -36,7 +36,7 @@ class PeriodicVentingTime(CoordinatorEntity[Coordinator], NumberEntity):
|
||||||
_attr_native_min_value: float = 0
|
_attr_native_min_value: float = 0
|
||||||
_attr_native_step: float = 1
|
_attr_native_step: float = 1
|
||||||
_attr_entity_category = EntityCategory.CONFIG
|
_attr_entity_category = EntityCategory.CONFIG
|
||||||
_attr_native_unit_of_measurement = TIME_MINUTES
|
_attr_native_unit_of_measurement = UnitOfTime.MINUTES
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|
|
@ -5,7 +5,7 @@ from contextlib import suppress
|
||||||
|
|
||||||
from homeassistant.components.number import NumberEntity, NumberEntityDescription
|
from homeassistant.components.number import NumberEntity, NumberEntityDescription
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import TIME_SECONDS
|
from homeassistant.const import UnitOfTime
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import EntityCategory
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
@ -21,7 +21,7 @@ ENTITY_TYPES: tuple[NumberEntityDescription, ...] = (
|
||||||
native_max_value=9999,
|
native_max_value=9999,
|
||||||
native_step=1,
|
native_step=1,
|
||||||
native_min_value=0,
|
native_min_value=0,
|
||||||
native_unit_of_measurement=TIME_SECONDS,
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
|
@ -38,7 +38,7 @@ ENTITY_TYPES: tuple[NumberEntityDescription, ...] = (
|
||||||
native_max_value=9999,
|
native_max_value=9999,
|
||||||
native_step=1,
|
native_step=1,
|
||||||
native_min_value=0,
|
native_min_value=0,
|
||||||
native_unit_of_measurement=TIME_SECONDS,
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
|
|
|
@ -14,12 +14,11 @@ from homeassistant.const import (
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
SIGNAL_STRENGTH_DECIBELS,
|
SIGNAL_STRENGTH_DECIBELS,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TIME_MINUTES,
|
|
||||||
TIME_SECONDS,
|
|
||||||
UnitOfElectricCurrent,
|
UnitOfElectricCurrent,
|
||||||
UnitOfElectricPotential,
|
UnitOfElectricPotential,
|
||||||
UnitOfEnergy,
|
UnitOfEnergy,
|
||||||
UnitOfPower,
|
UnitOfPower,
|
||||||
|
UnitOfTime,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import EntityCategory
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
|
@ -92,7 +91,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
key="timeToEmptyFull",
|
key="timeToEmptyFull",
|
||||||
name="Time to empty/full",
|
name="Time to empty/full",
|
||||||
device_class=SensorDeviceClass.DURATION,
|
device_class=SensorDeviceClass.DURATION,
|
||||||
native_unit_of_measurement=TIME_MINUTES,
|
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="temperature",
|
key="temperature",
|
||||||
|
@ -112,7 +111,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="timestamp",
|
key="timestamp",
|
||||||
name="Total run time",
|
name="Total run time",
|
||||||
native_unit_of_measurement=TIME_SECONDS,
|
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.const import (
|
||||||
CONF_API_KEY,
|
CONF_API_KEY,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
EVENT_HOMEASSISTANT_STARTED,
|
EVENT_HOMEASSISTANT_STARTED,
|
||||||
TIME_MINUTES,
|
UnitOfTime,
|
||||||
)
|
)
|
||||||
from homeassistant.core import CoreState, HomeAssistant
|
from homeassistant.core import CoreState, HomeAssistant
|
||||||
from homeassistant.helpers.device_registry import DeviceEntryType
|
from homeassistant.helpers.device_registry import DeviceEntryType
|
||||||
|
@ -76,7 +76,7 @@ class GoogleTravelTimeSensor(SensorEntity):
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
self._name = name
|
self._name = name
|
||||||
self._config_entry = config_entry
|
self._config_entry = config_entry
|
||||||
self._unit_of_measurement = TIME_MINUTES
|
self._unit_of_measurement = UnitOfTime.MINUTES
|
||||||
self._matrix = None
|
self._matrix = None
|
||||||
self._api_key = api_key
|
self._api_key = api_key
|
||||||
self._unique_id = config_entry.entry_id
|
self._unique_id = config_entry.entry_id
|
||||||
|
|
|
@ -18,7 +18,7 @@ from homeassistant.const import (
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
TIME_DAYS,
|
UnitOfTime,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
@ -75,7 +75,7 @@ SENSOR_TYPES: tuple[GoogleWifiSensorEntityDescription, ...] = (
|
||||||
key=ATTR_UPTIME,
|
key=ATTR_UPTIME,
|
||||||
primary_key="system",
|
primary_key="system",
|
||||||
sensor_key="uptime",
|
sensor_key="uptime",
|
||||||
native_unit_of_measurement=TIME_DAYS,
|
native_unit_of_measurement=UnitOfTime.DAYS,
|
||||||
icon="mdi:timelapse",
|
icon="mdi:timelapse",
|
||||||
),
|
),
|
||||||
GoogleWifiSensorEntityDescription(
|
GoogleWifiSensorEntityDescription(
|
||||||
|
|
|
@ -12,10 +12,8 @@ from homeassistant.const import (
|
||||||
CONF_SENSORS,
|
CONF_SENSORS,
|
||||||
CONF_TEMPERATURE_UNIT,
|
CONF_TEMPERATURE_UNIT,
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
TIME_HOURS,
|
|
||||||
TIME_MINUTES,
|
|
||||||
TIME_SECONDS,
|
|
||||||
Platform,
|
Platform,
|
||||||
|
UnitOfTime,
|
||||||
)
|
)
|
||||||
from homeassistant.core import Event, HomeAssistant
|
from homeassistant.core import Event, HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
@ -66,8 +64,8 @@ PULSE_COUNTER_SCHEMA = vol.Schema(
|
||||||
vol.Required(CONF_NAME): cv.string,
|
vol.Required(CONF_NAME): cv.string,
|
||||||
vol.Required(CONF_COUNTED_QUANTITY): cv.string,
|
vol.Required(CONF_COUNTED_QUANTITY): cv.string,
|
||||||
vol.Optional(CONF_COUNTED_QUANTITY_PER_PULSE, default=1.0): vol.Coerce(float),
|
vol.Optional(CONF_COUNTED_QUANTITY_PER_PULSE, default=1.0): vol.Coerce(float),
|
||||||
vol.Optional(CONF_TIME_UNIT, default=TIME_SECONDS): vol.Any(
|
vol.Optional(CONF_TIME_UNIT, default=UnitOfTime.SECONDS): vol.Any(
|
||||||
TIME_SECONDS, TIME_MINUTES, TIME_HOURS
|
UnitOfTime.SECONDS.value, UnitOfTime.MINUTES.value, UnitOfTime.HOURS.value
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -10,11 +10,9 @@ from homeassistant.const import (
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_SENSORS,
|
CONF_SENSORS,
|
||||||
CONF_TEMPERATURE_UNIT,
|
CONF_TEMPERATURE_UNIT,
|
||||||
TIME_HOURS,
|
|
||||||
TIME_MINUTES,
|
|
||||||
TIME_SECONDS,
|
|
||||||
UnitOfElectricPotential,
|
UnitOfElectricPotential,
|
||||||
UnitOfPower,
|
UnitOfPower,
|
||||||
|
UnitOfTime,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
@ -233,16 +231,16 @@ class PulseCounter(GEMSensor):
|
||||||
@property
|
@property
|
||||||
def _seconds_per_time_unit(self) -> int:
|
def _seconds_per_time_unit(self) -> int:
|
||||||
"""Return the number of seconds in the given display time unit."""
|
"""Return the number of seconds in the given display time unit."""
|
||||||
if self._time_unit == TIME_SECONDS:
|
if self._time_unit == UnitOfTime.SECONDS:
|
||||||
return 1
|
return 1
|
||||||
if self._time_unit == TIME_MINUTES:
|
if self._time_unit == UnitOfTime.MINUTES:
|
||||||
return 60
|
return 60
|
||||||
if self._time_unit == TIME_HOURS:
|
if self._time_unit == UnitOfTime.HOURS:
|
||||||
return 3600
|
return 3600
|
||||||
|
|
||||||
# Config schema should have ensured it is one of the above values
|
# Config schema should have ensured it is one of the above values
|
||||||
raise Exception(
|
raise Exception(
|
||||||
f"Invalid value for time unit: {self._time_unit}. Expected one of {TIME_SECONDS}, {TIME_MINUTES}, or {TIME_HOURS}"
|
f"Invalid value for time unit: {self._time_unit}. Expected one of {UnitOfTime.SECONDS}, {UnitOfTime.MINUTES}, or {UnitOfTime.HOURS}"
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -10,7 +10,7 @@ from homeassistant.components.sensor import (
|
||||||
SensorStateClass,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import TEMP_FAHRENHEIT, TIME_MINUTES, UnitOfElectricPotential
|
from homeassistant.const import TEMP_FAHRENHEIT, UnitOfElectricPotential, UnitOfTime
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.entity import EntityCategory
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
|
@ -72,7 +72,7 @@ VALVE_CONTROLLER_DESCRIPTIONS = (
|
||||||
name="Uptime",
|
name="Uptime",
|
||||||
icon="mdi:timer",
|
icon="mdi:timer",
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
native_unit_of_measurement=TIME_MINUTES,
|
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||||
api_category=API_SYSTEM_DIAGNOSTICS,
|
api_category=API_SYSTEM_DIAGNOSTICS,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue