From 6c659c0d68174a516ae09a833bf9fa98074d0d50 Mon Sep 17 00:00:00 2001 From: Christopher Bailey Date: Sun, 6 Nov 2022 10:11:49 -0500 Subject: [PATCH] Add repair warning about UniFi Protect Early Access (#81658) --- .../components/unifiprotect/__init__.py | 17 ++++++++++++++++- .../components/unifiprotect/strings.json | 6 ++++++ .../unifiprotect/translations/en.json | 10 ++++++---- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/unifiprotect/__init__.py b/homeassistant/components/unifiprotect/__init__.py index 30b1d1ad56d..649d62c6fee 100644 --- a/homeassistant/components/unifiprotect/__init__.py +++ b/homeassistant/components/unifiprotect/__init__.py @@ -21,8 +21,9 @@ from homeassistant.const import ( ) from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady -from homeassistant.helpers import device_registry as dr +from homeassistant.helpers import device_registry as dr, issue_registry as ir from homeassistant.helpers.aiohttp_client import async_create_clientsession +from homeassistant.helpers.issue_registry import IssueSeverity from .const import ( CONF_ALL_UPDATES, @@ -101,6 +102,20 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, data_service.async_stop) ) + protect_version = data_service.api.bootstrap.nvr.version + if protect_version.is_prerelease: + ir.async_create_issue( + hass, + DOMAIN, + f"ea_warning_{protect_version}", + is_fixable=False, + is_persistent=False, + learn_more_url="https://www.home-assistant.io/integrations/unifiprotect#about-unifi-early-access", + severity=IssueSeverity.WARNING, + translation_key="ea_warning", + translation_placeholders={"version": str(protect_version)}, + ) + return True diff --git a/homeassistant/components/unifiprotect/strings.json b/homeassistant/components/unifiprotect/strings.json index d3cfe24abd2..2967ba8c82e 100644 --- a/homeassistant/components/unifiprotect/strings.json +++ b/homeassistant/components/unifiprotect/strings.json @@ -54,5 +54,11 @@ } } } + }, + "issues": { + "ea_warning": { + "title": "{version} is an Early Access version of UniFi Protect", + "description": "You are using {version} of UniFi Protect. Early Access versions are not supported by Home Assistant and may cause your UniFi Protect integration to break or not work as expected." + } } } diff --git a/homeassistant/components/unifiprotect/translations/en.json b/homeassistant/components/unifiprotect/translations/en.json index c6050d05284..9fd074ac585 100644 --- a/homeassistant/components/unifiprotect/translations/en.json +++ b/homeassistant/components/unifiprotect/translations/en.json @@ -41,16 +41,18 @@ } } }, + "issues": { + "ea_warning": { + "description": "You are using {version} of UniFi Protect. Early Access versions are not supported by Home Assistant and may cause your UniFi Protect integration to break or not work as expected.", + "title": "{version} is an Early Access version of UniFi Protect" + } + }, "options": { - "error": { - "invalid_mac_list": "Must be a list of MAC addresses seperated by commas" - }, "step": { "init": { "data": { "all_updates": "Realtime metrics (WARNING: Greatly increases CPU usage)", "disable_rtsp": "Disable the RTSP stream", - "ignored_devices": "Comma separated list of MAC addresses of devices to ignore", "max_media": "Max number of event to load for Media Browser (increases RAM usage)", "override_connection_host": "Override Connection Host" },