I made the changes you indicated to me in image_processing.py and it looked like this
def process_image(self, image):
"""Process an image."""
try:
detections = self._api.detect(image)
if not detections in None:
self.faces = hound.get_faces(detections)
self.people = hound.get_people(detections)
metadata = hound.get_metadata(detections)
self._image_width = metadata["image_width"]
self._image_height = metadata["image_height"]
self._state = len(self.people)
if self._state > 0:
self._last_detection = dt_util.now().strftime(DATETIME_FORMAT)
if hasattr(self, "_save_file_folder") and self._state > 0:
self.save_image(image, self.people, self.faces, self._save_file_folder)
for face in self.faces:
self.fire_face_detected_event(face)
for person in self.people:
self.fire_person_detected_event(person)
except hound.SimplehoundException as exc:
_LOGGER.error(str(exc))
self.faces = []
self.people = []
self._image_width = None
self._image_height = None
when you run the automation it gives the following error
Wed Feb 26 2020 22:14:56 GMT-0300 (hora estándar de Argentina)
Update for image_processing.sighthound_cgaleria fails
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 279, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 459, in async_device_update
await self.async_update()
File “/usr/src/homeassistant/homeassistant/components/image_processing/init.py”, line 132, in async_update
await self.async_process_image(image.content)
File “/usr/src/homeassistant/homeassistant/components/image_processing/init.py”, line 112, in async_process_image
return await self.hass.async_add_job(self.process_image, image)
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/sighthound/image_processing.py”, line 112, in process_image
if not detections in None:
TypeError: argument of type ‘NoneType’ is not iterable
Automatization.yaml
id: scan
alias: Camera Picture Galeria
trigger:
entity_id: binary_sensor.camaragaleria
platform: state
to: ‘on’
action:
I have it now creating images when I run image_processing.scan but how do I trigger a motion? I see the automation’s examples but I don’t see from say logs what to look for? Scan interval 1000 every 15 minutes is good if there is a face detected but generally this is not the case. So what I need or is missing is how to trigger the image_processing.scan per camera when there is a face detected?
But I never have an event of face recognition… even if I stare at the camera…
In the logs:
2020-04-18 23:47:16 WARNING (MainThread) [homeassistant.helpers.entity] Update of image_processing.dlib_face_veranda is taking over 10 seconds
2020-04-18 23:47:16 ERROR (MainThread) [homeassistant.components.image_processing] Error on receive image from entity: Unable to get image
@robmarkcole I tried to use your component, but I get the following error:
2020-04-19 12:02:20 ERROR (MainThread) [homeassistant.config] Platform error: image_processing
Traceback (most recent call last):
File "C:\Python38\lib\site-packages\homeassistant\config.py", line 769, in async_process_component_config
platform = p_integration.get_platform(domain)
File "C:\Python38\lib\site-packages\homeassistant\loader.py", line 276, in get_platform
cache[full_name] = importlib.import_module(
File "C:\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\stefa\AppData\Roaming\.homeassistant\custom_components\sighthound\image_processing.py", line 19, in <module>
from homeassistant.components.image_processing import (
ImportError: cannot import name 'draw_box' from 'homeassistant.components.image_processing' (C:\Python38\lib\site-packages\homeassistant\components\image_processing\__init__.py)