Reolink check firmware (#88903)
parent
dea29f539f
commit
4eee626770
|
@ -138,6 +138,26 @@ class ReolinkHost:
|
|||
|
||||
await self.subscribe()
|
||||
|
||||
if self._api.sw_version_update_required:
|
||||
ir.async_create_issue(
|
||||
self._hass,
|
||||
DOMAIN,
|
||||
"firmware_update",
|
||||
is_fixable=False,
|
||||
severity=ir.IssueSeverity.WARNING,
|
||||
translation_key="firmware_update",
|
||||
translation_placeholders={
|
||||
"required_firmware": self._api.sw_version_required.version_string,
|
||||
"current_firmware": self._api.sw_version,
|
||||
"model": self._api.model,
|
||||
"hw_version": self._api.hardware_version,
|
||||
"name": self._api.nvr_name,
|
||||
"download_link": "https://reolink.com/download-center/",
|
||||
},
|
||||
)
|
||||
else:
|
||||
ir.async_delete_issue(self._hass, DOMAIN, "firmware_update")
|
||||
|
||||
async def update_states(self) -> None:
|
||||
"""Call the API of the camera device to update the internal states."""
|
||||
await self._api.get_states()
|
||||
|
|
|
@ -46,6 +46,10 @@
|
|||
"enable_port": {
|
||||
"title": "Reolink port not enabled",
|
||||
"description": "Failed to automatically enable {ports}port(s) on {name}. Use the [Reolink client]({info_link}) to manually set it to ON"
|
||||
},
|
||||
"firmware_update": {
|
||||
"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 latest firmware can be downloaded from the [Reolink download center]({download_link})."
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
|
|
|
@ -100,6 +100,7 @@ async def test_no_repair_issue(
|
|||
issue_registry = ir.async_get(hass)
|
||||
assert (const.DOMAIN, "https_webhook") not in issue_registry.issues
|
||||
assert (const.DOMAIN, "enable_port") not in issue_registry.issues
|
||||
assert (const.DOMAIN, "firmware_update") not in issue_registry.issues
|
||||
|
||||
|
||||
async def test_https_repair_issue(
|
||||
|
@ -135,3 +136,15 @@ async def test_port_repair_issue(
|
|||
|
||||
issue_registry = ir.async_get(hass)
|
||||
assert (const.DOMAIN, "enable_port") in issue_registry.issues
|
||||
|
||||
|
||||
async def test_firmware_repair_issue(
|
||||
hass: HomeAssistant, config_entry: MockConfigEntry, reolink_connect: MagicMock
|
||||
) -> None:
|
||||
"""Test firmware issue is raised when too old firmware is used."""
|
||||
reolink_connect.sw_version_update_required = True
|
||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
issue_registry = ir.async_get(hass)
|
||||
assert (const.DOMAIN, "firmware_update") in issue_registry.issues
|
||||
|
|
Loading…
Reference in New Issue