From 099a653bedfe1470b531272dab9f773d00626fa7 Mon Sep 17 00:00:00 2001 From: Rami Mosleh Date: Mon, 19 Dec 2022 14:38:54 +0200 Subject: [PATCH] Remove name key from transimssion services (#83974) --- .../components/transmission/__init__.py | 32 ++----------------- .../components/transmission/services.yaml | 6 ---- .../components/transmission/strings.json | 13 -------- .../transmission/translations/en.json | 13 -------- 4 files changed, 2 insertions(+), 62 deletions(-) diff --git a/homeassistant/components/transmission/__init__.py b/homeassistant/components/transmission/__init__.py index 6623b68f91e..e2c8a3ebfd4 100644 --- a/homeassistant/components/transmission/__init__.py +++ b/homeassistant/components/transmission/__init__.py @@ -14,7 +14,6 @@ from homeassistant.config_entries import ConfigEntry, ConfigEntryState from homeassistant.const import ( CONF_HOST, CONF_ID, - CONF_NAME, CONF_PASSWORD, CONF_PORT, CONF_SCAN_INTERVAL, @@ -26,7 +25,6 @@ from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady from homeassistant.helpers import config_validation as cv, selector from homeassistant.helpers.dispatcher import dispatcher_send from homeassistant.helpers.event import async_track_time_interval -from homeassistant.helpers.issue_registry import IssueSeverity, create_issue from .const import ( ATTR_DELETE_DATA, @@ -56,13 +54,11 @@ _LOGGER = logging.getLogger(__name__) SERVICE_BASE_SCHEMA = vol.Schema( { vol.Exclusive(CONF_ENTRY_ID, "identifier"): selector.ConfigEntrySelector(), - vol.Exclusive(CONF_NAME, "identifier"): selector.TextSelector(), } ) SERVICE_ADD_TORRENT_SCHEMA = vol.All( SERVICE_BASE_SCHEMA.extend({vol.Required(ATTR_TORRENT): cv.string}), - cv.has_at_least_one_key(CONF_ENTRY_ID, CONF_NAME), ) @@ -72,13 +68,11 @@ SERVICE_REMOVE_TORRENT_SCHEMA = vol.All( vol.Required(CONF_ID): cv.positive_int, vol.Optional(ATTR_DELETE_DATA, default=DEFAULT_DELETE_DATA): cv.boolean, } - ), - cv.has_at_least_one_key(CONF_ENTRY_ID, CONF_NAME), + ) ) SERVICE_START_TORRENT_SCHEMA = vol.All( SERVICE_BASE_SCHEMA.extend({vol.Required(CONF_ID): cv.positive_int}), - cv.has_at_least_one_key(CONF_ENTRY_ID, CONF_NAME), ) SERVICE_STOP_TORRENT_SCHEMA = vol.All( @@ -86,8 +80,7 @@ SERVICE_STOP_TORRENT_SCHEMA = vol.All( { vol.Required(CONF_ID): cv.positive_int, } - ), - cv.has_at_least_one_key(CONF_ENTRY_ID, CONF_NAME), + ) ) CONFIG_SCHEMA = cv.removed(DOMAIN, raise_if_present=False) @@ -165,27 +158,6 @@ def _get_client(hass: HomeAssistant, data: dict[str, Any]) -> TransmissionClient ): return hass.data[DOMAIN][entry_id] - # to be removed once name key is removed - if CONF_NAME in data: - create_issue( - hass, - DOMAIN, - "deprecated_key", - breaks_in_ha_version="2023.1.0", - is_fixable=True, - is_persistent=True, - severity=IssueSeverity.WARNING, - translation_key="deprecated_key", - ) - - _LOGGER.warning( - 'The "name" key in the Transmission services is deprecated and will be removed in "2023.1.0"; ' - 'use the "entry_id" key instead to identity which entry to call' - ) - for entry in hass.config_entries.async_entries(DOMAIN): - if entry.data[CONF_NAME] == data[CONF_NAME]: - return hass.data[DOMAIN][entry.entry_id] - return None diff --git a/homeassistant/components/transmission/services.yaml b/homeassistant/components/transmission/services.yaml index 2fd4793c785..66f4daf200f 100644 --- a/homeassistant/components/transmission/services.yaml +++ b/homeassistant/components/transmission/services.yaml @@ -8,12 +8,6 @@ add_torrent: selector: config_entry: integration: transmission - name: - name: Name - description: Instance name as entered during entry config - example: Transmission - selector: - text: torrent: name: Torrent description: URL, magnet link or Base64 encoded file. diff --git a/homeassistant/components/transmission/strings.json b/homeassistant/components/transmission/strings.json index 4a200a9c93f..2cf9fafff48 100644 --- a/homeassistant/components/transmission/strings.json +++ b/homeassistant/components/transmission/strings.json @@ -40,18 +40,5 @@ } } } - }, - "issues": { - "deprecated_key": { - "title": "The name key in Transmission services is being removed", - "fix_flow": { - "step": { - "confirm": { - "title": "The name key in Transmission services is being removed", - "description": "Update any automations or scripts that use this service and replace the name key with the entry_id key." - } - } - } - } } } diff --git a/homeassistant/components/transmission/translations/en.json b/homeassistant/components/transmission/translations/en.json index ff2a6b779e7..c31aa573b9d 100644 --- a/homeassistant/components/transmission/translations/en.json +++ b/homeassistant/components/transmission/translations/en.json @@ -29,19 +29,6 @@ } } }, - "issues": { - "deprecated_key": { - "fix_flow": { - "step": { - "confirm": { - "description": "Update any automations or scripts that use this service and replace the name key with the entry_id key.", - "title": "The name key in Transmission services is being removed" - } - } - }, - "title": "The name key in Transmission services is being removed" - } - }, "options": { "step": { "init": {