8000 Deprecate dlib image processing integrations (#145767) · home-assistant/core@3164394 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3164394

Browse files
authored
Deprecate dlib image processing integrations (#145767)
1 parent b250a03 commit 3164394

File tree

9 files changed

+134
-3
lines changed

9 files changed

+134
-3
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
"""The dlib_face_detect component."""
2+
3+
DOMAIN = "dlib_face_detect"

homeassistant/components/dlib_face_detect/image_processing.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@
1111
ImageProcessingFaceEntity,
1212
)
1313
from homeassistant.const import ATTR_LOCATION, CONF_ENTITY_ID, CONF_NAME, CONF_SOURCE
14-
from homeassistant.core import HomeAssistant, split_entity_id
14+
from homeassistant.core import (
15+
DOMAIN as HOMEASSISTANT_DOMAIN,
16+
HomeAssistant,
17+
split_entity_id,
18+
)
1519
from homeassistant.helpers.entity_platform import AddEntitiesCallback
20+
from homeassistant.helpers.issue_registry import IssueSeverity, create_issue
1621
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
1722

23+
from . import DOMAIN
24+
1825
PLATFORM_SCHEMA = IMAGE_PROCESSING_PLATFORM_SCHEMA
1926

2027

@@ -25,6 +32,20 @@ def setup_platform(
2532
discovery_info: DiscoveryInfoType | None = None,
2633
) -> None:
2734
"""Set up the Dlib Face detection platform."""
35+
create_issue(
36+
hass,
37+
HOMEASSISTANT_DOMAIN,
38+
f"deprecated_system_packages_yaml_integration_{DOMAIN}",
39+
breaks_in_ha_version="2025.12.0",
40+
is_fixable=False,
41+
issue_domain=DOMAIN,
42+
severity=IssueSeverity.WARNING,
43+
translation_key="deprecated_system_packages_yaml_integration",
44+
translation_placeholders={
45+
"domain": DOMAIN,
46+
"integration_title": "Dlib Face Detect",
47+
},
48+
)
2849
source: list[dict[str, str]] = config[CONF_SOURCE]
2950
add_entities(
3051
DlibFaceDetectEntity(camera[CONF_ENTITY_ID], camera.get(CONF_NAME))
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
"""The dlib_face_identify component."""
2+
3+
CONF_FACES = "faces"
4+
DOMAIN = "dlib_face_identify"

homeassistant/components/dlib_face_identify/image_processing.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,20 @@
1515
ImageProcessingFaceEntity,
1616
)
1717
from homeassistant.const import ATTR_NAME, CONF_ENTITY_ID, CONF_NAME, CONF_SOURCE
18-
from homeassistant.core import HomeAssistant, split_entity_id
18+
from homeassistant.core import (
19+
DOMAIN as HOMEASSISTANT_DOMAIN,
20+
HomeAssistant,
21+
split_entity_id,
22+
)
1923
from homeassistant.helpers import config_validation as cv
2024
from homeassistant.helpers.entity_platform import AddEntitiesCallback
25+
from homeassistant.helpers.issue_registry import IssueSeverity, create_issue
2126
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
2227

28+
from . import CONF_FACES, DOMAIN
29+
2330
_LOGGER = logging.getLogger(__name__)
2431

25-
CONF_FACES = "faces"
2632

2733
PLATFORM_SCHEMA = IMAGE_PROCESSING_PLATFORM_SCHEMA.extend(
2834
{
@@ -39,6 +45,21 @@ def setup_platform(
3945
discovery_info: DiscoveryInfoType | None = None,
4046
) -> None:
4147
"""Set up the Dlib Face detection platform."""
48+
create_issue(
49+
hass,
50+
HOMEASSISTANT_DOMAIN,
51+
f"deprecated_system_packages_yaml_integration_{DOMAIN}",
52+
breaks_in_ha_version="2025.12.0",
53+
is_fixable=False,
54+
issue_domain=DOMAIN,
55+
severity=IssueSeverity.WARNING,
56+
translation_key="deprecated_system_packages_yaml_integration",
57+
translation_placeholders={
58+
"domain": DOMAIN,
59+
"integration_title": "Dlib Face Identify",
60+
},
61+
)
62+
4263
confidence: float = config[CONF_CONFIDENCE]
4364
faces: dict[str, str] = config[CONF_FACES]
4465
source: list[dict[str, str]] = config[CONF_SOURCE]

requirements_test_all.txt

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""The dlib_face_detect component."""
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""Dlib Face Identity Image Processing Tests."""
2+
3+
from unittest.mock import Mock, patch
4+
5+
from homeassistant.components.dlib_face_detect import DOMAIN as DLIB_DOMAIN
6+
from homeassistant.components.image_processing import DOMAIN as IMAGE_PROCESSING_DOMAIN
7+
from homeassistant.const import CONF_ENTITY_ID, CONF_PLATFORM, CONF_SOURCE
8+
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
9+
from homeassistant.helpers import issue_registry as ir
10+
from homeassistant.setup import async_setup_component
11+
12+
13+
@patch.dict("sys.modules", face_recognition=Mock())
14+
async def test_repair_issue_is_created(
15+
hass: HomeAssistant,
16+
issue_registry: ir.IssueRegistry,
17+
) -> None:
18+
"""Test repair issue is created."""
19+
assert await async_setup_component(
20+
hass,
21+
IMAGE_PROCESSING_DOMAIN,
22+
{
23+
IMAGE_PROCESSING_DOMAIN: [
24+
{
25+
CONF_PLATFORM: DLIB_DOMAIN,
26+
CONF_SOURCE: [
27+
{CONF_ENTITY_ID: "camera.test_camera"},
28+
],
29+
}
30+
],
31+
},
32+
)
33+
await hass.async_block_till_done()
34+
assert (
35+
HOMEASSISTANT_DOMAIN,
36+
f"deprecated_system_packages_yaml_integration_{DLIB_DOMAIN}",
37+
) in issue_registry.issues
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""The dlib_face_identify component."""
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""Dlib Face Identity Image Processing Tests."""
2+
3+
from unittest.mock import Mock, patch
4+
5+
from homeassistant.components.dlib_face_identify import (
6+
CONF_FACES,
7+
DOMAIN as DLIB_DOMAIN,
8+
)
9+
from homeassistant.components.image_processing import DOMAIN as IMAGE_PROCESSING_DOMAIN
10+
from homeassistant.const import CONF_ENTITY_ID, CONF_PLATFORM, CONF_SOURCE
11+
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
12+
from homeassistant.helpers import issue_registry as ir
13+
from homeassistant.setup import async_setup_component
14+
15+
16+
@patch.dict("sys.modules", face_recognition=Mock())
17+
async def test_repair_issue_is_created(
18+
hass: HomeAssistant,
19+
issue_registry: ir.IssueRegistry,
20+
) -> None:
21+
"""Test repair issue is created."""
22+
assert await async_setup_component(
23+
hass,
24+
IMAGE_PROCESSING_DOMAIN,
25+
{
26+
IMAGE_PROCESSING_DOMAIN: [
27+
{
28+
CONF_PLATFORM: DLIB_DOMAIN,
29+
CONF_SOURCE: [
30+
{CONF_ENTITY_ID: "camera.test_camera"},
31+
],
32+
CONF_FACES: {"person1": __file__},
33+
}
34+
],
35+
},
36+
)
37+
await hass.async_block_till_done()
38+
assert (
39+
HOMEASSISTANT_DOMAIN,
40+
f"deprecated_system_packages_yaml_integration_{DLIB_DOMAIN}",
41+
) in issue_registry.issues

0 commit comments

Comments
 (0)
0