mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
move facebox service to facebox domain (#29151)
This commit is contained in:
parent
c72e230432
commit
5120181e0e
4
homeassistant/components/facebox/const.py
Normal file
4
homeassistant/components/facebox/const.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
"""Constants for the Facebox component."""
|
||||||
|
|
||||||
|
DOMAIN = "facebox"
|
||||||
|
SERVICE_TEACH_FACE = "teach_face"
|
@ -15,7 +15,6 @@ from homeassistant.components.image_processing import (
|
|||||||
CONF_SOURCE,
|
CONF_SOURCE,
|
||||||
CONF_ENTITY_ID,
|
CONF_ENTITY_ID,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
DOMAIN,
|
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_IP_ADDRESS,
|
CONF_IP_ADDRESS,
|
||||||
@ -27,6 +26,8 @@ from homeassistant.const import (
|
|||||||
HTTP_UNAUTHORIZED,
|
HTTP_UNAUTHORIZED,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from .const import DOMAIN, SERVICE_TEACH_FACE
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
ATTR_BOUNDING_BOX = "bounding_box"
|
ATTR_BOUNDING_BOX = "bounding_box"
|
||||||
@ -38,7 +39,6 @@ FACEBOX_NAME = "name"
|
|||||||
CLASSIFIER = "facebox"
|
CLASSIFIER = "facebox"
|
||||||
DATA_FACEBOX = "facebox_classifiers"
|
DATA_FACEBOX = "facebox_classifiers"
|
||||||
FILE_PATH = "file_path"
|
FILE_PATH = "file_path"
|
||||||
SERVICE_TEACH_FACE = "facebox_teach_face"
|
|
||||||
|
|
||||||
|
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||||
|
@ -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'
|
@ -6,16 +6,3 @@ scan:
|
|||||||
entity_id:
|
entity_id:
|
||||||
description: Name(s) of entities to scan immediately.
|
description: Name(s) of entities to scan immediately.
|
||||||
example: 'image_processing.alpr_garage'
|
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'
|
|
||||||
|
@ -261,7 +261,7 @@ async def test_teach_service(
|
|||||||
fb.FILE_PATH: MOCK_FILE_PATH,
|
fb.FILE_PATH: MOCK_FILE_PATH,
|
||||||
}
|
}
|
||||||
await hass.services.async_call(
|
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()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ async def test_teach_service(
|
|||||||
fb.FILE_PATH: MOCK_FILE_PATH,
|
fb.FILE_PATH: MOCK_FILE_PATH,
|
||||||
}
|
}
|
||||||
await hass.services.async_call(
|
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()
|
await hass.async_block_till_done()
|
||||||
assert "AuthenticationError on facebox" in caplog.text
|
assert "AuthenticationError on facebox" in caplog.text
|
||||||
@ -290,7 +290,7 @@ async def test_teach_service(
|
|||||||
fb.FILE_PATH: MOCK_FILE_PATH,
|
fb.FILE_PATH: MOCK_FILE_PATH,
|
||||||
}
|
}
|
||||||
await hass.services.async_call(
|
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()
|
await hass.async_block_till_done()
|
||||||
assert MOCK_ERROR_NO_FACE in caplog.text
|
assert MOCK_ERROR_NO_FACE in caplog.text
|
||||||
@ -305,7 +305,7 @@ async def test_teach_service(
|
|||||||
fb.FILE_PATH: MOCK_FILE_PATH,
|
fb.FILE_PATH: MOCK_FILE_PATH,
|
||||||
}
|
}
|
||||||
await hass.services.async_call(
|
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()
|
await hass.async_block_till_done()
|
||||||
assert "ConnectionError: Is facebox running?" in caplog.text
|
assert "ConnectionError: Is facebox running?" in caplog.text
|
||||||
|
Loading…
x
Reference in New Issue
Block a user