From 44803e117768a5fddb09cdd16efce4126cef20ce Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Sat, 22 Jul 2023 16:55:05 +0200 Subject: [PATCH] Migrate Uptimerobot to has entity name (#96770) --- homeassistant/components/uptimerobot/binary_sensor.py | 1 - homeassistant/components/uptimerobot/entity.py | 2 ++ homeassistant/components/uptimerobot/sensor.py | 1 - homeassistant/components/uptimerobot/switch.py | 1 - tests/components/uptimerobot/common.py | 2 +- 5 files changed, 3 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/uptimerobot/binary_sensor.py b/homeassistant/components/uptimerobot/binary_sensor.py index 248212a8345..a4aeeb3151b 100644 --- a/homeassistant/components/uptimerobot/binary_sensor.py +++ b/homeassistant/components/uptimerobot/binary_sensor.py @@ -27,7 +27,6 @@ async def async_setup_entry( coordinator, BinarySensorEntityDescription( key=str(monitor.id), - name=monitor.friendly_name, device_class=BinarySensorDeviceClass.CONNECTIVITY, ), monitor=monitor, diff --git a/homeassistant/components/uptimerobot/entity.py b/homeassistant/components/uptimerobot/entity.py index 7991525c2a0..d5caf36fa18 100644 --- a/homeassistant/components/uptimerobot/entity.py +++ b/homeassistant/components/uptimerobot/entity.py @@ -15,6 +15,8 @@ class UptimeRobotEntity(CoordinatorEntity[UptimeRobotDataUpdateCoordinator]): """Base UptimeRobot entity.""" _attr_attribution = ATTRIBUTION + _attr_has_entity_name = True + _attr_name = None def __init__( self, diff --git a/homeassistant/components/uptimerobot/sensor.py b/homeassistant/components/uptimerobot/sensor.py index 219dd304dbd..f9d4097fe40 100644 --- a/homeassistant/components/uptimerobot/sensor.py +++ b/homeassistant/components/uptimerobot/sensor.py @@ -46,7 +46,6 @@ async def async_setup_entry( coordinator, SensorEntityDescription( key=str(monitor.id), - name=monitor.friendly_name, entity_category=EntityCategory.DIAGNOSTIC, device_class=SensorDeviceClass.ENUM, options=["down", "not_checked_yet", "pause", "seems_down", "up"], diff --git a/homeassistant/components/uptimerobot/switch.py b/homeassistant/components/uptimerobot/switch.py index 619f72ae47f..397d2085357 100644 --- a/homeassistant/components/uptimerobot/switch.py +++ b/homeassistant/components/uptimerobot/switch.py @@ -29,7 +29,6 @@ async def async_setup_entry( coordinator, SwitchEntityDescription( key=str(monitor.id), - name=f"{monitor.friendly_name} Active", device_class=SwitchDeviceClass.SWITCH, ), monitor=monitor, diff --git a/tests/components/uptimerobot/common.py b/tests/components/uptimerobot/common.py index 6a82d75a9f8..15f6e153b19 100644 --- a/tests/components/uptimerobot/common.py +++ b/tests/components/uptimerobot/common.py @@ -66,7 +66,7 @@ STATE_UP = "up" UPTIMEROBOT_BINARY_SENSOR_TEST_ENTITY = "binary_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):