From 5251c1b934c5a01f762e842e5873777e0900cdf3 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 20 Dec 2021 17:16:20 +0100 Subject: [PATCH] Use new enums in speedtestdotnet (#62405) Co-authored-by: epenet --- homeassistant/components/speedtestdotnet/const.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/speedtestdotnet/const.py b/homeassistant/components/speedtestdotnet/const.py index caed1f408ba..735c656134b 100644 --- a/homeassistant/components/speedtestdotnet/const.py +++ b/homeassistant/components/speedtestdotnet/const.py @@ -5,10 +5,7 @@ from collections.abc import Callable from dataclasses import dataclass from typing import Final -from homeassistant.components.sensor import ( - STATE_CLASS_MEASUREMENT, - SensorEntityDescription, -) +from homeassistant.components.sensor import SensorEntityDescription, SensorStateClass from homeassistant.const import ( DATA_RATE_MEGABITS_PER_SECOND, TIME_MILLISECONDS, @@ -32,20 +29,20 @@ SENSOR_TYPES: Final[tuple[SpeedtestSensorEntityDescription, ...]] = ( key="ping", name="Ping", native_unit_of_measurement=TIME_MILLISECONDS, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), SpeedtestSensorEntityDescription( key="download", name="Download", native_unit_of_measurement=DATA_RATE_MEGABITS_PER_SECOND, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, value=lambda value: round(value / 10 ** 6, 2), ), SpeedtestSensorEntityDescription( key="upload", name="Upload", native_unit_of_measurement=DATA_RATE_MEGABITS_PER_SECOND, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, value=lambda value: round(value / 10 ** 6, 2), ), )