Add icons for upload/download sensors for asuswrt (#35581)

This commit is contained in:
Boris Kaplounovsky 2020-05-15 00:06:33 +03:00 committed by GitHub
parent d0d9b4df78
commit 37cabe5562
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,9 @@ from . import DATA_ASUSWRT
_LOGGER = logging.getLogger(__name__)
UPLOAD_ICON = "mdi:upload-network"
DOWNLOAD_ICON = "mdi:download-network"
async def async_setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the asuswrt sensors."""
@ -82,6 +85,11 @@ class AsuswrtRXSensor(AsuswrtSensor):
_name = "Asuswrt Download Speed"
_unit = DATA_RATE_MEGABITS_PER_SECOND
@property
def icon(self):
"""Return the icon."""
return DOWNLOAD_ICON
@property
def unit_of_measurement(self):
"""Return the unit of measurement."""
@ -100,6 +108,11 @@ class AsuswrtTXSensor(AsuswrtSensor):
_name = "Asuswrt Upload Speed"
_unit = DATA_RATE_MEGABITS_PER_SECOND
@property
def icon(self):
"""Return the icon."""
return UPLOAD_ICON
@property
def unit_of_measurement(self):
"""Return the unit of measurement."""
@ -118,6 +131,11 @@ class AsuswrtTotalRXSensor(AsuswrtSensor):
_name = "Asuswrt Download"
_unit = DATA_GIGABYTES
@property
def icon(self):
"""Return the icon."""
return DOWNLOAD_ICON
@property
def unit_of_measurement(self):
"""Return the unit of measurement."""
@ -136,6 +154,11 @@ class AsuswrtTotalTXSensor(AsuswrtSensor):
_name = "Asuswrt Upload"
_unit = DATA_GIGABYTES
@property
def icon(self):
"""Return the icon."""
return UPLOAD_ICON
@property
def unit_of_measurement(self):
"""Return the unit of measurement."""