mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Deprecate tensorflow (#145806)
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
This commit is contained in:
parent
e0d3b819e5
commit
fa66ea31d3
@ -1 +1,4 @@
|
|||||||
"""The tensorflow component."""
|
"""The tensorflow component."""
|
||||||
|
|
||||||
|
DOMAIN = "tensorflow"
|
||||||
|
CONF_GRAPH = "graph"
|
||||||
|
@ -26,15 +26,21 @@ from homeassistant.const import (
|
|||||||
CONF_SOURCE,
|
CONF_SOURCE,
|
||||||
EVENT_HOMEASSISTANT_START,
|
EVENT_HOMEASSISTANT_START,
|
||||||
)
|
)
|
||||||
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, template
|
from homeassistant.helpers import config_validation as cv, template
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.issue_registry import IssueSeverity, create_issue
|
||||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
from homeassistant.util.pil import draw_box
|
from homeassistant.util.pil import draw_box
|
||||||
|
|
||||||
|
from . import CONF_GRAPH, DOMAIN
|
||||||
|
|
||||||
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
|
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
|
||||||
|
|
||||||
DOMAIN = "tensorflow"
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
ATTR_MATCHES = "matches"
|
ATTR_MATCHES = "matches"
|
||||||
@ -47,7 +53,6 @@ CONF_BOTTOM = "bottom"
|
|||||||
CONF_CATEGORIES = "categories"
|
CONF_CATEGORIES = "categories"
|
||||||
CONF_CATEGORY = "category"
|
CONF_CATEGORY = "category"
|
||||||
CONF_FILE_OUT = "file_out"
|
CONF_FILE_OUT = "file_out"
|
||||||
CONF_GRAPH = "graph"
|
|
||||||
CONF_LABELS = "labels"
|
CONF_LABELS = "labels"
|
||||||
CONF_LABEL_OFFSET = "label_offset"
|
CONF_LABEL_OFFSET = "label_offset"
|
||||||
CONF_LEFT = "left"
|
CONF_LEFT = "left"
|
||||||
@ -110,6 +115,21 @@ def setup_platform(
|
|||||||
discovery_info: DiscoveryInfoType | None = None,
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up the TensorFlow image processing platform."""
|
"""Set up the TensorFlow image processing 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": "Tensorflow",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
model_config = config[CONF_MODEL]
|
model_config = config[CONF_MODEL]
|
||||||
model_dir = model_config.get(CONF_MODEL_DIR) or hass.config.path("tensorflow")
|
model_dir = model_config.get(CONF_MODEL_DIR) or hass.config.path("tensorflow")
|
||||||
labels = model_config.get(CONF_LABELS) or hass.config.path(
|
labels = model_config.get(CONF_LABELS) or hass.config.path(
|
||||||
|
9
requirements_test_all.txt
generated
9
requirements_test_all.txt
generated
@ -1560,6 +1560,9 @@ pybravia==0.3.4
|
|||||||
# homeassistant.components.cloudflare
|
# homeassistant.components.cloudflare
|
||||||
pycfdns==3.0.0
|
pycfdns==3.0.0
|
||||||
|
|
||||||
|
# homeassistant.components.tensorflow
|
||||||
|
# pycocotools==2.0.6
|
||||||
|
|
||||||
# homeassistant.components.comfoconnect
|
# homeassistant.components.comfoconnect
|
||||||
pycomfoconnect==0.5.1
|
pycomfoconnect==0.5.1
|
||||||
|
|
||||||
@ -2365,6 +2368,9 @@ temescal==0.5
|
|||||||
# homeassistant.components.temper
|
# homeassistant.components.temper
|
||||||
temperusb==1.6.1
|
temperusb==1.6.1
|
||||||
|
|
||||||
|
# homeassistant.components.tensorflow
|
||||||
|
# tensorflow==2.5.0
|
||||||
|
|
||||||
# homeassistant.components.tesla_fleet
|
# homeassistant.components.tesla_fleet
|
||||||
# homeassistant.components.teslemetry
|
# homeassistant.components.teslemetry
|
||||||
# homeassistant.components.tessie
|
# homeassistant.components.tessie
|
||||||
@ -2382,6 +2388,9 @@ teslemetry-stream==0.7.9
|
|||||||
# homeassistant.components.tessie
|
# homeassistant.components.tessie
|
||||||
tessie-api==0.1.1
|
tessie-api==0.1.1
|
||||||
|
|
||||||
|
# homeassistant.components.tensorflow
|
||||||
|
# tf-models-official==2.5.0
|
||||||
|
|
||||||
# homeassistant.components.thermobeacon
|
# homeassistant.components.thermobeacon
|
||||||
thermobeacon-ble==0.10.0
|
thermobeacon-ble==0.10.0
|
||||||
|
|
||||||
|
1
tests/components/tensorflow/__init__.py
Normal file
1
tests/components/tensorflow/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
"""TensorFlow component tests."""
|
40
tests/components/tensorflow/test_image_processing.py
Normal file
40
tests/components/tensorflow/test_image_processing.py
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
"""Tensorflow test."""
|
||||||
|
|
||||||
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
|
from homeassistant.components.image_processing import DOMAIN as IMAGE_PROCESSING_DOMAINN
|
||||||
|
from homeassistant.components.tensorflow import CONF_GRAPH, DOMAIN as TENSORFLOW_DOMAIN
|
||||||
|
from homeassistant.const import CONF_ENTITY_ID, CONF_MODEL, 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", tensorflow=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_DOMAINN,
|
||||||
|
{
|
||||||
|
IMAGE_PROCESSING_DOMAINN: [
|
||||||
|
{
|
||||||
|
CONF_PLATFORM: TENSORFLOW_DOMAIN,
|
||||||
|
CONF_SOURCE: [
|
||||||
|
{CONF_ENTITY_ID: "camera.test_camera"},
|
||||||
|
],
|
||||||
|
CONF_MODEL: {
|
||||||
|
CONF_GRAPH: ".",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
assert (
|
||||||
|
HOMEASSISTANT_DOMAIN,
|
||||||
|
f"deprecated_system_packages_yaml_integration_{TENSORFLOW_DOMAIN}",
|
||||||
|
) in issue_registry.issues
|
Loading…
x
Reference in New Issue
Block a user