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
@@ -12,6 +12,7 @@ from homeassistant.const import (
|
||||
TEMP_CELSIUS,
|
||||
TIME_MINUTES,
|
||||
TIME_SECONDS,
|
||||
UNIT_PERCENTAGE,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
@@ -28,7 +29,7 @@ SENSOR_TYPES = {
|
||||
"battdate": ["Battery Replaced", "", "mdi:calendar-clock"],
|
||||
"battstat": ["Battery Status", "", "mdi:information-outline"],
|
||||
"battv": ["Battery Voltage", "V", "mdi:flash"],
|
||||
"bcharge": ["Battery", "%", "mdi:battery"],
|
||||
"bcharge": ["Battery", UNIT_PERCENTAGE, "mdi:battery"],
|
||||
"cable": ["Cable Type", "", "mdi:ethernet-cable"],
|
||||
"cumonbatt": ["Total Time on Battery", "", "mdi:timer"],
|
||||
"date": ["Status Date", "", "mdi:calendar-clock"],
|
||||
@@ -42,20 +43,20 @@ SENSOR_TYPES = {
|
||||
"firmware": ["Firmware Version", "", "mdi:information-outline"],
|
||||
"hitrans": ["Transfer High", "V", "mdi:flash"],
|
||||
"hostname": ["Hostname", "", "mdi:information-outline"],
|
||||
"humidity": ["Ambient Humidity", "%", "mdi:water-percent"],
|
||||
"humidity": ["Ambient Humidity", UNIT_PERCENTAGE, "mdi:water-percent"],
|
||||
"itemp": ["Internal Temperature", TEMP_CELSIUS, "mdi:thermometer"],
|
||||
"lastxfer": ["Last Transfer", "", "mdi:transfer"],
|
||||
"linefail": ["Input Voltage Status", "", "mdi:information-outline"],
|
||||
"linefreq": ["Line Frequency", "Hz", "mdi:information-outline"],
|
||||
"linev": ["Input Voltage", "V", "mdi:flash"],
|
||||
"loadpct": ["Load", "%", "mdi:gauge"],
|
||||
"loadapnt": ["Load Apparent Power", "%", "mdi:gauge"],
|
||||
"loadpct": ["Load", UNIT_PERCENTAGE, "mdi:gauge"],
|
||||
"loadapnt": ["Load Apparent Power", UNIT_PERCENTAGE, "mdi:gauge"],
|
||||
"lotrans": ["Transfer Low", "V", "mdi:flash"],
|
||||
"mandate": ["Manufacture Date", "", "mdi:calendar"],
|
||||
"masterupd": ["Master Update", "", "mdi:information-outline"],
|
||||
"maxlinev": ["Input Voltage High", "V", "mdi:flash"],
|
||||
"maxtime": ["Battery Timeout", "", "mdi:timer-off"],
|
||||
"mbattchg": ["Battery Shutdown", "%", "mdi:battery-alert"],
|
||||
"mbattchg": ["Battery Shutdown", UNIT_PERCENTAGE, "mdi:battery-alert"],
|
||||
"minlinev": ["Input Voltage Low", "V", "mdi:flash"],
|
||||
"mintimel": ["Shutdown Time", "", "mdi:timer"],
|
||||
"model": ["Model", "", "mdi:information-outline"],
|
||||
@@ -70,7 +71,7 @@ SENSOR_TYPES = {
|
||||
"reg1": ["Register 1 Fault", "", "mdi:information-outline"],
|
||||
"reg2": ["Register 2 Fault", "", "mdi:information-outline"],
|
||||
"reg3": ["Register 3 Fault", "", "mdi:information-outline"],
|
||||
"retpct": ["Restore Requirement", "%", "mdi:battery-alert"],
|
||||
"retpct": ["Restore Requirement", UNIT_PERCENTAGE, "mdi:battery-alert"],
|
||||
"selftest": ["Last Self Test", "", "mdi:calendar-clock"],
|
||||
"sense": ["Sensitivity", "", "mdi:information-outline"],
|
||||
"serialno": ["Serial Number", "", "mdi:information-outline"],
|
||||
@@ -92,14 +93,14 @@ SPECIFIC_UNITS = {"ITEMP": TEMP_CELSIUS}
|
||||
INFERRED_UNITS = {
|
||||
" Minutes": TIME_MINUTES,
|
||||
" Seconds": TIME_SECONDS,
|
||||
" Percent": "%",
|
||||
" Percent": UNIT_PERCENTAGE,
|
||||
" Volts": "V",
|
||||
" Ampere": "A",
|
||||
" Volt-Ampere": "VA",
|
||||
" Watts": POWER_WATT,
|
||||
" Hz": "Hz",
|
||||
" C": TEMP_CELSIUS,
|
||||
" Percent Load Capacity": "%",
|
||||
" Percent Load Capacity": UNIT_PERCENTAGE,
|
||||
}
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
|
||||
Reference in new issue
Block a user