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

+8 -3
View File
@@ -8,7 +8,12 @@ from smbus import SMBus # pylint: disable=import-error
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_MONITORED_CONDITIONS, CONF_NAME, TEMP_FAHRENHEIT
from homeassistant.const import (
CONF_MONITORED_CONDITIONS,
CONF_NAME,
TEMP_FAHRENHEIT,
UNIT_PERCENTAGE,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.util.temperature import celsius_to_fahrenheit
@@ -50,10 +55,10 @@ SENSOR_GAS = "gas"
SENSOR_AQ = "airquality"
SENSOR_TYPES = {
SENSOR_TEMP: ["Temperature", None],
SENSOR_HUMID: ["Humidity", "%"],
SENSOR_HUMID: ["Humidity", UNIT_PERCENTAGE],
SENSOR_PRESS: ["Pressure", "mb"],
SENSOR_GAS: ["Gas Resistance", "Ohms"],
SENSOR_AQ: ["Air Quality", "%"],
SENSOR_AQ: ["Air Quality", UNIT_PERCENTAGE],
}
DEFAULT_MONITORED = [SENSOR_TEMP, SENSOR_HUMID, SENSOR_PRESS, SENSOR_AQ]
OVERSAMPLING_VALUES = set([0, 1, 2, 4, 8, 16])