mirror of
https://github.com/home-assistant/core.git
synced 2025-09-23 11:59:37 +00:00
Use DataRate unit and device class in integrations (#83610)
This commit is contained in:
@@ -3,8 +3,8 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DATA_RATE_MEGABITS_PER_SECOND
|
||||
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||
from homeassistant.const import UnitOfDataRate
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
@@ -13,8 +13,6 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import DATA_UPDATED, DOMAIN as FASTDOTCOM_DOMAIN
|
||||
|
||||
ICON = "mdi:speedometer"
|
||||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
@@ -30,8 +28,9 @@ class SpeedtestSensor(RestoreEntity, SensorEntity):
|
||||
"""Implementation of a FAst.com sensor."""
|
||||
|
||||
_attr_name = "Fast.com Download"
|
||||
_attr_native_unit_of_measurement = DATA_RATE_MEGABITS_PER_SECOND
|
||||
_attr_icon = ICON
|
||||
_attr_device_class = SensorDeviceClass.DATA_RATE
|
||||
_attr_native_unit_of_measurement = UnitOfDataRate.MEGABITS_PER_SECOND
|
||||
_attr_icon = "mdi:speedometer"
|
||||
_attr_should_poll = False
|
||||
_attr_native_value = None
|
||||
|
||||
|
Reference in New Issue
Block a user