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

@@ -17,6 +17,7 @@ from homeassistant.const import (
EVENT_STATE_CHANGED,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
UNIT_PERCENTAGE,
)
from homeassistant.helpers import entityfilter, state as state_helper
import homeassistant.helpers.config_validation as cv
@@ -349,7 +350,7 @@ class PrometheusMetrics:
units = {
TEMP_CELSIUS: "c",
TEMP_FAHRENHEIT: "c", # F should go into C metric
"%": "percent",
UNIT_PERCENTAGE: "percent",
}
default = unit.replace("/", "_per_")
default = default.lower()