Skip to content

Image scan is failing #120

@schettada

Description

@schettada

I get the below error in logs when i try the image scan service.

HA Version: 2023.09.2
HASS-amazon-rekognition Version: 3.2

Logger: homeassistant.helpers.entity
Source: custom_components/amazon_rekognition/image_processing.py:363
Integration: amazon_rekognition (documentation)
First occurred: 1:46:08 PM (2 occurrences)
Last logged: 1:46:09 PM

Update for image_processing.rekognition_driveway_snapshots_main fails
Update for image_processing.rekognition_front_door_snapshots_main fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 683, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 936, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/image_processing/__init__.py", line 193, in async_update
    await self.async_process_image(image.content)
  File "/usr/src/homeassistant/homeassistant/components/image_processing/__init__.py", line 174, in async_process_image
    return await self.hass.async_add_executor_job(self.process_image, image)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/amazon_rekognition/image_processing.py", line 363, in process_image
    self._image.thumbnail(newsize, Image.ANTIALIAS)
                                   ^^^^^^^^^^^^^^^
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'


Below is my config.

- platform: amazon_rekognition
  aws_access_key_id: !secret rekogkey
  aws_secret_access_key: !secret rekogsec
  region_name: us-east-1
  confidence: 90
  targets:
    - target: person
    - target: car
    - target: animal
    - target: pet
    - target: cat
    - target: dog
      confidence: 50
  # roi_x_min: 0.35
  roi_x_max: 0.8
  roi_y_min: 0.4
  roi_y_max: 0.8
  scale: 0.75
  save_file_format: png
  save_file_folder: !secret rekofolder
  save_timestamped_file: true
  always_save_latest_file: true
  source:
    - entity_id: camera.driveway_snapshots_main

- platform: amazon_rekognition
  aws_access_key_id: !secret rekogkey
  aws_secret_access_key: !secret rekogsec
  region_name: us-east-1
  confidence: 90
  targets:
    - target: person
    - target: car
    - target: animal
    - target: pet
    - target: cat
    - target: dog
      confidence: 50
  # roi_x_min: 0.35
  roi_x_max: 0.8
  roi_y_min: 0.4
  roi_y_max: 0.8
  scale: 0.75
  save_file_format: png
  save_file_folder: !secret rekofolder
  save_timestamped_file: true
  always_save_latest_file: true
  source:
    - entity_id: camera.front_door_snapshots_main

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions