Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update service domain for facebox from 'image_processing' to 'facebox' #29151

Merged
merged 1 commit into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions homeassistant/components/facebox/const.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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