Add DurationConverter (#108865)

* Add DurationConverter

* Update withings snapshots

* Add sensor test

* Fix tests

* Update snapshots after #108902 was merged
This commit is contained in:
Robert Resch 2024-01-30 23:08:12 +01:00 committed by GitHub
parent e7d5ae7ef6
commit b409933d19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 141 additions and 22 deletions

View file

@ -37,6 +37,7 @@ from homeassistant.const import (
UnitOfPressure,
UnitOfSpeed,
UnitOfTemperature,
UnitOfTime,
UnitOfVolume,
UnitOfVolumeFlowRate,
UnitOfVolumetricFlux,
@ -599,6 +600,22 @@ async def test_restore_sensor_restore_state(
13.0,
"49.2",
),
(
SensorDeviceClass.DURATION,
UnitOfTime.SECONDS,
UnitOfTime.HOURS,
UnitOfTime.HOURS,
5400.0,
"1.5000",
),
(
SensorDeviceClass.DURATION,
UnitOfTime.DAYS,
UnitOfTime.MINUTES,
UnitOfTime.MINUTES,
0.5,
"720.0",
),
],
)
async def test_custom_unit(