Deprecate dlib image processing integrations (#145767)
parent
b250a03ff5
commit
3164394982
|
@ -1 +1,3 @@
|
|||
"""The dlib_face_detect component."""
|
||||
|
||||
DOMAIN = "dlib_face_detect"
|
||||
|
|
|
@ -11,10 +11,17 @@ from homeassistant.components.image_processing import (
|
|||
ImageProcessingFaceEntity,
|
||||
)
|
||||
from homeassistant.const import ATTR_LOCATION, CONF_ENTITY_ID, CONF_NAME, CONF_SOURCE
|
||||
from homeassistant.core import HomeAssistant, split_entity_id
|
||||
from homeassistant.core import (
|
||||
DOMAIN as HOMEASSISTANT_DOMAIN,
|
||||
HomeAssistant,
|
||||
split_entity_id,
|
||||
)
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.issue_registry import IssueSeverity, create_issue
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import DOMAIN
|
||||
|
||||
PLATFORM_SCHEMA = IMAGE_PROCESSING_PLATFORM_SCHEMA
|
||||
|
||||
|
||||
|
@ -25,6 +32,20 @@ def setup_platform(
|
|||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the Dlib Face detection platform."""
|
||||
create_issue(
|
||||
hass,
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
f"deprecated_system_packages_yaml_integration_{DOMAIN}",
|
||||
breaks_in_ha_version="2025.12.0",
|
||||
is_fixable=False,
|
||||
issue_domain=DOMAIN,
|
||||
severity=IssueSeverity.WARNING,
|
||||
translation_key="deprecated_system_packages_yaml_integration",
|
||||
translation_placeholders={
|
||||
"domain": DOMAIN,
|
||||
"integration_title": "Dlib Face Detect",
|
||||
},
|
||||
)
|
||||
source: list[dict[str, str]] = config[CONF_SOURCE]
|
||||
add_entities(
|
||||
DlibFaceDetectEntity(camera[CONF_ENTITY_ID], camera.get(CONF_NAME))
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
"""The dlib_face_identify component."""
|
||||
|
||||
CONF_FACES = "faces"
|
||||
DOMAIN = "dlib_face_identify"
|
||||
|
|
|
@ -15,14 +15,20 @@ from homeassistant.components.image_processing import (
|
|||
ImageProcessingFaceEntity,
|
||||
)
|
||||
from homeassistant.const import ATTR_NAME, CONF_ENTITY_ID, CONF_NAME, CONF_SOURCE
|
||||
from homeassistant.core import HomeAssistant, split_entity_id
|
||||
from homeassistant.core import (
|
||||
DOMAIN as HOMEASSISTANT_DOMAIN,
|
||||
HomeAssistant,
|
||||
split_entity_id,
|
||||
)
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.issue_registry import IssueSeverity, create_issue
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import CONF_FACES, DOMAIN
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
CONF_FACES = "faces"
|
||||
|
||||
PLATFORM_SCHEMA = IMAGE_PROCESSING_PLATFORM_SCHEMA.extend(
|
||||
{
|
||||
|
@ -39,6 +45,21 @@ def setup_platform(
|
|||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the Dlib Face detection platform."""
|
||||
create_issue(
|
||||
hass,
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
f"deprecated_system_packages_yaml_integration_{DOMAIN}",
|
||||
breaks_in_ha_version="2025.12.0",
|
||||
is_fixable=False,
|
||||
issue_domain=DOMAIN,
|
||||
severity=IssueSeverity.WARNING,
|
||||
translation_key="deprecated_system_packages_yaml_integration",
|
||||
translation_placeholders={
|
||||
"domain": DOMAIN,
|
||||
"integration_title": "Dlib Face Identify",
|
||||
},
|
||||
)
|
||||
|
||||
confidence: float = config[CONF_CONFIDENCE]
|
||||
faces: dict[str, str] = config[CONF_FACES]
|
||||
source: list[dict[str, str]] = config[CONF_SOURCE]
|
||||
|
|
|
@ -783,6 +783,10 @@ evolutionhttp==0.0.18
|
|||
# homeassistant.components.faa_delays
|
||||
faadelays==2023.9.1
|
||||
|
||||
# homeassistant.components.dlib_face_detect
|
||||
# homeassistant.components.dlib_face_identify
|
||||
# face-recognition==1.2.3
|
||||
|
||||
# homeassistant.components.fastdotcom
|
||||
fastdotcom==0.0.3
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
"""The dlib_face_detect component."""
|
|
@ -0,0 +1,37 @@
|
|||
"""Dlib Face Identity Image Processing Tests."""
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from homeassistant.components.dlib_face_detect import DOMAIN as DLIB_DOMAIN
|
||||
from homeassistant.components.image_processing import DOMAIN as IMAGE_PROCESSING_DOMAIN
|
||||
from homeassistant.const import CONF_ENTITY_ID, CONF_PLATFORM, CONF_SOURCE
|
||||
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
||||
@patch.dict("sys.modules", face_recognition=Mock())
|
||||
async def test_repair_issue_is_created(
|
||||
hass: HomeAssistant,
|
||||
issue_registry: ir.IssueRegistry,
|
||||
) -> None:
|
||||
"""Test repair issue is created."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
IMAGE_PROCESSING_DOMAIN,
|
||||
{
|
||||
IMAGE_PROCESSING_DOMAIN: [
|
||||
{
|
||||
CONF_PLATFORM: DLIB_DOMAIN,
|
||||
CONF_SOURCE: [
|
||||
{CONF_ENTITY_ID: "camera.test_camera"},
|
||||
],
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert (
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
f"deprecated_system_packages_yaml_integration_{DLIB_DOMAIN}",
|
||||
) in issue_registry.issues
|
|
@ -0,0 +1 @@
|
|||
"""The dlib_face_identify component."""
|
|
@ -0,0 +1,41 @@
|
|||
"""Dlib Face Identity Image Processing Tests."""
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from homeassistant.components.dlib_face_identify import (
|
||||
CONF_FACES,
|
||||
DOMAIN as DLIB_DOMAIN,
|
||||
)
|
||||
from homeassistant.components.image_processing import DOMAIN as IMAGE_PROCESSING_DOMAIN
|
||||
from homeassistant.const import CONF_ENTITY_ID, CONF_PLATFORM, CONF_SOURCE
|
||||
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
||||
@patch.dict("sys.modules", face_recognition=Mock())
|
||||
async def test_repair_issue_is_created(
|
||||
hass: HomeAssistant,
|
||||
issue_registry: ir.IssueRegistry,
|
||||
) -> None:
|
||||
"""Test repair issue is created."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
IMAGE_PROCESSING_DOMAIN,
|
||||
{
|
||||
IMAGE_PROCESSING_DOMAIN: [
|
||||
{
|
||||
CONF_PLATFORM: DLIB_DOMAIN,
|
||||
CONF_SOURCE: [
|
||||
{CONF_ENTITY_ID: "camera.test_camera"},
|
||||
],
|
||||
CONF_FACES: {"person1": __file__},
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert (
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
f"deprecated_system_packages_yaml_integration_{DLIB_DOMAIN}",
|
||||
) in issue_registry.issues
|
Loading…
Reference in New Issue