mirror of
https://github.com/home-assistant/core.git
synced 2026-08-03 20:24:55 +02:00
Require UniFi Protect 7.1 (#177620)
This commit is contained in:
@@ -55,7 +55,7 @@ DEVICES_FOR_SUBSCRIBE = DEVICES_WITH_ENTITIES | {ModelType.EVENT}
|
||||
# the public API devices WebSocket.
|
||||
DEVICES_WS_SUBSCRIBED_MODELS: set[ModelType] = set()
|
||||
|
||||
MIN_REQUIRED_PROTECT_V = Version("6.0.0")
|
||||
MIN_REQUIRED_PROTECT_V = Version("7.1.0")
|
||||
OUTDATED_LOG_MESSAGE = (
|
||||
"You are running v%s of UniFi Protect. Minimum required version is v%s. Please"
|
||||
" upgrade UniFi Protect and then retry"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||
"cloud_user": "Ubiquiti Cloud users are not supported. Please use a local user instead.",
|
||||
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
|
||||
"protect_version": "Minimum required version is v6.0.0. Please upgrade UniFi Protect and then retry."
|
||||
"protect_version": "Minimum required version is v7.1.0. Please upgrade UniFi Protect and then retry."
|
||||
},
|
||||
"flow_title": "{name} ({ip_address})",
|
||||
"step": {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"canAutoUpdate": true,
|
||||
"isStatsGatheringEnabled": true,
|
||||
"timezone": "America/New_York",
|
||||
"version": "6.0.0",
|
||||
"version": "7.1.0",
|
||||
"ucoreVersion": "2.3.26",
|
||||
"firmwareVersion": "2.3.10",
|
||||
"uiVersion": null,
|
||||
|
||||
@@ -603,7 +603,7 @@
|
||||
'uptime': 1191516000,
|
||||
'vaultCameras': list([
|
||||
]),
|
||||
'version': '6.0.0',
|
||||
'version': '7.1.0',
|
||||
'wanIp': None,
|
||||
}),
|
||||
'ringtones': list([
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
'name': 'UnifiProtect',
|
||||
'name_by_user': None,
|
||||
'serial_number': None,
|
||||
'sw_version': '6.0.0',
|
||||
'sw_version': '7.1.0',
|
||||
'via_device_id': None,
|
||||
})
|
||||
# ---
|
||||
|
||||
@@ -149,14 +149,21 @@ async def test_user_flow(hass: HomeAssistant, bootstrap: Bootstrap, nvr: NVR) ->
|
||||
assert len(mock_setup.mock_calls) == 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize("version", ["1.19.0", "7.0.107"])
|
||||
async def test_form_version_too_old(
|
||||
hass: HomeAssistant, bootstrap: Bootstrap, old_nvr: NVR, nvr: NVR, mock_setup: None
|
||||
hass: HomeAssistant,
|
||||
bootstrap: Bootstrap,
|
||||
old_nvr: NVR,
|
||||
nvr: NVR,
|
||||
version: str,
|
||||
mock_setup: None,
|
||||
) -> None:
|
||||
"""Test we handle the version being too old and can recover."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
||||
old_nvr.version = Version(version)
|
||||
bootstrap.nvr = old_nvr
|
||||
with (
|
||||
patch(
|
||||
@@ -1619,7 +1626,7 @@ async def test_reconfigure_outdated_version(
|
||||
|
||||
# Set up NVR with outdated version
|
||||
old_nvr = nvr.model_copy()
|
||||
old_nvr.version = Version("5.0.0") # Below MIN_REQUIRED_PROTECT_V (6.0.0)
|
||||
old_nvr.version = Version("5.0.0") # Below MIN_REQUIRED_PROTECT_V (7.1.0)
|
||||
bootstrap.nvr = old_nvr
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
|
||||
@@ -6,7 +6,7 @@ import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
from uiprotect import NvrError, ProtectApiClient
|
||||
from uiprotect.api import DEVICE_UPDATE_INTERVAL
|
||||
from uiprotect.data import NVR, Bootstrap, CloudAccount, Light
|
||||
from uiprotect.data import NVR, Bootstrap, CloudAccount, Light, Version
|
||||
from uiprotect.exceptions import BadRequest, NotAuthorized
|
||||
|
||||
from homeassistant.components.unifiprotect.const import (
|
||||
@@ -216,11 +216,17 @@ async def test_remove_entry_not_loaded_clear_session_fails(
|
||||
assert mock_api.clear_session.called
|
||||
|
||||
|
||||
@pytest.mark.parametrize("version", ["1.19.0", "7.0.107"])
|
||||
async def test_setup_too_old(
|
||||
hass: HomeAssistant, ufp: MockUFPFixture, old_nvr: NVR
|
||||
hass: HomeAssistant, ufp: MockUFPFixture, old_nvr: NVR, version: str
|
||||
) -> None:
|
||||
"""Test setup of unifiprotect entry with too old of version of UniFi Protect."""
|
||||
"""Test setup of unifiprotect entry with too old of version of UniFi Protect.
|
||||
|
||||
7.0.107 is the last release before the public API gained the camera and
|
||||
sensor fields the integration reads, so it has to be rejected too.
|
||||
"""
|
||||
|
||||
old_nvr.version = Version(version)
|
||||
old_bootstrap = ufp.api.bootstrap.model_copy()
|
||||
old_bootstrap.nvr = old_nvr
|
||||
ufp.api.update.return_value = old_bootstrap
|
||||
@@ -229,6 +235,7 @@ async def test_setup_too_old(
|
||||
await hass.config_entries.async_setup(ufp.entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
assert ufp.entry.state is ConfigEntryState.SETUP_ERROR
|
||||
assert ufp.entry.error_reason_translation_key == "protect_version"
|
||||
|
||||
|
||||
async def test_setup_cloud_account(
|
||||
|
||||
Reference in New Issue
Block a user