mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Use UnitOfTime in integrations (t-z) (#84291)
This commit is contained in:
parent
1f3da9cf1a
commit
fba13dcc90
@ -9,7 +9,7 @@ from tmb import IBus
|
||||
import voluptuous as vol
|
||||
|
||||
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
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
@ -81,7 +81,7 @@ class TMBSensor(SensorEntity):
|
||||
self._stop = stop
|
||||
self._line = line.upper()
|
||||
self._name = name
|
||||
self._unit = TIME_MINUTES
|
||||
self._unit = UnitOfTime.MINUTES
|
||||
self._state = None
|
||||
|
||||
@property
|
||||
|
@ -10,7 +10,7 @@ from tololib.message_info import SettingsInfo
|
||||
|
||||
from homeassistant.components.number import NumberEntity, NumberEntityDescription
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import TIME_MINUTES
|
||||
from homeassistant.const import UnitOfTime
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
@ -43,7 +43,7 @@ NUMBERS = (
|
||||
key="power_timer",
|
||||
icon="mdi:power-settings",
|
||||
name="Power Timer",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||
native_max_value=POWER_TIMER_MAX,
|
||||
getter=lambda settings: settings.power_timer,
|
||||
setter=lambda client, value: client.set_power_timer(value),
|
||||
@ -52,7 +52,7 @@ NUMBERS = (
|
||||
key="salt_bath_timer",
|
||||
icon="mdi:shaker-outline",
|
||||
name="Salt Bath Timer",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||
native_max_value=SALT_BATH_TIMER_MAX,
|
||||
getter=lambda settings: settings.salt_bath_timer,
|
||||
setter=lambda client, value: client.set_salt_bath_timer(value),
|
||||
@ -61,7 +61,7 @@ NUMBERS = (
|
||||
key="fan_timer",
|
||||
icon="mdi:fan-auto",
|
||||
name="Fan Timer",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||
native_max_value=FAN_TIMER_MAX,
|
||||
getter=lambda settings: settings.fan_timer,
|
||||
setter=lambda client, value: client.set_fan_timer(value),
|
||||
|
@ -13,7 +13,7 @@ from homeassistant.components.sensor import (
|
||||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import PERCENTAGE, TEMP_CELSIUS, TIME_MINUTES
|
||||
from homeassistant.const import PERCENTAGE, TEMP_CELSIUS, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
@ -63,7 +63,7 @@ SENSORS = (
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
icon="mdi:power-settings",
|
||||
name="Power Timer",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||
getter=lambda status: status.power_timer,
|
||||
availability_checker=lambda settings, status: status.power_on
|
||||
and settings.power_timer is not None,
|
||||
@ -73,7 +73,7 @@ SENSORS = (
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
icon="mdi:shaker-outline",
|
||||
name="Salt Bath Timer",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||
getter=lambda status: status.salt_bath_timer,
|
||||
availability_checker=lambda settings, status: status.salt_bath_on
|
||||
and settings.salt_bath_timer is not None,
|
||||
@ -83,7 +83,7 @@ SENSORS = (
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
icon="mdi:fan-auto",
|
||||
name="Fan Timer",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||
getter=lambda status: status.fan_timer,
|
||||
availability_checker=lambda settings, status: status.fan_on
|
||||
and settings.fan_timer is not None,
|
||||
|
@ -10,7 +10,7 @@ from homeassistant.components.sensor import (
|
||||
SensorEntityDescription,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_BATTERY_LEVEL, PERCENTAGE, TIME_MINUTES
|
||||
from homeassistant.const import ATTR_BATTERY_LEVEL, PERCENTAGE, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
@ -152,14 +152,14 @@ SENSOR_TYPES: tuple[TractiveSensorEntityDescription, ...] = (
|
||||
key=ATTR_MINUTES_ACTIVE,
|
||||
name="Minutes active",
|
||||
icon="mdi:clock-time-eight-outline",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||
entity_class=TractiveActivitySensor,
|
||||
),
|
||||
TractiveSensorEntityDescription(
|
||||
key=ATTR_DAILY_GOAL,
|
||||
name="Daily goal",
|
||||
icon="mdi:flag-checkered",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||
entity_class=TractiveActivitySensor,
|
||||
),
|
||||
)
|
||||
|
@ -18,8 +18,8 @@ from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
PERCENTAGE,
|
||||
TIME_HOURS,
|
||||
Platform,
|
||||
UnitOfTime,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import entity_registry
|
||||
@ -98,7 +98,7 @@ SENSOR_DESCRIPTIONS_FAN: tuple[TradfriSensorEntityDescription, ...] = (
|
||||
key="filter_life_remaining",
|
||||
name="filter time left",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=TIME_HOURS,
|
||||
native_unit_of_measurement=UnitOfTime.HOURS,
|
||||
icon="mdi:clock-outline",
|
||||
value=_get_filter_time_left,
|
||||
),
|
||||
|
@ -7,7 +7,7 @@ from TransportNSW import TransportNSW
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import ATTR_MODE, CONF_API_KEY, CONF_NAME, TIME_MINUTES
|
||||
from homeassistant.const import ATTR_MODE, CONF_API_KEY, CONF_NAME, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
@ -106,7 +106,7 @@ class TransportNSWSensor(SensorEntity):
|
||||
@property
|
||||
def native_unit_of_measurement(self):
|
||||
"""Return the unit this state is expressed in."""
|
||||
return TIME_MINUTES
|
||||
return UnitOfTime.MINUTES
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
|
@ -18,7 +18,7 @@ from homeassistant.const import (
|
||||
CONF_API_KEY,
|
||||
CONF_MONITORED_CONDITIONS,
|
||||
CONF_SCAN_INTERVAL,
|
||||
TIME_SECONDS,
|
||||
UnitOfTime,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
@ -43,7 +43,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||
SensorEntityDescription(
|
||||
key="last_build_duration",
|
||||
name="Last Build Duration",
|
||||
native_unit_of_measurement=TIME_SECONDS,
|
||||
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||
icon="mdi:timelapse",
|
||||
),
|
||||
SensorEntityDescription(
|
||||
|
@ -9,7 +9,7 @@ from homeassistant.components.number import (
|
||||
NumberEntityDescription,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import TIME_MINUTES
|
||||
from homeassistant.const import UnitOfTime
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
@ -146,7 +146,7 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
|
||||
key=DPCode.COOK_TIME,
|
||||
name="Cook time",
|
||||
icon="mdi:timer",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
NumberEntityDescription(
|
||||
|
@ -15,10 +15,10 @@ from homeassistant.components.sensor import (
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
PERCENTAGE,
|
||||
TIME_MINUTES,
|
||||
UnitOfElectricCurrent,
|
||||
UnitOfElectricPotential,
|
||||
UnitOfPower,
|
||||
UnitOfTime,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
@ -437,7 +437,7 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||
TuyaSensorEntityDescription(
|
||||
key=DPCode.REMAIN_TIME,
|
||||
name="Remaining time",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||
icon="mdi:timer",
|
||||
),
|
||||
),
|
||||
|
@ -10,7 +10,7 @@ import requests
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_MODE, TIME_MINUTES
|
||||
from homeassistant.const import CONF_MODE, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
@ -107,7 +107,7 @@ class UkTransportSensor(SensorEntity):
|
||||
|
||||
TRANSPORT_API_URL_BASE = "https://transportapi.com/v3/uk/"
|
||||
_attr_icon = "mdi:train"
|
||||
_attr_native_unit_of_measurement = TIME_MINUTES
|
||||
_attr_native_unit_of_measurement = UnitOfTime.MINUTES
|
||||
|
||||
def __init__(self, name, api_app_id, api_app_key, url):
|
||||
"""Initialize the sensor."""
|
||||
|
@ -14,7 +14,7 @@ from pyunifiprotect.data import (
|
||||
|
||||
from homeassistant.components.number import NumberEntity, NumberEntityDescription
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import PERCENTAGE, TIME_SECONDS
|
||||
from homeassistant.const import PERCENTAGE, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
@ -124,7 +124,7 @@ LIGHT_NUMBERS: tuple[ProtectNumberEntityDescription, ...] = (
|
||||
name="Auto-shutoff Duration",
|
||||
icon="mdi:camera-timer",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
native_unit_of_measurement=TIME_SECONDS,
|
||||
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||
ufp_min=15,
|
||||
ufp_max=900,
|
||||
ufp_step=15,
|
||||
@ -158,7 +158,7 @@ DOORLOCK_NUMBERS: tuple[ProtectNumberEntityDescription, ...] = (
|
||||
name="Auto-lock Timeout",
|
||||
icon="mdi:walk",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
native_unit_of_measurement=TIME_SECONDS,
|
||||
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||
ufp_min=0,
|
||||
ufp_max=3600,
|
||||
ufp_step=15,
|
||||
|
@ -30,10 +30,10 @@ from homeassistant.const import (
|
||||
PERCENTAGE,
|
||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||
TEMP_CELSIUS,
|
||||
TIME_SECONDS,
|
||||
UnitOfDataRate,
|
||||
UnitOfElectricPotential,
|
||||
UnitOfInformation,
|
||||
UnitOfTime,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
@ -482,7 +482,7 @@ NVR_SENSORS: tuple[ProtectSensorEntityDescription, ...] = (
|
||||
ProtectSensorEntityDescription[NVR](
|
||||
key="record_capacity",
|
||||
name="Recording Capacity",
|
||||
native_unit_of_measurement=TIME_SECONDS,
|
||||
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||
icon="mdi:record-rec",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -2,7 +2,7 @@
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from homeassistant.const import TIME_SECONDS
|
||||
from homeassistant.const import UnitOfTime
|
||||
|
||||
LOGGER = logging.getLogger(__package__)
|
||||
|
||||
@ -18,7 +18,7 @@ PACKETS_PER_SEC_RECEIVED = "packets_per_sec_received"
|
||||
PACKETS_PER_SEC_SENT = "packets_per_sec_sent"
|
||||
TIMESTAMP = "timestamp"
|
||||
DATA_PACKETS = "packets"
|
||||
DATA_RATE_PACKETS_PER_SECOND = f"{DATA_PACKETS}/{TIME_SECONDS}"
|
||||
DATA_RATE_PACKETS_PER_SECOND = f"{DATA_PACKETS}/{UnitOfTime.SECONDS}"
|
||||
WAN_STATUS = "wan_status"
|
||||
ROUTER_IP = "ip"
|
||||
ROUTER_UPTIME = "uptime"
|
||||
|
@ -10,7 +10,7 @@ from homeassistant.components.sensor import (
|
||||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import TIME_SECONDS, UnitOfDataRate, UnitOfInformation
|
||||
from homeassistant.const import UnitOfDataRate, UnitOfInformation, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
@ -90,7 +90,7 @@ SENSOR_DESCRIPTIONS: tuple[UpnpSensorEntityDescription, ...] = (
|
||||
key=ROUTER_UPTIME,
|
||||
name="Uptime",
|
||||
icon="mdi:server-network",
|
||||
native_unit_of_measurement=TIME_SECONDS,
|
||||
native_unit_of_measurement=UnitOfTime.SECONDS,
|
||||
entity_registry_enabled_default=False,
|
||||
format="d",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
|
@ -17,7 +17,7 @@ from homeassistant.const import (
|
||||
PERCENTAGE,
|
||||
TEMP_CELSIUS,
|
||||
TEMP_FAHRENHEIT,
|
||||
TIME_MINUTES,
|
||||
UnitOfTime,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
@ -207,7 +207,7 @@ SENSOR_ENTITIES: tuple[VenstarSensorEntityDescription, ...] = (
|
||||
RUNTIME_ENTITY = VenstarSensorEntityDescription(
|
||||
key="runtime",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
uom_fn=lambda _: TIME_MINUTES,
|
||||
uom_fn=lambda _: UnitOfTime.MINUTES,
|
||||
value_fn=lambda coordinator, sensor_name: coordinator.runtimes[-1][sensor_name],
|
||||
name_fn=lambda coordinator, sensor_name: f"{coordinator.client.name} {RUNTIME_ATTRIBUTES[sensor_name]} Runtime",
|
||||
)
|
||||
|
@ -11,7 +11,7 @@ import async_timeout
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import TIME_MINUTES
|
||||
from homeassistant.const import UnitOfTime
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
@ -187,5 +187,5 @@ class ViaggiaTrenoSensor(SensorEntity):
|
||||
self._unit = ""
|
||||
else:
|
||||
self._state = res.get("ritardo")
|
||||
self._unit = TIME_MINUTES
|
||||
self._unit = UnitOfTime.MINUTES
|
||||
self._icon = ICON
|
||||
|
@ -16,8 +16,8 @@ from homeassistant.const import (
|
||||
CONF_NAME,
|
||||
CONF_REGION,
|
||||
EVENT_HOMEASSISTANT_STARTED,
|
||||
TIME_MINUTES,
|
||||
UnitOfLength,
|
||||
UnitOfTime,
|
||||
)
|
||||
from homeassistant.core import CoreState, HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntryType
|
||||
@ -74,7 +74,7 @@ class WazeTravelTime(SensorEntity):
|
||||
"""Representation of a Waze travel time sensor."""
|
||||
|
||||
_attr_attribution = "Powered by Waze"
|
||||
_attr_native_unit_of_measurement = TIME_MINUTES
|
||||
_attr_native_unit_of_measurement = UnitOfTime.MINUTES
|
||||
_attr_device_class = SensorDeviceClass.DURATION
|
||||
_attr_state_class = SensorStateClass.MEASUREMENT
|
||||
_attr_device_info = DeviceInfo(
|
||||
|
@ -14,7 +14,7 @@ from homeassistant.components.sensor import (
|
||||
SensorEntityDescription,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_DOMAIN, TIME_DAYS
|
||||
from homeassistant.const import CONF_DOMAIN, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntryType
|
||||
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
|
||||
@ -81,7 +81,7 @@ SENSORS: tuple[WhoisSensorEntityDescription, ...] = (
|
||||
key="days_until_expiration",
|
||||
name="Days until expiration",
|
||||
icon="mdi:calendar-clock",
|
||||
native_unit_of_measurement=TIME_DAYS,
|
||||
native_unit_of_measurement=UnitOfTime.DAYS,
|
||||
value_fn=_days_until_expiration,
|
||||
),
|
||||
WhoisSensorEntityDescription(
|
||||
|
@ -13,7 +13,7 @@ from wolf_smartset.models import (
|
||||
|
||||
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import TEMP_CELSIUS, TIME_HOURS, UnitOfPressure
|
||||
from homeassistant.const import TEMP_CELSIUS, UnitOfPressure, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
@ -100,7 +100,7 @@ class WolfLinkHours(WolfLinkSensor):
|
||||
@property
|
||||
def native_unit_of_measurement(self):
|
||||
"""Return the unit the value is expressed in."""
|
||||
return TIME_HOURS
|
||||
return UnitOfTime.HOURS
|
||||
|
||||
|
||||
class WolfLinkTemperature(WolfLinkSensor):
|
||||
|
@ -10,13 +10,7 @@ import requests
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_NAME,
|
||||
CONF_API_KEY,
|
||||
CONF_ID,
|
||||
CONF_NAME,
|
||||
TIME_MINUTES,
|
||||
)
|
||||
from homeassistant.const import ATTR_NAME, CONF_API_KEY, CONF_ID, CONF_NAME, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
@ -106,7 +100,7 @@ class WashingtonStateTravelTimeSensor(WashingtonStateTransportSensor):
|
||||
"""Travel time sensor from WSDOT."""
|
||||
|
||||
_attr_attribution = ATTRIBUTION
|
||||
_attr_native_unit_of_measurement = TIME_MINUTES
|
||||
_attr_native_unit_of_measurement = UnitOfTime.MINUTES
|
||||
|
||||
def __init__(self, name, access_code, travel_time_id):
|
||||
"""Construct a travel time sensor."""
|
||||
|
@ -12,7 +12,7 @@ from homeassistant.components.number import (
|
||||
NumberEntityDescription,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_MODEL, DEGREE, REVOLUTIONS_PER_MINUTE, TIME_MINUTES
|
||||
from homeassistant.const import CONF_MODEL, DEGREE, REVOLUTIONS_PER_MINUTE, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
@ -193,7 +193,7 @@ NUMBER_TYPES = {
|
||||
key=ATTR_DELAY_OFF_COUNTDOWN,
|
||||
name="Delay off countdown",
|
||||
icon="mdi:fan-off",
|
||||
native_unit_of_measurement=TIME_MINUTES,
|
||||
native_unit_of_measurement=UnitOfTime.MINUTES,
|
||||
native_min_value=0,
|
||||
native_max_value=480,
|
||||
native_step=1,
|
||||
|
@ -96,7 +96,6 @@ from homeassistant.const import (
|
||||
PERCENTAGE,
|
||||
SIGNAL_STRENGTH_DECIBELS,
|
||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||
TIME_SECONDS,
|
||||
VOLUME_FLOW_RATE_CUBIC_FEET_PER_MINUTE,
|
||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR,
|
||||
UnitOfElectricCurrent,
|
||||
@ -110,6 +109,7 @@ from homeassistant.const import (
|
||||
UnitOfPressure,
|
||||
UnitOfSpeed,
|
||||
UnitOfTemperature,
|
||||
UnitOfTime,
|
||||
UnitOfVolume,
|
||||
UnitOfVolumetricFlux,
|
||||
)
|
||||
@ -202,7 +202,7 @@ MULTILEVEL_SENSOR_UNIT_MAP: dict[str, set[MultilevelSensorScaleType]] = {
|
||||
UnitOfMass.POUNDS: UNIT_POUNDS,
|
||||
UnitOfPressure.PSI: UNIT_POUND_PER_SQUARE_INCH,
|
||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT: UNIT_POWER_LEVEL,
|
||||
TIME_SECONDS: UNIT_SECOND,
|
||||
UnitOfTime.SECONDS: UNIT_SECOND,
|
||||
UnitOfPressure.MMHG: UNIT_SYSTOLIC,
|
||||
UnitOfElectricPotential.VOLT: SENSOR_UNIT_VOLT,
|
||||
UnitOfPower.WATT: SENSOR_UNIT_WATT,
|
||||
|
Loading…
x
Reference in New Issue
Block a user