Add icons to Freebox sensors (#30132)

This commit is contained in:
Quentame 2019-12-23 17:37:41 +01:00 committed by Aaron Bach
parent 4c5801ee8c
commit f72ba0c716

View file

@ -18,6 +18,8 @@ class FbxSensor(Entity):
"""Representation of a freebox sensor."""
_name = "generic"
_unit = None
_icon = None
def __init__(self, fbx):
"""Initialize the sensor."""
@ -30,6 +32,16 @@ class FbxSensor(Entity):
"""Return the name of the sensor."""
return self._name
@property
def unit_of_measurement(self):
"""Return the unit of the sensor."""
return self._unit
@property
def icon(self):
"""Return the icon of the sensor."""
return self._icon
@property
def state(self):
"""Return the state of the sensor."""
@ -45,11 +57,7 @@ class FbxRXSensor(FbxSensor):
_name = "Freebox download speed"
_unit = "KB/s"
@property
def unit_of_measurement(self):
"""Define the unit."""
return self._unit
_icon = "mdi:download-network"
async def async_update(self):
"""Get the value from fetched datas."""
@ -63,11 +71,7 @@ class FbxTXSensor(FbxSensor):
_name = "Freebox upload speed"
_unit = "KB/s"
@property
def unit_of_measurement(self):
"""Define the unit."""
return self._unit
_icon = "mdi:upload-network"
async def async_update(self):
"""Get the value from fetched datas."""