Check Reolink IPC channels for firmware repair issue (#119241)
* Add IPC channels to firmware repair issue * fix tests * fix typo
This commit is contained in:
parent
ecd61c6b6d
commit
c8ce935ec7
4 changed files with 32 additions and 21 deletions
|
@ -228,7 +228,7 @@ def migrate_entity_ids(
|
||||||
entity_reg = er.async_get(hass)
|
entity_reg = er.async_get(hass)
|
||||||
entities = er.async_entries_for_config_entry(entity_reg, config_entry_id)
|
entities = er.async_entries_for_config_entry(entity_reg, config_entry_id)
|
||||||
for entity in entities:
|
for entity in entities:
|
||||||
# Can be remove in HA 2025.1.0
|
# Can be removed in HA 2025.1.0
|
||||||
if entity.domain == "update" and entity.unique_id == host.unique_id:
|
if entity.domain == "update" and entity.unique_id == host.unique_id:
|
||||||
entity_reg.async_update_entity(
|
entity_reg.async_update_entity(
|
||||||
entity.entity_id, new_unique_id=f"{host.unique_id}_firmware"
|
entity.entity_id, new_unique_id=f"{host.unique_id}_firmware"
|
||||||
|
|
|
@ -127,6 +127,7 @@ class ReolinkChannelCoordinatorEntity(ReolinkHostCoordinatorEntity):
|
||||||
name=self._host.api.camera_name(dev_ch),
|
name=self._host.api.camera_name(dev_ch),
|
||||||
model=self._host.api.camera_model(dev_ch),
|
model=self._host.api.camera_model(dev_ch),
|
||||||
manufacturer=self._host.api.manufacturer,
|
manufacturer=self._host.api.manufacturer,
|
||||||
|
hw_version=self._host.api.camera_hardware_version(dev_ch),
|
||||||
sw_version=self._host.api.camera_sw_version(dev_ch),
|
sw_version=self._host.api.camera_sw_version(dev_ch),
|
||||||
serial_number=self._host.api.camera_uid(dev_ch),
|
serial_number=self._host.api.camera_uid(dev_ch),
|
||||||
configuration_url=self._conf_url,
|
configuration_url=self._conf_url,
|
||||||
|
|
|
@ -237,25 +237,35 @@ class ReolinkHost:
|
||||||
self._async_check_onvif_long_poll,
|
self._async_check_onvif_long_poll,
|
||||||
)
|
)
|
||||||
|
|
||||||
if self._api.sw_version_update_required:
|
ch_list: list[int | None] = [None]
|
||||||
ir.async_create_issue(
|
if self._api.is_nvr:
|
||||||
self._hass,
|
ch_list.extend(self._api.channels)
|
||||||
DOMAIN,
|
for ch in ch_list:
|
||||||
"firmware_update",
|
if not self._api.supported(ch, "firmware"):
|
||||||
is_fixable=False,
|
continue
|
||||||
severity=ir.IssueSeverity.WARNING,
|
|
||||||
translation_key="firmware_update",
|
key = ch if ch is not None else "host"
|
||||||
translation_placeholders={
|
if self._api.camera_sw_version_update_required(ch):
|
||||||
"required_firmware": self._api.sw_version_required.version_string,
|
ir.async_create_issue(
|
||||||
"current_firmware": self._api.sw_version,
|
self._hass,
|
||||||
"model": self._api.model,
|
DOMAIN,
|
||||||
"hw_version": self._api.hardware_version,
|
f"firmware_update_{key}",
|
||||||
"name": self._api.nvr_name,
|
is_fixable=False,
|
||||||
"download_link": "https://reolink.com/download-center/",
|
severity=ir.IssueSeverity.WARNING,
|
||||||
},
|
translation_key="firmware_update",
|
||||||
)
|
translation_placeholders={
|
||||||
else:
|
"required_firmware": self._api.camera_sw_version_required(
|
||||||
ir.async_delete_issue(self._hass, DOMAIN, "firmware_update")
|
ch
|
||||||
|
).version_string,
|
||||||
|
"current_firmware": self._api.camera_sw_version(ch),
|
||||||
|
"model": self._api.camera_model(ch),
|
||||||
|
"hw_version": self._api.camera_hardware_version(ch),
|
||||||
|
"name": self._api.camera_name(ch),
|
||||||
|
"download_link": "https://reolink.com/download-center/",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
ir.async_delete_issue(self._hass, DOMAIN, f"firmware_update_{key}")
|
||||||
|
|
||||||
async def _async_check_onvif(self, *_) -> None:
|
async def _async_check_onvif(self, *_) -> None:
|
||||||
"""Check the ONVIF subscription."""
|
"""Check the ONVIF subscription."""
|
||||||
|
|
|
@ -330,4 +330,4 @@ async def test_firmware_repair_issue(
|
||||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert (const.DOMAIN, "firmware_update") in issue_registry.issues
|
assert (const.DOMAIN, "firmware_update_host") in issue_registry.issues
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue