Update service domain for local_file from 'camera' to 'local_file' (#28890)

* update service domain for local_file from camera to local_file

* remove service.yaml entry in camera component as part of change

* fix test

* move constants to const.py

* add local_file/const.py to .coveragerc

* remove local_file/const.py from .coveragerc since component has tests
This commit is contained in:
Raman Gupta 2019-11-26 12:22:55 -05:00 committed by Paulus Schoutsen
parent a5960830d7
commit 42ce5e8b07
5 changed files with 16 additions and 19 deletions

View File

@ -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:

View File

@ -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(
{

View File

@ -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"

View File

@ -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:

View File

@ -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