From c2209111b29e34ddad5b8dd8bf2b1aa42008d792 Mon Sep 17 00:00:00 2001 From: Robert Hillis Date: Sun, 25 Sep 2022 19:26:50 -0400 Subject: [PATCH] Migrate Radarr to new entity naming style (#79042) Move Radarr to new naming scheme --- homeassistant/components/radarr/__init__.py | 2 +- tests/components/radarr/test_binary_sensor.py | 2 +- tests/components/radarr/test_sensor.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/radarr/__init__.py b/homeassistant/components/radarr/__init__.py index a36929d7435..c590a419c78 100644 --- a/homeassistant/components/radarr/__init__.py +++ b/homeassistant/components/radarr/__init__.py @@ -98,6 +98,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: class RadarrEntity(CoordinatorEntity[RadarrDataUpdateCoordinator]): """Defines a base Radarr entity.""" + _attr_has_entity_name = True coordinator: RadarrDataUpdateCoordinator def __init__( @@ -108,7 +109,6 @@ class RadarrEntity(CoordinatorEntity[RadarrDataUpdateCoordinator]): """Create Radarr entity.""" super().__init__(coordinator) self.entity_description = description - self._attr_name = f"{DEFAULT_NAME} {description.name}" self._attr_unique_id = f"{coordinator.config_entry.entry_id}_{description.key}" @property diff --git a/tests/components/radarr/test_binary_sensor.py b/tests/components/radarr/test_binary_sensor.py index e53f7c33163..ed82c795b8a 100644 --- a/tests/components/radarr/test_binary_sensor.py +++ b/tests/components/radarr/test_binary_sensor.py @@ -12,6 +12,6 @@ async def test_binary_sensors(hass: HomeAssistant, aioclient_mock: AiohttpClient """Test for binary sensor values.""" await setup_integration(hass, aioclient_mock) - state = hass.states.get("binary_sensor.radarr_health") + state = hass.states.get("binary_sensor.mock_title_health") assert state.state == STATE_ON assert state.attributes.get(ATTR_DEVICE_CLASS) == BinarySensorDeviceClass.PROBLEM diff --git a/tests/components/radarr/test_sensor.py b/tests/components/radarr/test_sensor.py index a4caaaa6a54..9b330bdd8f3 100644 --- a/tests/components/radarr/test_sensor.py +++ b/tests/components/radarr/test_sensor.py @@ -18,13 +18,13 @@ async def test_sensors( """Test for successfully setting up the Radarr platform.""" await setup_integration(hass, aioclient_mock) - state = hass.states.get("sensor.radarr_disk_space_downloads") + state = hass.states.get("sensor.mock_title_disk_space_downloads") assert state.state == "263.10" assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "GB" - state = hass.states.get("sensor.radarr_movies") + state = hass.states.get("sensor.mock_title_movies") assert state.state == "1" assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "Movies" - state = hass.states.get("sensor.radarr_start_time") + state = hass.states.get("sensor.mock_title_start_time") assert state.state == "2020-09-01T23:50:20+00:00" assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TIMESTAMP @@ -33,5 +33,5 @@ async def test_windows(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker) """Test for successfully setting up the Radarr platform on Windows.""" await setup_integration(hass, aioclient_mock, windows=True) - state = hass.states.get("sensor.radarr_disk_space_tv") + state = hass.states.get("sensor.mock_title_disk_space_tv") assert state.state == "263.10"