Add and use bunch of data size and rate related constants (#31781)

Also fix a few units to match the corresponding data.
This commit is contained in:
Ville Skyttä authored and GitHub committed 2020-02-13 08:52:57 -08:00
1 parent 0173c61fee
commit 3e23a3a860
41 files changed
+349 -223

No files matched your search

@@ -1,6 +1,7 @@
"""Support for Fast.com internet speed testing sensor."""
import logging
from homeassistant.const import DATA_RATE_MEGABITS_PER_SECOND
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.restore_state import RestoreEntity
@@ -11,8 +12,6 @@ _LOGGER = logging.getLogger(__name__)
ICON = "mdi:speedometer"
UNIT_OF_MEASUREMENT = "Mbit/s"
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Fast.com sensor."""
@@ -41,7 +40,7 @@ class SpeedtestSensor(RestoreEntity):
@property
def unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
return UNIT_OF_MEASUREMENT
return DATA_RATE_MEGABITS_PER_SECOND
@property
def icon(self):