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

+4 -3
View File
@@ -19,6 +19,7 @@ from homeassistant.const import (
DATA_GIBIBYTES,
DATA_RATE_MEBIBYTES_PER_SECOND,
TEMP_CELSIUS,
UNIT_PERCENTAGE,
)
from homeassistant.exceptions import PlatformNotReady
import homeassistant.helpers.config_validation as cv
@@ -61,12 +62,12 @@ _SYSTEM_MON_COND = {
}
_CPU_MON_COND = {
"cpu_temp": ["CPU Temperature", TEMP_CELSIUS, "mdi:thermometer"],
"cpu_usage": ["CPU Usage", "%", "mdi:chip"],
"cpu_usage": ["CPU Usage", UNIT_PERCENTAGE, "mdi:chip"],
}
_MEMORY_MON_COND = {
"memory_free": ["Memory Available", DATA_GIBIBYTES, "mdi:memory"],
"memory_used": ["Memory Used", DATA_GIBIBYTES, "mdi:memory"],
"memory_percent_used": ["Memory Usage", "%", "mdi:memory"],
"memory_percent_used": ["Memory Usage", UNIT_PERCENTAGE, "mdi:memory"],
}
_NETWORK_MON_COND = {
"network_link_status": ["Network Link", None, "mdi:checkbox-marked-circle-outline"],
@@ -80,7 +81,7 @@ _DRIVE_MON_COND = {
_VOLUME_MON_COND = {
"volume_size_used": ["Used Space", DATA_GIBIBYTES, "mdi:chart-pie"],
"volume_size_free": ["Free Space", DATA_GIBIBYTES, "mdi:chart-pie"],
"volume_percentage_used": ["Volume Used", "%", "mdi:chart-pie"],
"volume_percentage_used": ["Volume Used", UNIT_PERCENTAGE, "mdi:chart-pie"],
}
_MONITORED_CONDITIONS = (