Skip to content

Commit

Permalink
move facebox service to facebox domain (#29151)
Browse files Browse the repository at this point in the history
  • Loading branch information
raman325 authored and pvizeli committed Nov 27, 2019
1 parent c72e230 commit 5120181
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
4 changes: 4 additions & 0 deletions homeassistant/components/facebox/const.py
@@ -0,0 +1,4 @@
"""Constants for the Facebox component."""

DOMAIN = "facebox"
SERVICE_TEACH_FACE = "teach_face"
4 changes: 2 additions & 2 deletions homeassistant/components/facebox/image_processing.py
Expand Up @@ -15,7 +15,6 @@
CONF_SOURCE,
CONF_ENTITY_ID,
CONF_NAME,
DOMAIN,
)
from homeassistant.const import (
CONF_IP_ADDRESS,
Expand All @@ -27,6 +26,8 @@
HTTP_UNAUTHORIZED,
)

from .const import DOMAIN, SERVICE_TEACH_FACE

_LOGGER = logging.getLogger(__name__)

ATTR_BOUNDING_BOX = "bounding_box"
Expand All @@ -38,7 +39,6 @@
CLASSIFIER = "facebox"
DATA_FACEBOX = "facebox_classifiers"
FILE_PATH = "file_path"
SERVICE_TEACH_FACE = "facebox_teach_face"


PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
Expand Down
12 changes: 12 additions & 0 deletions homeassistant/components/facebox/services.yaml
@@ -0,0 +1,12 @@
teach_face:
description: Teach facebox a face using a file.
fields:
entity_id:
description: The facebox entity to teach.
example: 'image_processing.facebox'
name:
description: The name of the face to teach.
example: 'my_name'
file_path:
description: The path to the image file.
example: '/images/my_image.jpg'
13 changes: 0 additions & 13 deletions homeassistant/components/image_processing/services.yaml
Expand Up @@ -6,16 +6,3 @@ scan:
entity_id:
description: Name(s) of entities to scan immediately.
example: 'image_processing.alpr_garage'

facebox_teach_face:
description: Teach facebox a face using a file.
fields:
entity_id:
description: The facebox entity to teach.
example: 'image_processing.facebox'
name:
description: The name of the face to teach.
example: 'my_name'
file_path:
description: The path to the image file.
example: '/images/my_image.jpg'
8 changes: 4 additions & 4 deletions tests/components/facebox/test_image_processing.py
Expand Up @@ -261,7 +261,7 @@ async def test_teach_service(
fb.FILE_PATH: MOCK_FILE_PATH,
}
await hass.services.async_call(
ip.DOMAIN, fb.SERVICE_TEACH_FACE, service_data=data
fb.DOMAIN, fb.SERVICE_TEACH_FACE, service_data=data
)
await hass.async_block_till_done()

Expand All @@ -275,7 +275,7 @@ async def test_teach_service(
fb.FILE_PATH: MOCK_FILE_PATH,
}
await hass.services.async_call(
ip.DOMAIN, fb.SERVICE_TEACH_FACE, service_data=data
fb.DOMAIN, fb.SERVICE_TEACH_FACE, service_data=data
)
await hass.async_block_till_done()
assert "AuthenticationError on facebox" in caplog.text
Expand All @@ -290,7 +290,7 @@ async def test_teach_service(
fb.FILE_PATH: MOCK_FILE_PATH,
}
await hass.services.async_call(
ip.DOMAIN, fb.SERVICE_TEACH_FACE, service_data=data
fb.DOMAIN, fb.SERVICE_TEACH_FACE, service_data=data
)
await hass.async_block_till_done()
assert MOCK_ERROR_NO_FACE in caplog.text
Expand All @@ -305,7 +305,7 @@ async def test_teach_service(
fb.FILE_PATH: MOCK_FILE_PATH,
}
await hass.services.async_call(
ip.DOMAIN, fb.SERVICE_TEACH_FACE, service_data=data
fb.DOMAIN, fb.SERVICE_TEACH_FACE, service_data=data
)
await hass.async_block_till_done()
assert "ConnectionError: Is facebox running?" in caplog.text
Expand Down

0 comments on commit 5120181

Please sign in to comment.