Skip to content
Snippets Groups Projects
Unverified Commit 490dd3b5 authored by victorclaessen's avatar victorclaessen Committed by GitHub
Browse files

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
parent 71159c75
No related branches found
No related tags found
No related merge requests found
......@@ -159,7 +159,7 @@ class NumberDeviceClass(StrEnum):
DURATION = "duration"
"""Fixed duration.
Unit of measurement: `d`, `h`, `min`, `s`, `ms`
Unit of measurement: `d`, `h`, `min`, `s`, `ms`, `µs`
"""
ENERGY = "energy"
......@@ -462,6 +462,7 @@ DEVICE_CLASS_UNITS: dict[NumberDeviceClass, set[type[StrEnum] | str | None]] = {
UnitOfTime.MINUTES,
UnitOfTime.SECONDS,
UnitOfTime.MILLISECONDS,
UnitOfTime.MICROSECONDS,
},
NumberDeviceClass.ENERGY: set(UnitOfEnergy),
NumberDeviceClass.ENERGY_DISTANCE: set(UnitOfEnergyDistance),
......
......@@ -186,7 +186,7 @@ class SensorDeviceClass(StrEnum):
DURATION = "duration"
"""Fixed duration.
Unit of measurement: `d`, `h`, `min`, `s`, `ms`
Unit of measurement: `d`, `h`, `min`, `s`, `ms`, `µs`
"""
ENERGY = "energy"
......@@ -558,6 +558,7 @@ DEVICE_CLASS_UNITS: dict[SensorDeviceClass, set[type[StrEnum] | str | None]] = {
UnitOfTime.MINUTES,
UnitOfTime.SECONDS,
UnitOfTime.MILLISECONDS,
UnitOfTime.MICROSECONDS,
},
SensorDeviceClass.ENERGY: set(UnitOfEnergy),
SensorDeviceClass.ENERGY_DISTANCE: set(UnitOfEnergyDistance),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment