mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Remove name key from transimssion services (#83974)
This commit is contained in:
parent
bb3feceb57
commit
099a653bed
@ -14,7 +14,6 @@ from homeassistant.config_entries import ConfigEntry, ConfigEntryState
|
|||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
CONF_NAME,
|
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
CONF_PORT,
|
CONF_PORT,
|
||||||
CONF_SCAN_INTERVAL,
|
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 import config_validation as cv, selector
|
||||||
from homeassistant.helpers.dispatcher import dispatcher_send
|
from homeassistant.helpers.dispatcher import dispatcher_send
|
||||||
from homeassistant.helpers.event import async_track_time_interval
|
from homeassistant.helpers.event import async_track_time_interval
|
||||||
from homeassistant.helpers.issue_registry import IssueSeverity, create_issue
|
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_DELETE_DATA,
|
ATTR_DELETE_DATA,
|
||||||
@ -56,13 +54,11 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
SERVICE_BASE_SCHEMA = vol.Schema(
|
SERVICE_BASE_SCHEMA = vol.Schema(
|
||||||
{
|
{
|
||||||
vol.Exclusive(CONF_ENTRY_ID, "identifier"): selector.ConfigEntrySelector(),
|
vol.Exclusive(CONF_ENTRY_ID, "identifier"): selector.ConfigEntrySelector(),
|
||||||
vol.Exclusive(CONF_NAME, "identifier"): selector.TextSelector(),
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
SERVICE_ADD_TORRENT_SCHEMA = vol.All(
|
SERVICE_ADD_TORRENT_SCHEMA = vol.All(
|
||||||
SERVICE_BASE_SCHEMA.extend({vol.Required(ATTR_TORRENT): cv.string}),
|
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.Required(CONF_ID): cv.positive_int,
|
||||||
vol.Optional(ATTR_DELETE_DATA, default=DEFAULT_DELETE_DATA): cv.boolean,
|
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_START_TORRENT_SCHEMA = vol.All(
|
||||||
SERVICE_BASE_SCHEMA.extend({vol.Required(CONF_ID): cv.positive_int}),
|
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(
|
SERVICE_STOP_TORRENT_SCHEMA = vol.All(
|
||||||
@ -86,8 +80,7 @@ SERVICE_STOP_TORRENT_SCHEMA = vol.All(
|
|||||||
{
|
{
|
||||||
vol.Required(CONF_ID): cv.positive_int,
|
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)
|
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]
|
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
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,12 +8,6 @@ add_torrent:
|
|||||||
selector:
|
selector:
|
||||||
config_entry:
|
config_entry:
|
||||||
integration: transmission
|
integration: transmission
|
||||||
name:
|
|
||||||
name: Name
|
|
||||||
description: Instance name as entered during entry config
|
|
||||||
example: Transmission
|
|
||||||
selector:
|
|
||||||
text:
|
|
||||||
torrent:
|
torrent:
|
||||||
name: Torrent
|
name: Torrent
|
||||||
description: URL, magnet link or Base64 encoded file.
|
description: URL, magnet link or Base64 encoded file.
|
||||||
|
@ -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."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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": {
|
"options": {
|
||||||
"step": {
|
"step": {
|
||||||
"init": {
|
"init": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user