Use HTTPStatus instead of HTTP_ consts and magic values in comp.../[de]* (#57990)

This commit is contained in:
Ville Skyttä
2021-10-22 17:28:56 +03:00
committed by GitHub
parent c84fee7c6e
commit 8bc1509afa
15 changed files with 119 additions and 117 deletions

View File

@@ -1,5 +1,6 @@
"""Support for monitoring emoncms feeds."""
from datetime import timedelta
from http import HTTPStatus
import logging
import requests
@@ -20,7 +21,6 @@ from homeassistant.const import (
CONF_VALUE_TEMPLATE,
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_POWER,
HTTP_OK,
POWER_WATT,
STATE_UNKNOWN,
)
@@ -256,7 +256,7 @@ class EmonCmsData:
_LOGGER.error(exception)
return
else:
if req.status_code == HTTP_OK:
if req.status_code == HTTPStatus.OK:
self.data = req.json()
else:
_LOGGER.error(