HASwitchPlate / openHASP-custom-component

Home Assistant custom component for openHASP
https://www.openhasp.com
MIT License
51 stars 12 forks source link

2023.8.0 // module 'PIL.Image' has no attribute 'ANTIALIAS' #110

Closed stobiaskoch closed 1 year ago

stobiaskoch commented 1 year ago

Version of the custom_component

0.7.0 installed by HACS

Configuration

  sequence:
  - service: openhasp.push_image
    data:
      obj: p1b16
      height: 90
      width: 90
      image: '{{ state_attr(''media_player.buropaar_2'',''entity_picture'') }}20'
    target:
      entity_id: openhasp.plate_2

Describe the bug

While pushing an image over push_image error is thrown since HA 2023.8.0

Debug log

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 703, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 665, in _async_run_long_action return long_task.result() ^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call result = await task ^^^^^^^^^^ File "/config/custom_components/openhasp/init.py", line 607, in async_push_image rgb_image = await self.hass.async_add_executor_job( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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/openhasp/image.py", line 35, in image_to_rgb565 im.thumbnail((height, width), Image.ANTIALIAS) ^^^^^^^^^^^^^^^ AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

Changed image.py at line 35 from im.thumbnail((height, width), Image.ANTIALIAS) to im.thumbnail((height, width), Image.LANCZOS) fixes this

fvanroie commented 1 year ago

Thanks for your report. This is fixed in commit 932e5dd.

fvanroie commented 1 year ago

Fixed in Pre-release version 0.7.1