Add and use percentage constant (#32094)

* Add and use percentage constant

* Fix pylint error and broken test
This commit is contained in:
springstan authored and GitHub committed 2020-02-28 11:46:48 -08:00
1 parent c7f128f286
commit f1a0ca7cd3
155 files changed
+735 -459

No files matched your search

@@ -8,6 +8,7 @@ from homeassistant.const import (
DEVICE_CLASS_ILLUMINANCE,
DEVICE_CLASS_TEMPERATURE,
TEMP_CELSIUS,
UNIT_PERCENTAGE,
)
from homeassistant.core import callback
@@ -18,7 +19,6 @@ TEMP_C_ICON = "mdi:thermometer"
BRIGHTNESS_ICON = "mdi:brightness-6"
CO2_ICON = "mdi:periodic-table-co2"
UNIT_PERCENT = "%"
UNIT_LUX = "lux"
@@ -52,7 +52,7 @@ class HomeKitHumiditySensor(HomeKitEntity):
@property
def unit_of_measurement(self):
"""Return units for the sensor."""
return UNIT_PERCENT
return UNIT_PERCENTAGE
def _update_relative_humidity_current(self, value):
self._state = value
@@ -234,7 +234,7 @@ class HomeKitBatterySensor(HomeKitEntity):
@property
def unit_of_measurement(self):
"""Return units for the sensor."""
return UNIT_PERCENT
return UNIT_PERCENTAGE
def _update_battery_level(self, value):
self._state = value