Use new SensorDeviceClass in cert_expiry (#61331)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-09 09:20:56 +01:00 committed by GitHub
parent dfc85fe372
commit fb7bab2a5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,14 +5,13 @@ from datetime import datetime, timedelta
import voluptuous as vol import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity from homeassistant.components.sensor import (
from homeassistant.config_entries import SOURCE_IMPORT PLATFORM_SCHEMA,
from homeassistant.const import ( SensorDeviceClass,
CONF_HOST, SensorEntity,
CONF_PORT,
DEVICE_CLASS_TIMESTAMP,
EVENT_HOMEASSISTANT_START,
) )
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_START
from homeassistant.core import callback from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.event import async_call_later from homeassistant.helpers.event import async_call_later
@ -78,7 +77,7 @@ class CertExpiryEntity(CoordinatorEntity):
class SSLCertificateTimestamp(CertExpiryEntity, SensorEntity): class SSLCertificateTimestamp(CertExpiryEntity, SensorEntity):
"""Implementation of the Cert Expiry timestamp sensor.""" """Implementation of the Cert Expiry timestamp sensor."""
_attr_device_class = DEVICE_CLASS_TIMESTAMP _attr_device_class = SensorDeviceClass.TIMESTAMP
def __init__(self, coordinator) -> None: def __init__(self, coordinator) -> None:
"""Initialize a Cert Expiry timestamp sensor.""" """Initialize a Cert Expiry timestamp sensor."""