mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 06:37:52 +00:00
Add microseconds as unit for device class duration (#140307)
* Add microseconds as unit for device class duration. Add microseconds as unit for device class duration. The converter already supports it. * Update const.py Also update number component
This commit is contained in:
parent
71159c755f
commit
490dd3b525
@ -159,7 +159,7 @@ class NumberDeviceClass(StrEnum):
|
|||||||
DURATION = "duration"
|
DURATION = "duration"
|
||||||
"""Fixed duration.
|
"""Fixed duration.
|
||||||
|
|
||||||
Unit of measurement: `d`, `h`, `min`, `s`, `ms`
|
Unit of measurement: `d`, `h`, `min`, `s`, `ms`, `µs`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ENERGY = "energy"
|
ENERGY = "energy"
|
||||||
@ -462,6 +462,7 @@ DEVICE_CLASS_UNITS: dict[NumberDeviceClass, set[type[StrEnum] | str | None]] = {
|
|||||||
UnitOfTime.MINUTES,
|
UnitOfTime.MINUTES,
|
||||||
UnitOfTime.SECONDS,
|
UnitOfTime.SECONDS,
|
||||||
UnitOfTime.MILLISECONDS,
|
UnitOfTime.MILLISECONDS,
|
||||||
|
UnitOfTime.MICROSECONDS,
|
||||||
},
|
},
|
||||||
NumberDeviceClass.ENERGY: set(UnitOfEnergy),
|
NumberDeviceClass.ENERGY: set(UnitOfEnergy),
|
||||||
NumberDeviceClass.ENERGY_DISTANCE: set(UnitOfEnergyDistance),
|
NumberDeviceClass.ENERGY_DISTANCE: set(UnitOfEnergyDistance),
|
||||||
|
@ -186,7 +186,7 @@ class SensorDeviceClass(StrEnum):
|
|||||||
DURATION = "duration"
|
DURATION = "duration"
|
||||||
"""Fixed duration.
|
"""Fixed duration.
|
||||||
|
|
||||||
Unit of measurement: `d`, `h`, `min`, `s`, `ms`
|
Unit of measurement: `d`, `h`, `min`, `s`, `ms`, `µs`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ENERGY = "energy"
|
ENERGY = "energy"
|
||||||
@ -558,6 +558,7 @@ DEVICE_CLASS_UNITS: dict[SensorDeviceClass, set[type[StrEnum] | str | None]] = {
|
|||||||
UnitOfTime.MINUTES,
|
UnitOfTime.MINUTES,
|
||||||
UnitOfTime.SECONDS,
|
UnitOfTime.SECONDS,
|
||||||
UnitOfTime.MILLISECONDS,
|
UnitOfTime.MILLISECONDS,
|
||||||
|
UnitOfTime.MICROSECONDS,
|
||||||
},
|
},
|
||||||
SensorDeviceClass.ENERGY: set(UnitOfEnergy),
|
SensorDeviceClass.ENERGY: set(UnitOfEnergy),
|
||||||
SensorDeviceClass.ENERGY_DISTANCE: set(UnitOfEnergyDistance),
|
SensorDeviceClass.ENERGY_DISTANCE: set(UnitOfEnergyDistance),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user