mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
UniFi - Add unit of measurement to bandwidth sensors (#32114)
This commit is contained in:
parent
4cc4f070f5
commit
1007283da5
@ -2,6 +2,7 @@
|
||||
import logging
|
||||
|
||||
from homeassistant.components.unifi.config_flow import get_controller_from_config_entry
|
||||
from homeassistant.const import DATA_BYTES
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
||||
@ -9,9 +10,6 @@ from .unifi_client import UniFiClient
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
ATTR_RECEIVING = "receiving"
|
||||
ATTR_TRANSMITTING = "transmitting"
|
||||
|
||||
|
||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
||||
"""Sensor platform doesn't support configuration through configuration.yaml."""
|
||||
@ -115,6 +113,11 @@ class UniFiRxBandwidthSensor(UniFiClient):
|
||||
"""Return a unique identifier for this bandwidth sensor."""
|
||||
return f"rx-{self.client.mac}"
|
||||
|
||||
@property
|
||||
def unit_of_measurement(self):
|
||||
"""Return the unit of measurement of this entity."""
|
||||
return DATA_BYTES
|
||||
|
||||
|
||||
class UniFiTxBandwidthSensor(UniFiRxBandwidthSensor):
|
||||
"""Transmitting bandwidth sensor."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user