14
14
from typing import Tuple , Dict , List
15
15
from pathlib import Path
16
16
17
- from PIL import Image , ImageDraw
17
+ from PIL import Image , ImageDraw , UnidentifiedImageError
18
+ import voluptuous as vol
18
19
19
20
import codeprojectai .core as cpai
20
21
21
22
import homeassistant .helpers .config_validation as cv
22
23
import homeassistant .util .dt as dt_util
23
- import voluptuous as vol
24
24
from homeassistant .util .pil import draw_box
25
25
from homeassistant .components .image_processing import (
26
26
ATTR_CONFIDENCE ,
63
63
OBJECT_TYPES = [ANIMAL , OTHER , PERSON , VEHICLE ]
64
64
65
65
66
- CONF_API_KEY = "api_key"
67
66
CONF_TARGET = "target"
68
67
CONF_TARGETS = "targets"
69
68
CONF_TIMEOUT = "timeout"
81
80
CONF_CROP_ROI = "crop_to_roi"
82
81
83
82
DATETIME_FORMAT = "%Y-%m-%d_%H-%M-%S-%f"
84
- DEFAULT_API_KEY = ""
85
83
DEFAULT_TARGETS = [{CONF_TARGET : PERSON }]
86
84
DEFAULT_TIMEOUT = 10
87
85
DEFAULT_ROI_Y_MIN = 0.0
122
120
{
123
121
vol .Required (CONF_IP_ADDRESS ): cv .string ,
124
122
vol .Required (CONF_PORT ): cv .port ,
125
- vol .Optional (CONF_API_KEY , default = DEFAULT_API_KEY ): cv .string ,
123
+ // vol .Optional (CONF_API_KEY , default = DEFAULT_API_KEY ): cv .string ,
126
124
vol .Optional (CONF_TIMEOUT , default = DEFAULT_TIMEOUT ): cv .positive_int ,
127
125
vol .Optional (CONF_CUSTOM_MODEL , default = "" ): cv .string ,
128
126
vol .Optional (CONF_TARGETS , default = DEFAULT_TARGETS ): vol .All (
@@ -225,7 +223,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
225
223
object_entity = ObjectClassifyEntity (
226
224
ip_address = config .get (CONF_IP_ADDRESS ),
227
225
port = config .get (CONF_PORT ),
228
- api_key = config .get (CONF_API_KEY ),
229
226
timeout = config .get (CONF_TIMEOUT ),
230
227
custom_model = config .get (CONF_CUSTOM_MODEL ),
231
228
targets = config .get (CONF_TARGETS ),
@@ -255,7 +252,6 @@ def __init__(
255
252
self ,
256
253
ip_address ,
257
254
port ,
258
- api_key ,
259
255
timeout ,
260
256
custom_model ,
261
257
targets ,
@@ -279,7 +275,6 @@ def __init__(
279
275
self ._cpai_object = cpai .CodeProjectAIObject (
280
276
ip = ip_address ,
281
277
port = port ,
282
- api_key = api_key ,
283
278
timeout = timeout ,
284
279
min_confidence = MIN_CONFIDENCE ,
285
280
custom_model = custom_model ,
0 commit comments