Use climate enums in prometheus (#70772)

This commit is contained in:
epenet 2022-04-26 11:43:45 +02:00 committed by GitHub
parent f7d9797c62
commit bdba3e193e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,7 +14,7 @@ from homeassistant.components.climate.const import (
ATTR_HVAC_MODES,
ATTR_TARGET_TEMP_HIGH,
ATTR_TARGET_TEMP_LOW,
CURRENT_HVAC_ACTIONS,
HVACAction,
)
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.humidifier.const import (
@ -438,8 +438,8 @@ class PrometheusMetrics:
"HVAC action",
["action"],
)
for action in CURRENT_HVAC_ACTIONS:
metric.labels(**dict(self._labels(state), action=action)).set(
for action in HVACAction:
metric.labels(**dict(self._labels(state), action=action.value)).set(
float(action == current_action)
)