mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Remove deprecated service in plex (#146608)
* Remove deprecated service in plex * Update json/yaml
This commit is contained in:
parent
30dbd5a900
commit
e14cf8a5b9
@ -56,7 +56,6 @@ AUTOMATIC_SETUP_STRING = "Obtain a new token from plex.tv"
|
||||
MANUAL_SETUP_STRING = "Configure Plex server manually"
|
||||
|
||||
SERVICE_REFRESH_LIBRARY = "refresh_library"
|
||||
SERVICE_SCAN_CLIENTS = "scan_for_clients"
|
||||
|
||||
PLEX_URI_SCHEME = "plex://"
|
||||
|
||||
|
@ -9,9 +9,6 @@
|
||||
"services": {
|
||||
"refresh_library": {
|
||||
"service": "mdi:refresh"
|
||||
},
|
||||
"scan_for_clients": {
|
||||
"service": "mdi:database-refresh"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,16 +9,8 @@ from yarl import URL
|
||||
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
|
||||
from .const import (
|
||||
DOMAIN,
|
||||
PLEX_UPDATE_PLATFORMS_SIGNAL,
|
||||
PLEX_URI_SCHEME,
|
||||
SERVERS,
|
||||
SERVICE_REFRESH_LIBRARY,
|
||||
SERVICE_SCAN_CLIENTS,
|
||||
)
|
||||
from .const import DOMAIN, PLEX_URI_SCHEME, SERVERS, SERVICE_REFRESH_LIBRARY
|
||||
from .errors import MediaNotFound
|
||||
from .helpers import get_plex_data
|
||||
from .models import PlexMediaSearchResult
|
||||
@ -37,24 +29,12 @@ async def async_setup_services(hass: HomeAssistant) -> None:
|
||||
async def async_refresh_library_service(service_call: ServiceCall) -> None:
|
||||
await hass.async_add_executor_job(refresh_library, hass, service_call)
|
||||
|
||||
async def async_scan_clients_service(_: ServiceCall) -> None:
|
||||
_LOGGER.warning(
|
||||
"This service is deprecated in favor of the scan_clients button entity."
|
||||
" Service calls will still work for now but the service will be removed in"
|
||||
" a future release"
|
||||
)
|
||||
for server_id in get_plex_data(hass)[SERVERS]:
|
||||
async_dispatcher_send(hass, PLEX_UPDATE_PLATFORMS_SIGNAL.format(server_id))
|
||||
|
||||
hass.services.async_register(
|
||||
DOMAIN,
|
||||
SERVICE_REFRESH_LIBRARY,
|
||||
async_refresh_library_service,
|
||||
schema=REFRESH_LIBRARY_SCHEMA,
|
||||
)
|
||||
hass.services.async_register(
|
||||
DOMAIN, SERVICE_SCAN_CLIENTS, async_scan_clients_service
|
||||
)
|
||||
|
||||
|
||||
def refresh_library(hass: HomeAssistant, service_call: ServiceCall) -> None:
|
||||
|
@ -9,5 +9,3 @@ refresh_library:
|
||||
example: "TV Shows"
|
||||
selector:
|
||||
text:
|
||||
|
||||
scan_for_clients:
|
||||
|
@ -83,10 +83,6 @@
|
||||
"description": "Name of the Plex library to refresh."
|
||||
}
|
||||
}
|
||||
},
|
||||
"scan_for_clients": {
|
||||
"name": "Scan for clients",
|
||||
"description": "Scans for available clients from the Plex server(s), local network, and plex.tv."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ from homeassistant.components.plex.const import (
|
||||
PLEX_SERVER_CONFIG,
|
||||
PLEX_URI_SCHEME,
|
||||
SERVICE_REFRESH_LIBRARY,
|
||||
SERVICE_SCAN_CLIENTS,
|
||||
)
|
||||
from homeassistant.components.plex.services import process_plex_payload
|
||||
from homeassistant.const import CONF_URL
|
||||
@ -107,15 +106,6 @@ async def test_refresh_library(
|
||||
assert refresh.call_count == 1
|
||||
|
||||
|
||||
async def test_scan_clients(hass: HomeAssistant, mock_plex_server) -> None:
|
||||
"""Test scan_for_clients service call."""
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SCAN_CLIENTS,
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
|
||||
async def test_lookup_media_for_other_integrations(
|
||||
hass: HomeAssistant,
|
||||
entry,
|
||||
|
Loading…
x
Reference in New Issue
Block a user