From b96330df03dfc24b8e59540d76178e5995d95c43 Mon Sep 17 00:00:00 2001 From: Christopher Bailey Date: Mon, 26 Dec 2022 14:19:34 -0500 Subject: [PATCH] Deprecate `set_doorbell_message` UniFi Protect service (#83675) --- .../components/unifiprotect/select.py | 20 ++++++++++++++++++- .../components/unifiprotect/strings.json | 11 ++++++++++ .../unifiprotect/translations/en.json | 13 +++++++++--- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/unifiprotect/select.py b/homeassistant/components/unifiprotect/select.py index e398e6692b0..27c45d36b7c 100644 --- a/homeassistant/components/unifiprotect/select.py +++ b/homeassistant/components/unifiprotect/select.py @@ -32,7 +32,11 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import ATTR_ENTITY_ID from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import HomeAssistantError -from homeassistant.helpers import config_validation as cv, entity_platform +from homeassistant.helpers import ( + config_validation as cv, + entity_platform, + issue_registry as ir, +) from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity import EntityCategory from homeassistant.util.dt import utcnow @@ -430,6 +434,20 @@ class ProtectSelects(ProtectDeviceEntity, SelectEntity): async def async_set_doorbell_message(self, message: str, duration: str) -> None: """Set LCD Message on Doorbell display.""" + ir.async_create_issue( + self.hass, + DOMAIN, + "deprecated_service_set_doorbell_message", + breaks_in_ha_version="2023.3.0", + is_fixable=True, + is_persistent=True, + severity=ir.IssueSeverity.WARNING, + translation_placeholders={ + "link": "https://www.home-assistant.io/integrations/text#service-textset_value" + }, + translation_key="deprecated_service_set_doorbell_message", + ) + if self.entity_description.device_class != DEVICE_CLASS_LCD_MESSAGE: raise HomeAssistantError("Not a doorbell text select entity") diff --git a/homeassistant/components/unifiprotect/strings.json b/homeassistant/components/unifiprotect/strings.json index 30a1ae6c4b8..6c0639eaa56 100644 --- a/homeassistant/components/unifiprotect/strings.json +++ b/homeassistant/components/unifiprotect/strings.json @@ -75,6 +75,17 @@ "ea_setup_failed": { "title": "Setup error using Early Access version", "description": "You are using v{version} of UniFi Protect which is an Early Access version. An unrecoverable error occurred while trying to load the integration. Please [downgrade to a stable version](https://www.home-assistant.io/integrations/unifiprotect#downgrading-unifi-protect) of UniFi Protect to continue using the integration.\n\nError: {error}" + }, + "deprecated_service_set_doorbell_message": { + "title": "set_doorbell_message is Deprecated", + "fix_flow": { + "step": { + "confirm": { + "title": "set_doorbell_message is Deprecated", + "description": "The `unifiprotect.set_doorbell_message` service is deprecated in favor of the new Doorbell Text entity added to each Doorbell device. It will be removed in v2023.3.0. Please update to use the [`text.set_value` service]({link})." + } + } + } } }, "entity": { diff --git a/homeassistant/components/unifiprotect/translations/en.json b/homeassistant/components/unifiprotect/translations/en.json index b9d89c55629..0c6bf34d703 100644 --- a/homeassistant/components/unifiprotect/translations/en.json +++ b/homeassistant/components/unifiprotect/translations/en.json @@ -51,9 +51,16 @@ } }, "issues": { - "deprecate_smart_sensor": { - "description": "The unified \"Detected Object\" sensor for smart detections is now deprecated. It has been replaced with individual smart detection binary sensors for each smart detection type. Please update any templates or automations accordingly.", - "title": "Smart Detection Sensor Deprecated" + "deprecated_service_set_doorbell_message": { + "fix_flow": { + "step": { + "confirm": { + "description": "The `unifiprotect.set_doorbell_message` service is deprecated in favor of the new Doorbell Text entity added to each Doorbell device. It will be removed in v2023.3.0. Please update to use the [`text.set_value` service]({link}).", + "title": "set_doorbell_message is Deprecated" + } + } + }, + "title": "set_doorbell_message is Deprecated" }, "ea_setup_failed": { "description": "You are using v{version} of UniFi Protect which is an Early Access version. An unrecoverable error occurred while trying to load the integration. Please [downgrade to a stable version](https://www.home-assistant.io/integrations/unifiprotect#downgrading-unifi-protect) of UniFi Protect to continue using the integration.\n\nError: {error}",