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
@@ -13,6 +13,7 @@ from homeassistant.const import (
|
||||
CONF_NAME,
|
||||
CONF_PORT,
|
||||
CONF_RESOURCES,
|
||||
UNIT_PERCENTAGE,
|
||||
)
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
@@ -78,7 +79,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
try:
|
||||
resource_data = netdata.api.metrics[sensor]
|
||||
unit = (
|
||||
"%"
|
||||
UNIT_PERCENTAGE
|
||||
if resource_data["units"] == "percentage"
|
||||
else resource_data["units"]
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user