mirror of
https://github.com/home-assistant/core.git
synced 2026-09-09 15:11:40 +01:00
25 lines
739 B
Python
25 lines
739 B
Python
"""Counter for the days until an HTTPS (TLS) certificate will expire."""
|
|
|
|
from typing import Any, override
|
|
|
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
|
|
|
from .coordinator import CertExpiryDataUpdateCoordinator
|
|
|
|
|
|
class CertExpiryEntity(CoordinatorEntity[CertExpiryDataUpdateCoordinator]):
|
|
"""Defines a base Cert Expiry entity."""
|
|
|
|
_attr_has_entity_name = True
|
|
|
|
@property
|
|
@override
|
|
def extra_state_attributes(self) -> dict[str, Any]:
|
|
"""Return additional sensor state attributes."""
|
|
return {
|
|
"is_valid": self.coordinator.is_cert_valid,
|
|
"error": str(self.coordinator.cert_error)
|
|
if self.coordinator.cert_error
|
|
else None,
|
|
}
|