Removes OpenALPR Local integration (#85544)

This commit is contained in:
Franck Nijhof 2023-01-17 10:43:14 +01:00 committed by GitHub
parent f7d69ee325
commit 566c0f63bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 81 additions and 534 deletions

View file

@ -5,9 +5,6 @@ from homeassistant.components.image_processing import (
FaceInformation, FaceInformation,
ImageProcessingFaceEntity, ImageProcessingFaceEntity,
) )
from homeassistant.components.openalpr_local.image_processing import (
ImageProcessingAlprEntity,
)
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
@ -22,44 +19,11 @@ def setup_platform(
"""Set up the demo image processing platform.""" """Set up the demo image processing platform."""
add_entities( add_entities(
[ [
DemoImageProcessingAlpr("camera.demo_camera", "Demo Alpr"),
DemoImageProcessingFace("camera.demo_camera", "Demo Face"), DemoImageProcessingFace("camera.demo_camera", "Demo Face"),
] ]
) )
class DemoImageProcessingAlpr(ImageProcessingAlprEntity):
"""Demo ALPR image processing entity."""
def __init__(self, camera_entity: str, name: str) -> None:
"""Initialize demo ALPR image processing entity."""
super().__init__()
self._attr_name = name
self._camera = camera_entity
@property
def camera_entity(self) -> str:
"""Return camera entity id from process pictures."""
return self._camera
@property
def confidence(self) -> int:
"""Return minimum confidence for send events."""
return 80
def process_image(self, image: bytes) -> None:
"""Process image."""
demo_data = {
"AC3829": 98.3,
"BE392034": 95.5,
"CD02394": 93.4,
"DF923043": 90.8,
}
self.process_plates(demo_data, 1)
class DemoImageProcessingFace(ImageProcessingFaceEntity): class DemoImageProcessingFace(ImageProcessingFaceEntity):
"""Demo face identify image processing entity.""" """Demo face identify image processing entity."""

View file

@ -10,25 +10,36 @@ import aiohttp
import async_timeout import async_timeout
import voluptuous as vol import voluptuous as vol
from homeassistant.components.image_processing import CONF_CONFIDENCE, PLATFORM_SCHEMA from homeassistant.components.image_processing import (
from homeassistant.components.openalpr_local.image_processing import ( ATTR_CONFIDENCE,
ImageProcessingAlprEntity, CONF_CONFIDENCE,
PLATFORM_SCHEMA,
ImageProcessingDeviceClass,
ImageProcessingEntity,
) )
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_API_KEY, CONF_API_KEY,
CONF_ENTITY_ID, CONF_ENTITY_ID,
CONF_NAME, CONF_NAME,
CONF_REGION, CONF_REGION,
CONF_SOURCE, CONF_SOURCE,
) )
from homeassistant.core import HomeAssistant, split_entity_id from homeassistant.core import HomeAssistant, callback, split_entity_id
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from homeassistant.util.async_ import run_callback_threadsafe
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
ATTR_PLATE = "plate"
ATTR_PLATES = "plates"
ATTR_VEHICLES = "vehicles"
EVENT_FOUND_PLATE = "image_processing.found_plate"
OPENALPR_API_URL = "https://api.openalpr.com/v1/recognize" OPENALPR_API_URL = "https://api.openalpr.com/v1/recognize"
OPENALPR_REGIONS = [ OPENALPR_REGIONS = [
@ -80,6 +91,72 @@ async def async_setup_platform(
async_add_entities(entities) async_add_entities(entities)
class ImageProcessingAlprEntity(ImageProcessingEntity):
"""Base entity class for ALPR image processing."""
_attr_device_class = ImageProcessingDeviceClass.ALPR
def __init__(self) -> None:
"""Initialize base ALPR entity."""
self.plates: dict[str, float] = {}
self.vehicles = 0
@property
def state(self):
"""Return the state of the entity."""
confidence = 0
plate = None
# search high plate
for i_pl, i_co in self.plates.items():
if i_co > confidence:
confidence = i_co
plate = i_pl
return plate
@property
def extra_state_attributes(self):
"""Return device specific state attributes."""
return {ATTR_PLATES: self.plates, ATTR_VEHICLES: self.vehicles}
def process_plates(self, plates: dict[str, float], vehicles: int) -> None:
"""Send event with new plates and store data."""
run_callback_threadsafe(
self.hass.loop, self.async_process_plates, plates, vehicles
).result()
@callback
def async_process_plates(self, plates: dict[str, float], vehicles: int) -> None:
"""Send event with new plates and store data.
Plates are a dict in follow format:
{ '<plate>': confidence }
This method must be run in the event loop.
"""
plates = {
plate: confidence
for plate, confidence in plates.items()
if self.confidence is None or confidence >= self.confidence
}
new_plates = set(plates) - set(self.plates)
# Send events
for i_plate in new_plates:
self.hass.async_add_job(
self.hass.bus.async_fire,
EVENT_FOUND_PLATE,
{
ATTR_PLATE: i_plate,
ATTR_ENTITY_ID: self.entity_id,
ATTR_CONFIDENCE: plates.get(i_plate),
},
)
# Update entity store
self.plates = plates
self.vehicles = vehicles
class OpenAlprCloudEntity(ImageProcessingAlprEntity): class OpenAlprCloudEntity(ImageProcessingAlprEntity):
"""Representation of an OpenALPR cloud entity.""" """Representation of an OpenALPR cloud entity."""

View file

@ -1 +0,0 @@
"""The openalpr_local component."""

View file

@ -1,240 +0,0 @@
"""Component that will help set the OpenALPR local for ALPR processing."""
from __future__ import annotations
import asyncio
import io
import logging
import re
import voluptuous as vol
from homeassistant.components.image_processing import (
ATTR_CONFIDENCE,
CONF_CONFIDENCE,
PLATFORM_SCHEMA,
ImageProcessingDeviceClass,
ImageProcessingEntity,
)
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_ENTITY_ID,
CONF_NAME,
CONF_REGION,
CONF_SOURCE,
)
from homeassistant.core import HomeAssistant, callback, split_entity_id
import homeassistant.helpers.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 homeassistant.util.async_ import run_callback_threadsafe
_LOGGER = logging.getLogger(__name__)
RE_ALPR_PLATE = re.compile(r"^plate\d*:")
RE_ALPR_RESULT = re.compile(r"- (\w*)\s*confidence: (\d*.\d*)")
EVENT_FOUND_PLATE = "image_processing.found_plate"
ATTR_PLATE = "plate"
ATTR_PLATES = "plates"
ATTR_VEHICLES = "vehicles"
OPENALPR_REGIONS = [
"au",
"auwide",
"br",
"eu",
"fr",
"gb",
"kr",
"kr2",
"mx",
"sg",
"us",
"vn2",
]
CONF_ALPR_BIN = "alpr_bin"
DEFAULT_BINARY = "alpr"
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
vol.Required(CONF_REGION): vol.All(vol.Lower, vol.In(OPENALPR_REGIONS)),
vol.Optional(CONF_ALPR_BIN, default=DEFAULT_BINARY): cv.string,
}
)
async def async_setup_platform(
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up the OpenALPR local platform."""
create_issue(
hass,
"openalpr_local",
"pending_removal",
breaks_in_ha_version="2022.10.0",
is_fixable=False,
severity=IssueSeverity.WARNING,
translation_key="pending_removal",
)
_LOGGER.warning(
"The OpenALPR Local is deprecated and will be removed in Home Assistant 2022.10"
)
command = [config[CONF_ALPR_BIN], "-c", config[CONF_REGION], "-"]
confidence = config[CONF_CONFIDENCE]
entities = []
for camera in config[CONF_SOURCE]:
entities.append(
OpenAlprLocalEntity(
camera[CONF_ENTITY_ID], command, confidence, camera.get(CONF_NAME)
)
)
async_add_entities(entities)
class ImageProcessingAlprEntity(ImageProcessingEntity):
"""Base entity class for ALPR image processing."""
_attr_device_class = ImageProcessingDeviceClass.ALPR
def __init__(self) -> None:
"""Initialize base ALPR entity."""
self.plates: dict[str, float] = {}
self.vehicles = 0
@property
def state(self):
"""Return the state of the entity."""
confidence = 0
plate = None
# search high plate
for i_pl, i_co in self.plates.items():
if i_co > confidence:
confidence = i_co
plate = i_pl
return plate
@property
def extra_state_attributes(self):
"""Return device specific state attributes."""
return {ATTR_PLATES: self.plates, ATTR_VEHICLES: self.vehicles}
def process_plates(self, plates: dict[str, float], vehicles: int) -> None:
"""Send event with new plates and store data."""
run_callback_threadsafe(
self.hass.loop, self.async_process_plates, plates, vehicles
).result()
@callback
def async_process_plates(self, plates: dict[str, float], vehicles: int) -> None:
"""Send event with new plates and store data.
plates are a dict in follow format:
{ '<plate>': confidence }
This method must be run in the event loop.
"""
plates = {
plate: confidence
for plate, confidence in plates.items()
if self.confidence is None or confidence >= self.confidence
}
new_plates = set(plates) - set(self.plates)
# Send events
for i_plate in new_plates:
self.hass.async_add_job(
self.hass.bus.async_fire,
EVENT_FOUND_PLATE,
{
ATTR_PLATE: i_plate,
ATTR_ENTITY_ID: self.entity_id,
ATTR_CONFIDENCE: plates.get(i_plate),
},
)
# Update entity store
self.plates = plates
self.vehicles = vehicles
class OpenAlprLocalEntity(ImageProcessingAlprEntity):
"""OpenALPR local api entity."""
def __init__(self, camera_entity, command, confidence, name=None):
"""Initialize OpenALPR local API."""
super().__init__()
self._cmd = command
self._camera = camera_entity
self._confidence = confidence
if name:
self._name = name
else:
self._name = f"OpenAlpr {split_entity_id(camera_entity)[1]}"
@property
def confidence(self):
"""Return minimum confidence for send events."""
return self._confidence
@property
def camera_entity(self):
"""Return camera entity id from process pictures."""
return self._camera
@property
def name(self):
"""Return the name of the entity."""
return self._name
async def async_process_image(self, image):
"""Process image.
This method is a coroutine.
"""
result = {}
vehicles = 0
alpr = await asyncio.create_subprocess_exec(
*self._cmd,
stdin=asyncio.subprocess.PIPE,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.DEVNULL,
)
# Send image
stdout, _ = await alpr.communicate(input=image)
stdout = io.StringIO(str(stdout, "utf-8"))
while True:
line = stdout.readline()
if not line:
break
new_plates = RE_ALPR_PLATE.search(line)
new_result = RE_ALPR_RESULT.search(line)
# Found new vehicle
if new_plates:
vehicles += 1
continue
# Found plate result
if new_result:
try:
result.update({new_result.group(1): float(new_result.group(2))})
except ValueError:
continue
self.async_process_plates(result, vehicles)

View file

@ -1,7 +0,0 @@
{
"domain": "openalpr_local",
"name": "OpenALPR Local",
"documentation": "https://www.home-assistant.io/integrations/openalpr_local",
"codeowners": [],
"iot_class": "local_push"
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"title": "The OpenALPR Local integration is being removed",
"description": "The OpenALPR Local integration is pending removal from Home Assistant and will no longer be available as of Home Assistant 2022.10.\n\nRemove the YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "La integraci\u00f3 d'OpenALPR Local s'eliminar\u00e0 de Home Assistant i deixar\u00e0 d'estar disponible a la versi\u00f3 de Home Assistant 2022.10.\n\nElimina la configuraci\u00f3 YAML corresponent del fitxer configuration.yaml i reinicia Home Assistant per arreglar aquest error.",
"title": "La integraci\u00f3 OpenALPR Local est\u00e0 sent eliminada"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "Die lokale OpenALPR-Integration wird derzeit aus dem Home Assistant entfernt und wird ab Home Assistant 2022.10 nicht mehr verf\u00fcgbar sein.\n\nEntferne die YAML-Konfiguration aus deiner configuration.yaml-Datei und starte Home Assistant neu, um dieses Problem zu beheben.",
"title": "Die lokale OpenALPR Integration wird entfernt"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "\u0397 \u03c4\u03bf\u03c0\u03b9\u03ba\u03ae \u03b5\u03bd\u03c3\u03c9\u03bc\u03ac\u03c4\u03c9\u03c3\u03b7 OpenALPR \u03b5\u03ba\u03ba\u03c1\u03b5\u03bc\u03b5\u03af \u03ba\u03b1\u03c4\u03ac\u03c1\u03b3\u03b7\u03c3\u03b7 \u03b1\u03c0\u03cc \u03c4\u03bf Home Assistant \u03ba\u03b1\u03b9 \u03b4\u03b5\u03bd \u03b8\u03b1 \u03b5\u03af\u03bd\u03b1\u03b9 \u03c0\u03bb\u03ad\u03bf\u03bd \u03b4\u03b9\u03b1\u03b8\u03ad\u03c3\u03b9\u03bc\u03b7 \u03b1\u03c0\u03cc \u03c4\u03bf Home Assistant 2022.10. \n\n \u039a\u03b1\u03c4\u03b1\u03c1\u03b3\u03ae\u03c3\u03c4\u03b5 \u03c4\u03b7 \u03b4\u03b9\u03b1\u03bc\u03cc\u03c1\u03c6\u03c9\u03c3\u03b7 YAML \u03b1\u03c0\u03cc \u03c4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf configuration.yaml \u03ba\u03b1\u03b9 \u03b5\u03c0\u03b1\u03bd\u03b5\u03ba\u03ba\u03b9\u03bd\u03ae\u03c3\u03c4\u03b5 \u03c4\u03bf Home Assistant \u03b3\u03b9\u03b1 \u03bd\u03b1 \u03b4\u03b9\u03bf\u03c1\u03b8\u03ce\u03c3\u03b5\u03c4\u03b5 \u03b1\u03c5\u03c4\u03cc \u03c4\u03bf \u03c0\u03c1\u03cc\u03b2\u03bb\u03b7\u03bc\u03b1.",
"title": "\u0397 \u03c4\u03bf\u03c0\u03b9\u03ba\u03ae \u03b5\u03bd\u03c3\u03c9\u03bc\u03ac\u03c4\u03c9\u03c3\u03b7 \u03c4\u03bf\u03c5 OpenALPR \u03ba\u03b1\u03c4\u03b1\u03c1\u03b3\u03b5\u03af\u03c4\u03b1\u03b9"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "The OpenALPR Local integration is pending removal from Home Assistant and will no longer be available as of Home Assistant 2022.10.\n\nRemove the YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue.",
"title": "The OpenALPR Local integration is being removed"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "La integraci\u00f3n OpenALPR Local est\u00e1 pendiente de eliminaci\u00f3n de Home Assistant y ya no estar\u00e1 disponible a partir de Home Assistant 2022.10. \n\nElimina la configuraci\u00f3n YAML de tu archivo configuration.yaml y reinicia Home Assistant para solucionar este problema.",
"title": "Se va a eliminar la integraci\u00f3n OpenALPR Local"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "OpenALPRi kohalik integratsioon on Home Assistantist eemaldamisel ja see ei ole enam saadaval alates Home Assistant 2022.10.\n\nProbleemi lahendamiseks eemaldage YAML-konfiguratsioon failist configuration.yaml ja k\u00e4ivitage Home Assistant uuesti.",
"title": "OpenALPR Locali integratsioon eemaldatakse"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "Az OpenALPR Local integr\u00e1ci\u00f3 elt\u00e1vol\u00edt\u00e1sra v\u00e1r a Home Assistantb\u00f3l, \u00e9s a 2022.10-es Home Assistant-t\u00f3l kezdve nem lesz el\u00e9rhet\u0151.\n\nA probl\u00e9ma megold\u00e1s\u00e1hoz t\u00e1vol\u00edtsa el a YAML konfigur\u00e1ci\u00f3t a configuration.yaml f\u00e1jlb\u00f3l, \u00e9s ind\u00edtsa \u00fajra a Home Assistantot.",
"title": "Az OpenALPR Local integr\u00e1ci\u00f3 elt\u00e1vol\u00edt\u00e1sra ker\u00fcl"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "Integrasi OpenALPR Local sedang menunggu penghapusan dari Home Assistant dan tidak akan lagi tersedia pada Home Assistant 2022.10.\n\nHapus konfigurasi YAML dari file configuration.yaml Anda dan mulai ulang Home Assistant untuk memperbaiki masalah ini.",
"title": "Integrasi OpenALPR dalam proses penghapusan"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "L'integrazione OpenALPR Local \u00e8 in attesa di rimozione da Home Assistant e non sar\u00e0 pi\u00f9 disponibile a partire da Home Assistant 2022.10. \n\nRimuovi la configurazione YAML dal file configuration.yaml e riavvia Home Assistant per risolvere questo problema.",
"title": "L'integrazione OpenALPR Local sar\u00e0 rimossa"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "OpenALPR \u30ed\u30fc\u30ab\u30eb\u7d71\u5408\u306f\u3001Home Assistant\u304b\u3089\u306e\u524a\u9664\u304c\u4fdd\u7559\u3055\u308c\u3066\u304a\u308a\u3001Home Assistant 2022.10\u4ee5\u964d\u306f\u5229\u7528\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002 \n\n\u3053\u306e\u554f\u984c\u3092\u89e3\u6c7a\u3059\u308b\u306b\u306f\u3001configuration.yaml\u30d5\u30a1\u30a4\u30eb\u304b\u3089YAML\u8a2d\u5b9a\u3092\u524a\u9664\u3057\u3001Home Assistant\u3092\u518d\u8d77\u52d5\u3057\u307e\u3059\u3002",
"title": "OpenALPR Local\u306e\u7d71\u5408\u306f\u524a\u9664\u3055\u308c\u3066\u3044\u307e\u3059"
}
}
}

View file

@ -1,7 +0,0 @@
{
"issues": {
"pending_removal": {
"title": "De OpenALPR Local-integratie wordt verwijderd"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "OpenALPR Local-integrasjonen venter p\u00e5 fjerning fra Home Assistant og vil ikke lenger v\u00e6re tilgjengelig fra og med Home Assistant 2022.10. \n\n Fjern YAML-konfigurasjonen fra configuration.yaml-filen og start Home Assistant p\u00e5 nytt for \u00e5 fikse dette problemet.",
"title": "OpenALPR Local-integrasjonen blir fjernet"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "Integracja OpenALPR Local oczekuje na usuni\u0119cie z Home Assistanta i nie b\u0119dzie ju\u017c dost\u0119pna od Home Assistant 2022.10. \n\nUsu\u0144 konfiguracj\u0119 YAML z pliku configuration.yaml i uruchom ponownie Home Assistanta, aby rozwi\u0105za\u0107 ten problem.",
"title": "Integracja OpenALPR Local zostanie usuni\u0119ta"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "A integra\u00e7\u00e3o do OpenALPR Local est\u00e1 pendente de remo\u00e7\u00e3o do Home Assistant e n\u00e3o estar\u00e1 mais dispon\u00edvel a partir do Home Assistant 2022.10. \n\n Remova a configura\u00e7\u00e3o YAML do arquivo configuration.yaml e reinicie o Home Assistant para corrigir esse problema.",
"title": "A integra\u00e7\u00e3o do OpenALPR Local est\u00e1 sendo removida"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f OpenALPR Local \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0438\u0437 Home Assistant \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0441 Home Assistant \u0432\u0435\u0440\u0441\u0438\u0438 2022.10. \n\n\u0423\u0434\u0430\u043b\u0438\u0442\u0435 YAML-\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 configuration.yaml \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 Home Assistant, \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443.",
"title": "\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f OpenALPR Local \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u0430"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "Integr\u00e1cia OpenALPR Local \u010dak\u00e1 na odstr\u00e1nenie z Home Assistant a od Home Assistant 2022.10 u\u017e nebude k dispoz\u00edcii. \n\n Ak chcete tento probl\u00e9m vyrie\u0161i\u0165, odstr\u00e1\u0148te konfigur\u00e1ciu YAML zo s\u00faboru configuration.yaml a re\u0161tartujte aplik\u00e1ciu Home Assistant.",
"title": "Lok\u00e1lna integr\u00e1cia OpenALPR sa odstra\u0148uje"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "OpenALPR Local integration v\u00e4ntar p\u00e5 borttagning fr\u00e5n Home Assistant och kommer inte l\u00e4ngre att vara tillg\u00e4nglig fr\u00e5n och med Home Assistant 2022.10. \n\n Ta bort YAML-konfigurationen fr\u00e5n filen configuration.yaml och starta om Home Assistant f\u00f6r att \u00e5tg\u00e4rda problemet.",
"title": "OpenALPR Local integrationen tas bort"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "OpenALPR Yerel entegrasyonu Home Assistant'tan kald\u0131r\u0131lmay\u0131 beklemektedir ve Home Assistant 2022.10'dan itibaren art\u0131k kullan\u0131lamayacakt\u0131r.\n\nYAML yap\u0131land\u0131rmas\u0131n\u0131 configuration.yaml dosyan\u0131zdan kald\u0131r\u0131n ve bu sorunu gidermek i\u00e7in Home Assistant'\u0131 yeniden ba\u015flat\u0131n.",
"title": "OpenALPR Yerel entegrasyonu kald\u0131r\u0131l\u0131yor"
}
}
}

View file

@ -1,8 +0,0 @@
{
"issues": {
"pending_removal": {
"description": "OpenALPR \u672c\u5730\u7aef\u6574\u5408\u5373\u5c07\u7531 Home Assistant \u4e2d\u79fb\u9664\u3001\u4e26\u65bc Home Assistant 2022.10 \u7248\u5f8c\u7121\u6cd5\u518d\u4f7f\u7528\u3002\n\n\u7531 configuration.yaml \u6a94\u6848\u4e2d\u79fb\u9664 YAML \u8a2d\u5b9a\u4e26\u91cd\u555f Home Assistant to \u4ee5\u4fee\u6b63\u6b64\u554f\u984c\u3002",
"title": "OpenALPR \u672c\u5730\u7aef\u6574\u5408\u5373\u5c07\u79fb\u9664"
}
}
}

View file

@ -3840,12 +3840,6 @@
"config_flow": false, "config_flow": false,
"iot_class": "cloud_push" "iot_class": "cloud_push"
}, },
"openalpr_local": {
"name": "OpenALPR Local",
"integration_type": "hub",
"config_flow": false,
"iot_class": "local_push"
},
"opencv": { "opencv": {
"name": "OpenCV", "name": "OpenCV",
"integration_type": "hub", "integration_type": "hub",

View file

@ -40,16 +40,6 @@ async def setup_image_processing(hass, aiohttp_unused_port):
await hass.async_block_till_done() await hass.async_block_till_done()
async def setup_image_processing_alpr(hass):
"""Set up things to be run when tests are started."""
config = {ip.DOMAIN: {"platform": "demo"}, "camera": {"platform": "demo"}}
await async_setup_component(hass, ip.DOMAIN, config)
await hass.async_block_till_done()
return async_capture_events(hass, "image_processing.found_plate")
async def setup_image_processing_face(hass): async def setup_image_processing_face(hass):
"""Set up things to be run when tests are started.""" """Set up things to be run when tests are started."""
config = {ip.DOMAIN: {"platform": "demo"}, "camera": {"platform": "demo"}} config = {ip.DOMAIN: {"platform": "demo"}, "camera": {"platform": "demo"}}
@ -119,77 +109,6 @@ async def test_get_image_without_exists_camera(
assert state.state == "0" assert state.state == "0"
async def test_alpr_event_single_call(hass, aioclient_mock):
"""Set up and scan a picture and test plates from event."""
alpr_events = await setup_image_processing_alpr(hass)
aioclient_mock.get(get_url(hass), content=b"image")
common.async_scan(hass, entity_id="image_processing.demo_alpr")
await hass.async_block_till_done()
state = hass.states.get("image_processing.demo_alpr")
assert len(alpr_events) == 4
assert state.state == "AC3829"
event_data = [
event.data for event in alpr_events if event.data.get("plate") == "AC3829"
]
assert len(event_data) == 1
assert event_data[0]["plate"] == "AC3829"
assert event_data[0]["confidence"] == 98.3
assert event_data[0]["entity_id"] == "image_processing.demo_alpr"
async def test_alpr_event_double_call(hass, aioclient_mock):
"""Set up and scan a picture and test plates from event."""
alpr_events = await setup_image_processing_alpr(hass)
aioclient_mock.get(get_url(hass), content=b"image")
common.async_scan(hass, entity_id="image_processing.demo_alpr")
common.async_scan(hass, entity_id="image_processing.demo_alpr")
await hass.async_block_till_done()
state = hass.states.get("image_processing.demo_alpr")
assert len(alpr_events) == 4
assert state.state == "AC3829"
event_data = [
event.data for event in alpr_events if event.data.get("plate") == "AC3829"
]
assert len(event_data) == 1
assert event_data[0]["plate"] == "AC3829"
assert event_data[0]["confidence"] == 98.3
assert event_data[0]["entity_id"] == "image_processing.demo_alpr"
@patch(
"homeassistant.components.demo.image_processing.DemoImageProcessingAlpr.confidence",
new_callable=PropertyMock(return_value=95),
)
async def test_alpr_event_single_call_confidence(confidence_mock, hass, aioclient_mock):
"""Set up and scan a picture and test plates from event."""
alpr_events = await setup_image_processing_alpr(hass)
aioclient_mock.get(get_url(hass), content=b"image")
common.async_scan(hass, entity_id="image_processing.demo_alpr")
await hass.async_block_till_done()
state = hass.states.get("image_processing.demo_alpr")
assert len(alpr_events) == 2
assert state.state == "AC3829"
event_data = [
event.data for event in alpr_events if event.data.get("plate") == "AC3829"
]
assert len(event_data) == 1
assert event_data[0]["plate"] == "AC3829"
assert event_data[0]["confidence"] == 98.3
assert event_data[0]["entity_id"] == "image_processing.demo_alpr"
async def test_face_event_call(hass, aioclient_mock): async def test_face_event_call(hass, aioclient_mock):
"""Set up and scan a picture and test faces from event.""" """Set up and scan a picture and test faces from event."""
face_events = await setup_image_processing_face(hass) face_events = await setup_image_processing_face(hass)