Fix unit of measurement for asuswrt sensors (#44009)

pull/44017/head
JJdeVries 2020-12-07 12:46:53 +01:00 committed by GitHub
parent 035860ebb2
commit 84973ec8f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -29,7 +29,7 @@ class _SensorTypes(enum.Enum):
UPLOAD_SPEED = "upload_speed"
@property
def unit(self) -> Optional[str]:
def unit_of_measurement(self) -> Optional[str]:
"""Return a string with the unit of the sensortype."""
if self in (_SensorTypes.UPLOAD, _SensorTypes.DOWNLOAD):
return DATA_GIGABYTES
@ -161,3 +161,8 @@ class AsuswrtSensor(CoordinatorEntity):
def icon(self) -> Optional[str]:
"""Return the icon to use in the frontend."""
return self._type.icon
@property
def unit_of_measurement(self) -> Optional[str]:
"""Return the unit of measurement of this entity, if any."""
return self._type.unit_of_measurement