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

+15 -4
View File
@@ -2,7 +2,12 @@
from datetime import timedelta
import logging
from homeassistant.const import ENERGY_KILO_WATT_HOUR, POWER_WATT, VOLUME_CUBIC_METERS
from homeassistant.const import (
ENERGY_KILO_WATT_HOUR,
POWER_WATT,
UNIT_PERCENTAGE,
VOLUME_CUBIC_METERS,
)
from homeassistant.helpers.entity import Entity
from . import DATA_SMAPPEE
@@ -21,7 +26,13 @@ SENSOR_TYPES = {
],
"current": ["Current", "mdi:gauge", "local", "A", "current"],
"voltage": ["Voltage", "mdi:gauge", "local", "V", "voltage"],
"active_cosfi": ["Power Factor", "mdi:gauge", "local", "%", "active_cosfi"],
"active_cosfi": [
"Power Factor",
"mdi:gauge",
"local",
UNIT_PERCENTAGE,
"active_cosfi",
],
"alwayson_today": [
"Always On Today",
"mdi:gauge",
@@ -68,14 +79,14 @@ SENSOR_TYPES = {
"Water Sensor Humidity",
"mdi:water-percent",
"water",
"%",
UNIT_PERCENTAGE,
"humidity",
],
"water_sensor_battery": [
"Water Sensor Battery",
"mdi:battery",
"water",
"%",
UNIT_PERCENTAGE,
"battery",
],
}