From ae8b1e01cbf9c88f921d6790ee1d11677e2f1c9d Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Wed, 20 Nov 2019 00:52:33 -0500 Subject: [PATCH 1/6] update service domain for local_file from camera to local_file --- homeassistant/components/local_file/camera.py | 4 ++-- homeassistant/components/local_file/services.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/local_file/camera.py b/homeassistant/components/local_file/camera.py index d705cefc3fccb4..dccfe1de88d0d4 100644 --- a/homeassistant/components/local_file/camera.py +++ b/homeassistant/components/local_file/camera.py @@ -11,15 +11,15 @@ CAMERA_SERVICE_SCHEMA, PLATFORM_SCHEMA, ) -from homeassistant.components.camera.const import DOMAIN from homeassistant.helpers import config_validation as cv _LOGGER = logging.getLogger(__name__) +DOMAIN = "local_file" CONF_FILE_PATH = "file_path" DATA_LOCAL_FILE = "local_file_cameras" DEFAULT_NAME = "Local File" -SERVICE_UPDATE_FILE_PATH = "local_file_update_file_path" +SERVICE_UPDATE_FILE_PATH = "update_file_path" PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( { diff --git a/homeassistant/components/local_file/services.yaml b/homeassistant/components/local_file/services.yaml index b359b411b6a8ab..b8c615f3335055 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: From a877b472ea84450444aa7f57b079dc3ea3a367b3 Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Wed, 20 Nov 2019 01:06:30 -0500 Subject: [PATCH 2/6] remove service.yaml entry in camera component as part of change --- homeassistant/components/camera/services.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/homeassistant/components/camera/services.yaml b/homeassistant/components/camera/services.yaml index 4c2d89db86d2dd..c50e2926a3fdcc 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: From ba6a4f65e29dafbc23cb61148e1474f55113bdae Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Wed, 20 Nov 2019 01:15:46 -0500 Subject: [PATCH 3/6] fix test --- tests/components/local_file/test_camera.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/components/local_file/test_camera.py b/tests/components/local_file/test_camera.py index ae71954bf4ae35..3f4b02fdb99c9c 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.camera import DOMAIN, SERVICE_UPDATE_FILE_PATH from homeassistant.setup import async_setup_component from tests.common import mock_registry From c6125bb8ca8a42a7e3e0d0aa199c1229fc421c08 Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Tue, 26 Nov 2019 08:26:22 -0500 Subject: [PATCH 4/6] move constants to const.py --- homeassistant/components/local_file/camera.py | 14 ++++++++------ homeassistant/components/local_file/const.py | 6 ++++++ tests/components/local_file/test_camera.py | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 homeassistant/components/local_file/const.py diff --git a/homeassistant/components/local_file/camera.py b/homeassistant/components/local_file/camera.py index dccfe1de88d0d4..9bd476cfb275ca 100644 --- a/homeassistant/components/local_file/camera.py +++ b/homeassistant/components/local_file/camera.py @@ -13,13 +13,15 @@ ) 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, +) -DOMAIN = "local_file" -CONF_FILE_PATH = "file_path" -DATA_LOCAL_FILE = "local_file_cameras" -DEFAULT_NAME = "Local File" -SERVICE_UPDATE_FILE_PATH = "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 00000000000000..5225a70daedc7f --- /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/tests/components/local_file/test_camera.py b/tests/components/local_file/test_camera.py index 3f4b02fdb99c9c..042b0f76400177 100644 --- a/tests/components/local_file/test_camera.py +++ b/tests/components/local_file/test_camera.py @@ -2,7 +2,7 @@ import asyncio from unittest import mock -from homeassistant.components.local_file.camera import DOMAIN, 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 From a96623f6b15d53c157813d67784de54b482a3c9d Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Tue, 26 Nov 2019 08:54:34 -0500 Subject: [PATCH 5/6] add local_file/const.py to .coveragerc --- .coveragerc | 1 + 1 file changed, 1 insertion(+) diff --git a/.coveragerc b/.coveragerc index ab4e91e5efd722..89df27917c9559 100644 --- a/.coveragerc +++ b/.coveragerc @@ -377,6 +377,7 @@ omit = homeassistant/components/lirc/* homeassistant/components/liveboxplaytv/media_player.py homeassistant/components/llamalab_automate/notify.py + homeassistant/components/local_file/const.py homeassistant/components/lockitron/lock.py homeassistant/components/logi_circle/__init__.py homeassistant/components/logi_circle/camera.py From 7ed6daa2c612b7e253c12afe13cb73536973c78f Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Tue, 26 Nov 2019 09:08:50 -0500 Subject: [PATCH 6/6] remove local_file/const.py from .coveragerc since component has tests --- .coveragerc | 1 - 1 file changed, 1 deletion(-) diff --git a/.coveragerc b/.coveragerc index 89df27917c9559..ab4e91e5efd722 100644 --- a/.coveragerc +++ b/.coveragerc @@ -377,7 +377,6 @@ omit = homeassistant/components/lirc/* homeassistant/components/liveboxplaytv/media_player.py homeassistant/components/llamalab_automate/notify.py - homeassistant/components/local_file/const.py homeassistant/components/lockitron/lock.py homeassistant/components/logi_circle/__init__.py homeassistant/components/logi_circle/camera.py