mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 06:17:07 +00:00
Remove deprecated hdr switch from reolink (#134924)
This commit is contained in:
parent
6ab45f8c9e
commit
6884d790ca
@ -117,10 +117,6 @@
|
||||
"title": "Reolink firmware update required",
|
||||
"description": "\"{name}\" with model \"{model}\" and hardware version \"{hw_version}\" is running a old firmware version \"{current_firmware}\", while at least firmware version \"{required_firmware}\" is required for proper operation of the Reolink integration. The firmware can be updated by pressing \"install\" in the more info dialog of the update entity of \"{name}\" from within Home Assistant. Alternatively, the latest firmware can be downloaded from the [Reolink download center]({download_link})."
|
||||
},
|
||||
"hdr_switch_deprecated": {
|
||||
"title": "Reolink HDR switch deprecated",
|
||||
"description": "The Reolink HDR switch entity is deprecated and will be removed in HA 2025.2.0. It has been replaced by a HDR select entity offering options `on`, `off` and `auto`. To remove this issue, please adjust automations accordingly and disable the HDR switch entity."
|
||||
},
|
||||
"hub_switch_deprecated": {
|
||||
"title": "Reolink Home Hub switches deprecated",
|
||||
"description": "The redundant 'Record', 'Email on event', 'FTP upload', 'Push notifications', and 'Buzzer on event' switches on the Reolink Home Hub are depricated since the new firmware no longer supports these. Please use the equally named switches under each of the camera devices connected to the Home Hub instead. To remove this issue, please adjust automations accordingly and disable the switch entities mentioned."
|
||||
|
@ -267,18 +267,6 @@ CHIME_SWITCH_ENTITIES = (
|
||||
),
|
||||
)
|
||||
|
||||
# Can be removed in HA 2025.2.0
|
||||
DEPRECATED_HDR = ReolinkSwitchEntityDescription(
|
||||
key="hdr",
|
||||
cmd_key="GetIsp",
|
||||
translation_key="hdr",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
supported=lambda api, ch: api.supported(ch, "HDR"),
|
||||
value=lambda api, ch: api.HDR_on(ch) is True,
|
||||
method=lambda api, ch, value: api.set_HDR(ch, value),
|
||||
)
|
||||
|
||||
# Can be removed in HA 2025.4.0
|
||||
DEPRECATED_NVR_SWITCHES = [
|
||||
ReolinkNVRSwitchEntityDescription(
|
||||
@ -367,26 +355,6 @@ async def async_setup_entry(
|
||||
entity_reg = er.async_get(hass)
|
||||
reg_entities = er.async_entries_for_config_entry(entity_reg, config_entry.entry_id)
|
||||
for entity in reg_entities:
|
||||
# Can be removed in HA 2025.2.0
|
||||
if entity.domain == "switch" and entity.unique_id.endswith("_hdr"):
|
||||
if entity.disabled:
|
||||
entity_reg.async_remove(entity.entity_id)
|
||||
continue
|
||||
|
||||
ir.async_create_issue(
|
||||
hass,
|
||||
DOMAIN,
|
||||
"hdr_switch_deprecated",
|
||||
is_fixable=False,
|
||||
severity=ir.IssueSeverity.WARNING,
|
||||
translation_key="hdr_switch_deprecated",
|
||||
)
|
||||
entities.extend(
|
||||
ReolinkSwitchEntity(reolink_data, channel, DEPRECATED_HDR)
|
||||
for channel in reolink_data.host.api.channels
|
||||
if DEPRECATED_HDR.supported(reolink_data.host.api, channel)
|
||||
)
|
||||
|
||||
# Can be removed in HA 2025.4.0
|
||||
if entity.domain == "switch" and entity.unique_id in depricated_dict:
|
||||
if entity.disabled:
|
||||
|
@ -29,38 +29,6 @@ from .conftest import TEST_CAM_NAME, TEST_NVR_NAME, TEST_UID
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
|
||||
|
||||
async def test_cleanup_hdr_switch(
|
||||
hass: HomeAssistant,
|
||||
config_entry: MockConfigEntry,
|
||||
reolink_connect: MagicMock,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test cleanup of the HDR switch entity."""
|
||||
original_id = f"{TEST_UID}_hdr"
|
||||
domain = Platform.SWITCH
|
||||
|
||||
reolink_connect.channels = [0]
|
||||
reolink_connect.supported.return_value = True
|
||||
|
||||
entity_registry.async_get_or_create(
|
||||
domain=domain,
|
||||
platform=DOMAIN,
|
||||
unique_id=original_id,
|
||||
config_entry=config_entry,
|
||||
suggested_object_id=original_id,
|
||||
disabled_by=er.RegistryEntryDisabler.USER,
|
||||
)
|
||||
|
||||
assert entity_registry.async_get_entity_id(domain, DOMAIN, original_id)
|
||||
|
||||
# setup CH 0 and host entities/device
|
||||
with patch("homeassistant.components.reolink.PLATFORMS", [domain]):
|
||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert entity_registry.async_get_entity_id(domain, DOMAIN, original_id) is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
(
|
||||
"original_id",
|
||||
@ -132,41 +100,6 @@ async def test_cleanup_hub_switches(
|
||||
reolink_connect.supported.return_value = True
|
||||
|
||||
|
||||
async def test_hdr_switch_deprecated_repair_issue(
|
||||
hass: HomeAssistant,
|
||||
config_entry: MockConfigEntry,
|
||||
reolink_connect: MagicMock,
|
||||
entity_registry: er.EntityRegistry,
|
||||
issue_registry: ir.IssueRegistry,
|
||||
) -> None:
|
||||
"""Test repairs issue is raised when hdr switch entity used."""
|
||||
original_id = f"{TEST_UID}_hdr"
|
||||
domain = Platform.SWITCH
|
||||
|
||||
reolink_connect.channels = [0]
|
||||
reolink_connect.supported.return_value = True
|
||||
|
||||
entity_registry.async_get_or_create(
|
||||
domain=domain,
|
||||
platform=DOMAIN,
|
||||
unique_id=original_id,
|
||||
config_entry=config_entry,
|
||||
suggested_object_id=original_id,
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
assert entity_registry.async_get_entity_id(domain, DOMAIN, original_id)
|
||||
|
||||
# setup CH 0 and host entities/device
|
||||
with patch("homeassistant.components.reolink.PLATFORMS", [domain]):
|
||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert entity_registry.async_get_entity_id(domain, DOMAIN, original_id)
|
||||
|
||||
assert (DOMAIN, "hdr_switch_deprecated") in issue_registry.issues
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
(
|
||||
"original_id",
|
||||
|
Loading…
x
Reference in New Issue
Block a user