Migrate Radarr to new entity naming style (#79042)
Move Radarr to new naming scheme
This commit is contained in:
parent
917cf674de
commit
c2209111b2
3 changed files with 6 additions and 6 deletions
|
@ -98,6 +98,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
class RadarrEntity(CoordinatorEntity[RadarrDataUpdateCoordinator]):
|
class RadarrEntity(CoordinatorEntity[RadarrDataUpdateCoordinator]):
|
||||||
"""Defines a base Radarr entity."""
|
"""Defines a base Radarr entity."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
coordinator: RadarrDataUpdateCoordinator
|
coordinator: RadarrDataUpdateCoordinator
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -108,7 +109,6 @@ class RadarrEntity(CoordinatorEntity[RadarrDataUpdateCoordinator]):
|
||||||
"""Create Radarr entity."""
|
"""Create Radarr entity."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
self._attr_name = f"{DEFAULT_NAME} {description.name}"
|
|
||||||
self._attr_unique_id = f"{coordinator.config_entry.entry_id}_{description.key}"
|
self._attr_unique_id = f"{coordinator.config_entry.entry_id}_{description.key}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -12,6 +12,6 @@ async def test_binary_sensors(hass: HomeAssistant, aioclient_mock: AiohttpClient
|
||||||
"""Test for binary sensor values."""
|
"""Test for binary sensor values."""
|
||||||
await setup_integration(hass, aioclient_mock)
|
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.state == STATE_ON
|
||||||
assert state.attributes.get(ATTR_DEVICE_CLASS) == BinarySensorDeviceClass.PROBLEM
|
assert state.attributes.get(ATTR_DEVICE_CLASS) == BinarySensorDeviceClass.PROBLEM
|
||||||
|
|
|
@ -18,13 +18,13 @@ async def test_sensors(
|
||||||
"""Test for successfully setting up the Radarr platform."""
|
"""Test for successfully setting up the Radarr platform."""
|
||||||
await setup_integration(hass, aioclient_mock)
|
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.state == "263.10"
|
||||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "GB"
|
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.state == "1"
|
||||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "Movies"
|
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.state == "2020-09-01T23:50:20+00:00"
|
||||||
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.TIMESTAMP
|
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."""
|
"""Test for successfully setting up the Radarr platform on Windows."""
|
||||||
await setup_integration(hass, aioclient_mock, windows=True)
|
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"
|
assert state.state == "263.10"
|
||||||
|
|
Loading…
Add table
Reference in a new issue