Fix Goalzero time to empty sensor device class (#83389)

* Fix Goalzero time to empty sensor device class

* Fix tests
pull/83482/head
Franck Nijhof 2022-12-06 12:14:15 +01:00 committed by Paulus Schoutsen
parent 3a7efddb4b
commit 048553cd02
2 changed files with 2 additions and 2 deletions

View File

@ -91,7 +91,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription(
key="timeToEmptyFull",
name="Time to empty/full",
device_class=TIME_MINUTES,
device_class=SensorDeviceClass.DURATION,
native_unit_of_measurement=TIME_MINUTES,
),
SensorEntityDescription(

View File

@ -77,7 +77,7 @@ async def test_sensors(
assert state.attributes.get(ATTR_STATE_CLASS) is None
state = hass.states.get(f"sensor.{DEFAULT_NAME}_time_to_empty_full")
assert state.state == "-1"
assert state.attributes.get(ATTR_DEVICE_CLASS) == TIME_MINUTES
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.DURATION
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == TIME_MINUTES
assert state.attributes.get(ATTR_STATE_CLASS) is None
state = hass.states.get(f"sensor.{DEFAULT_NAME}_temperature")