1
mirror of https://github.com/home-assistant/core synced 2024-08-06 09:34:49 +02:00

move facebox service to facebox domain (#29151)

This commit is contained in:
Raman Gupta 2019-11-27 05:20:24 -05:00 committed by Pascal Vizeli
parent c72e230432
commit 5120181e0e
5 changed files with 22 additions and 19 deletions

View File

@ -0,0 +1,4 @@
"""Constants for the Facebox component."""
DOMAIN = "facebox"
SERVICE_TEACH_FACE = "teach_face"

View File

@ -15,7 +15,6 @@ from homeassistant.components.image_processing import (
CONF_SOURCE,
CONF_ENTITY_ID,
CONF_NAME,
DOMAIN,
)
from homeassistant.const import (
CONF_IP_ADDRESS,
@ -27,6 +26,8 @@ from homeassistant.const import (
HTTP_UNAUTHORIZED,
)
from .const import DOMAIN, SERVICE_TEACH_FACE
_LOGGER = logging.getLogger(__name__)
ATTR_BOUNDING_BOX = "bounding_box"
@ -38,7 +39,6 @@ FACEBOX_NAME = "name"
CLASSIFIER = "facebox"
DATA_FACEBOX = "facebox_classifiers"
FILE_PATH = "file_path"
SERVICE_TEACH_FACE = "facebox_teach_face"
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(

View File

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

View File

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

View File

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