mirror of
https://github.com/home-assistant/core.git
synced 2026-07-06 22:36:33 +01:00
b96f904d15
Co-authored-by: FIls0010 <a1867444@adelaide.edu.au>
24 lines
715 B
Python
24 lines
715 B
Python
"""Counter for the days until an HTTPS (TLS) certificate will expire."""
|
|
|
|
from typing import Any
|
|
|
|
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
|
|
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,
|
|
}
|