diff --git a/homeassistant/components/camera/services.yaml b/homeassistant/components/camera/services.yaml index 4c2d89db8..c50e2926a 100644 --- a/homeassistant/components/camera/services.yaml +++ b/homeassistant/components/camera/services.yaml @@ -68,16 +68,6 @@ record: description: (Optional) Target lookback period (in seconds) to include in addition to duration. Only available if there is currently an active HLS stream. example: 4 -local_file_update_file_path: - description: Update the file_path for a local_file camera. - fields: - entity_id: - description: Name(s) of entities to update. - example: 'camera.local_file' - file_path: - description: Path to the new image file. - example: '/images/newimage.jpg' - onvif_ptz: description: Pan/Tilt/Zoom service for ONVIF camera. fields: diff --git a/homeassistant/components/local_file/camera.py b/homeassistant/components/local_file/camera.py index d705cefc3..9bd476cfb 100644 --- a/homeassistant/components/local_file/camera.py +++ b/homeassistant/components/local_file/camera.py @@ -11,15 +11,17 @@ from homeassistant.components.camera import ( CAMERA_SERVICE_SCHEMA, PLATFORM_SCHEMA, ) -from homeassistant.components.camera.const import DOMAIN from homeassistant.helpers import config_validation as cv -_LOGGER = logging.getLogger(__name__) +from .const import ( + CONF_FILE_PATH, + DATA_LOCAL_FILE, + DEFAULT_NAME, + DOMAIN, + SERVICE_UPDATE_FILE_PATH, +) -CONF_FILE_PATH = "file_path" -DATA_LOCAL_FILE = "local_file_cameras" -DEFAULT_NAME = "Local File" -SERVICE_UPDATE_FILE_PATH = "local_file_update_file_path" +_LOGGER = logging.getLogger(__name__) PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( { diff --git a/homeassistant/components/local_file/const.py b/homeassistant/components/local_file/const.py new file mode 100644 index 000000000..5225a70da --- /dev/null +++ b/homeassistant/components/local_file/const.py @@ -0,0 +1,6 @@ +"""Constants for the Local File Camera component.""" +DOMAIN = "local_file" +SERVICE_UPDATE_FILE_PATH = "update_file_path" +CONF_FILE_PATH = "file_path" +DATA_LOCAL_FILE = "local_file_cameras" +DEFAULT_NAME = "Local File" diff --git a/homeassistant/components/local_file/services.yaml b/homeassistant/components/local_file/services.yaml index b359b411b..b8c615f33 100644 --- a/homeassistant/components/local_file/services.yaml +++ b/homeassistant/components/local_file/services.yaml @@ -1,4 +1,4 @@ -local_file_update_file_path: +update_file_path: description: Use this service to change the file displayed by the camera. fields: entity_id: diff --git a/tests/components/local_file/test_camera.py b/tests/components/local_file/test_camera.py index ae71954bf..042b0f764 100644 --- a/tests/components/local_file/test_camera.py +++ b/tests/components/local_file/test_camera.py @@ -2,8 +2,7 @@ import asyncio from unittest import mock -from homeassistant.components.camera.const import DOMAIN -from homeassistant.components.local_file.camera import SERVICE_UPDATE_FILE_PATH +from homeassistant.components.local_file.const import DOMAIN, SERVICE_UPDATE_FILE_PATH from homeassistant.setup import async_setup_component from tests.common import mock_registry