Add and use percentage constant (#32094)

* Add and use percentage constant

* Fix pylint error and broken test
This commit is contained in:
springstan 2020-02-28 20:46:48 +01:00 committed by GitHub
parent c7f128f286
commit f1a0ca7cd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
155 changed files with 735 additions and 459 deletions

View file

@ -19,6 +19,7 @@ from homeassistant.const import (
STATE_UNKNOWN,
TEMP_CELSIUS,
TIME_SECONDS,
UNIT_PERCENTAGE,
)
from homeassistant.exceptions import PlatformNotReady
import homeassistant.helpers.config_validation as cv
@ -51,8 +52,8 @@ SENSOR_TYPES = {
"ups.firmware": ["Firmware Version", "", "mdi:information-outline"],
"ups.firmware.aux": ["Firmware Version 2", "", "mdi:information-outline"],
"ups.temperature": ["UPS Temperature", TEMP_CELSIUS, "mdi:thermometer"],
"ups.load": ["Load", "%", "mdi:gauge"],
"ups.load.high": ["Overload Setting", "%", "mdi:gauge"],
"ups.load": ["Load", UNIT_PERCENTAGE, "mdi:gauge"],
"ups.load.high": ["Overload Setting", UNIT_PERCENTAGE, "mdi:gauge"],
"ups.id": ["System identifier", "", "mdi:information-outline"],
"ups.delay.start": ["Load Restart Delay", TIME_SECONDS, "mdi:timer"],
"ups.delay.reboot": ["UPS Reboot Delay", TIME_SECONDS, "mdi:timer"],
@ -65,7 +66,7 @@ SENSOR_TYPES = {
"ups.test.date": ["Self-Test Date", "", "mdi:calendar"],
"ups.display.language": ["Language", "", "mdi:information-outline"],
"ups.contacts": ["External Contacts", "", "mdi:information-outline"],
"ups.efficiency": ["Efficiency", "%", "mdi:gauge"],
"ups.efficiency": ["Efficiency", UNIT_PERCENTAGE, "mdi:gauge"],
"ups.power": ["Current Apparent Power", "VA", "mdi:flash"],
"ups.power.nominal": ["Nominal Power", "VA", "mdi:flash"],
"ups.realpower": ["Current Real Power", POWER_WATT, "mdi:flash"],
@ -77,10 +78,18 @@ SENSOR_TYPES = {
"ups.start.battery": ["Start on Battery", "", "mdi:information-outline"],
"ups.start.reboot": ["Reboot on Battery", "", "mdi:information-outline"],
"ups.shutdown": ["Shutdown Ability", "", "mdi:information-outline"],
"battery.charge": ["Battery Charge", "%", "mdi:gauge"],
"battery.charge.low": ["Low Battery Setpoint", "%", "mdi:gauge"],
"battery.charge.restart": ["Minimum Battery to Start", "%", "mdi:gauge"],
"battery.charge.warning": ["Warning Battery Setpoint", "%", "mdi:gauge"],
"battery.charge": ["Battery Charge", UNIT_PERCENTAGE, "mdi:gauge"],
"battery.charge.low": ["Low Battery Setpoint", UNIT_PERCENTAGE, "mdi:gauge"],
"battery.charge.restart": [
"Minimum Battery to Start",
UNIT_PERCENTAGE,
"mdi:gauge",
],
"battery.charge.warning": [
"Warning Battery Setpoint",
UNIT_PERCENTAGE,
"mdi:gauge",
],
"battery.charger.status": ["Charging Status", "", "mdi:information-outline"],
"battery.voltage": ["Battery Voltage", "V", "mdi:flash"],
"battery.voltage.nominal": ["Nominal Battery Voltage", "V", "mdi:flash"],