diff --git a/homeassistant/components/prometheus/__init__.py b/homeassistant/components/prometheus/__init__.py index e17ae1190a4..86163704797 100644 --- a/homeassistant/components/prometheus/__init__.py +++ b/homeassistant/components/prometheus/__init__.py @@ -21,7 +21,10 @@ from homeassistant.components.climate import ( ATTR_TARGET_TEMP_LOW, HVACAction, ) -from homeassistant.components.cover import ATTR_POSITION, ATTR_TILT_POSITION +from homeassistant.components.cover import ( + ATTR_CURRENT_POSITION, + ATTR_CURRENT_TILT_POSITION, +) from homeassistant.components.http import HomeAssistantView from homeassistant.components.humidifier import ATTR_AVAILABLE_MODES, ATTR_HUMIDITY from homeassistant.components.light import ATTR_BRIGHTNESS @@ -437,7 +440,7 @@ class PrometheusMetrics: float(cover_state == state.state) ) - position = state.attributes.get(ATTR_POSITION) + position = state.attributes.get(ATTR_CURRENT_POSITION) if position is not None: position_metric = self._metric( "cover_position", @@ -446,7 +449,7 @@ class PrometheusMetrics: ) position_metric.labels(**self._labels(state)).set(float(position)) - tilt_position = state.attributes.get(ATTR_TILT_POSITION) + tilt_position = state.attributes.get(ATTR_CURRENT_TILT_POSITION) if tilt_position is not None: tilt_position_metric = self._metric( "cover_tilt_position", diff --git a/tests/components/prometheus/test_init.py b/tests/components/prometheus/test_init.py index af2f2ba5784..7ee534f91ce 100644 --- a/tests/components/prometheus/test_init.py +++ b/tests/components/prometheus/test_init.py @@ -1352,7 +1352,7 @@ async def cover_fixture( suggested_object_id="position_shade", original_name="Position Shade", ) - cover_position_attributes = {cover.ATTR_POSITION: 50} + cover_position_attributes = {cover.ATTR_CURRENT_POSITION: 50} set_state_with_entry(hass, cover_position, STATE_OPEN, cover_position_attributes) data["cover_position"] = cover_position @@ -1363,7 +1363,7 @@ async def cover_fixture( suggested_object_id="tilt_position_shade", original_name="Tilt Position Shade", ) - cover_tilt_position_attributes = {cover.ATTR_TILT_POSITION: 50} + cover_tilt_position_attributes = {cover.ATTR_CURRENT_TILT_POSITION: 50} set_state_with_entry( hass, cover_tilt_position, STATE_OPEN, cover_tilt_position_attributes )