Replace LASTSTEST with LAST_S_TEST (#124668)

This commit is contained in:
Yuxin Wang 2024-08-27 00:50:15 -04:00 committed by GitHub
parent 51fd8e1288
commit 74a12bb802
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -6,4 +6,4 @@ DOMAIN: Final = "apcupsd"
CONNECTION_TIMEOUT: int = 10 CONNECTION_TIMEOUT: int = 10
# Field name of last self test retrieved from apcupsd. # Field name of last self test retrieved from apcupsd.
LASTSTEST: Final = "laststest" LAST_S_TEST: Final = "laststest"

View File

@ -25,7 +25,7 @@ from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import DOMAIN, LASTSTEST from .const import DOMAIN, LAST_S_TEST
from .coordinator import APCUPSdCoordinator from .coordinator import APCUPSdCoordinator
PARALLEL_UPDATES = 0 PARALLEL_UPDATES = 0
@ -156,8 +156,8 @@ SENSORS: dict[str, SensorEntityDescription] = {
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
LASTSTEST: SensorEntityDescription( LAST_S_TEST: SensorEntityDescription(
key=LASTSTEST, key=LAST_S_TEST,
translation_key="last_self_test", translation_key="last_self_test",
), ),
"lastxfer": SensorEntityDescription( "lastxfer": SensorEntityDescription(
@ -422,7 +422,7 @@ async def async_setup_entry(
# periodical (or manual) self test since last daemon restart. It might not be available # periodical (or manual) self test since last daemon restart. It might not be available
# when we set up the integration, and we do not know if it would ever be available. Here we # when we set up the integration, and we do not know if it would ever be available. Here we
# add it anyway and mark it as unknown initially. # add it anyway and mark it as unknown initially.
for resource in available_resources | {LASTSTEST}: for resource in available_resources | {LAST_S_TEST}:
if resource not in SENSORS: if resource not in SENSORS:
_LOGGER.warning("Invalid resource from APCUPSd: %s", resource.upper()) _LOGGER.warning("Invalid resource from APCUPSd: %s", resource.upper())
continue continue