Migrate APCUPSD to has entity name (#112997)

* Properly set entity names for APCUPSD

* Add test cases to prevent future regressions

* Fix tests due to the updated entity IDs

* Prettify code

* Remove redundant translation key
This commit is contained in:
Yuxin Wang
2024-03-10 18:56:25 -04:00
committed by GitHub
parent b125a6b1bb
commit db31afe019
6 changed files with 344 additions and 108 deletions

View File

@@ -20,7 +20,6 @@ from .coordinator import APCUPSdCoordinator
_LOGGER = logging.getLogger(__name__)
_DESCRIPTION = BinarySensorEntityDescription(
key="statflag",
name="UPS Online Status",
translation_key="online_status",
)
# The bit in STATFLAG that indicates the online status of the APC UPS.
@@ -46,6 +45,8 @@ async def async_setup_entry(
class OnlineStatus(CoordinatorEntity[APCUPSdCoordinator], BinarySensorEntity):
"""Representation of a UPS online status."""
_attr_has_entity_name = True
def __init__(
self,
coordinator: APCUPSdCoordinator,