Migrate Uptimerobot to has entity name (#96770)

This commit is contained in:
Joost Lekkerkerker 2023-07-22 16:55:05 +02:00 committed by GitHub
parent 13fd5a59e3
commit 44803e1177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 3 additions and 4 deletions

View File

@ -27,7 +27,6 @@ async def async_setup_entry(
coordinator, coordinator,
BinarySensorEntityDescription( BinarySensorEntityDescription(
key=str(monitor.id), key=str(monitor.id),
name=monitor.friendly_name,
device_class=BinarySensorDeviceClass.CONNECTIVITY, device_class=BinarySensorDeviceClass.CONNECTIVITY,
), ),
monitor=monitor, monitor=monitor,

View File

@ -15,6 +15,8 @@ class UptimeRobotEntity(CoordinatorEntity[UptimeRobotDataUpdateCoordinator]):
"""Base UptimeRobot entity.""" """Base UptimeRobot entity."""
_attr_attribution = ATTRIBUTION _attr_attribution = ATTRIBUTION
_attr_has_entity_name = True
_attr_name = None
def __init__( def __init__(
self, self,

View File

@ -46,7 +46,6 @@ async def async_setup_entry(
coordinator, coordinator,
SensorEntityDescription( SensorEntityDescription(
key=str(monitor.id), key=str(monitor.id),
name=monitor.friendly_name,
entity_category=EntityCategory.DIAGNOSTIC, entity_category=EntityCategory.DIAGNOSTIC,
device_class=SensorDeviceClass.ENUM, device_class=SensorDeviceClass.ENUM,
options=["down", "not_checked_yet", "pause", "seems_down", "up"], options=["down", "not_checked_yet", "pause", "seems_down", "up"],

View File

@ -29,7 +29,6 @@ async def async_setup_entry(
coordinator, coordinator,
SwitchEntityDescription( SwitchEntityDescription(
key=str(monitor.id), key=str(monitor.id),
name=f"{monitor.friendly_name} Active",
device_class=SwitchDeviceClass.SWITCH, device_class=SwitchDeviceClass.SWITCH,
), ),
monitor=monitor, monitor=monitor,

View File

@ -66,7 +66,7 @@ STATE_UP = "up"
UPTIMEROBOT_BINARY_SENSOR_TEST_ENTITY = "binary_sensor.test_monitor" UPTIMEROBOT_BINARY_SENSOR_TEST_ENTITY = "binary_sensor.test_monitor"
UPTIMEROBOT_SENSOR_TEST_ENTITY = "sensor.test_monitor" UPTIMEROBOT_SENSOR_TEST_ENTITY = "sensor.test_monitor"
UPTIMEROBOT_SWITCH_TEST_ENTITY = "switch.test_monitor_active" UPTIMEROBOT_SWITCH_TEST_ENTITY = "switch.test_monitor"
class MockApiResponseKey(str, Enum): class MockApiResponseKey(str, Enum):