Add and use percentage constant (#32094)
* Add and use percentage constant * Fix pylint error and broken test
This commit is contained in:
1 parent
c7f128f286
commit
f1a0ca7cd3
155 files changed
+735
-459
No files matched your search
@@ -6,7 +6,7 @@ from pysyncthru import SyncThru
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_RESOURCE
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_RESOURCE, UNIT_PERCENTAGE
|
||||
from homeassistant.helpers import aiohttp_client
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
@@ -174,7 +174,7 @@ class SyncThruTonerSensor(SyncThruSensor):
|
||||
super().__init__(syncthru, name)
|
||||
self._name = f"{name} Toner {color}"
|
||||
self._color = color
|
||||
self._unit_of_measurement = "%"
|
||||
self._unit_of_measurement = UNIT_PERCENTAGE
|
||||
self._id_suffix = f"_toner_{color}"
|
||||
|
||||
def update(self):
|
||||
@@ -194,7 +194,7 @@ class SyncThruDrumSensor(SyncThruSensor):
|
||||
super().__init__(syncthru, name)
|
||||
self._name = f"{name} Drum {color}"
|
||||
self._color = color
|
||||
self._unit_of_measurement = "%"
|
||||
self._unit_of_measurement = UNIT_PERCENTAGE
|
||||
self._id_suffix = f"_drum_{color}"
|
||||
|
||||
def update(self):
|
||||
|
||||
Reference in new issue
Block a user