OpenEPaperLink / Home_Assistant_Integration

Home assistant Integration for the OpenEPaperLink project
https://openepaperlink.de
Apache License 2.0
159 stars 35 forks source link

Hardcoded paths for the image storing in `/config` #112

Closed rohankapoorcom closed 9 months ago

rohankapoorcom commented 9 months ago

This integration appears to hardcode the path that the config directory is located in to /config. This works for users using Home Assistant OS or the docker container, but does not work for people who have core installed directly.

This breaks this integration completely with errors like the following:

Logger: homeassistant.components.automation.update_epaper_weather_displays
Source: helpers/script.py:468
Integration: Automation ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22))
First occurred: 12:10:33 PM (1 occurrences)
Last logged: 12:10:33 PM

Update ePaper Weather Displays: Error executing script. Unexpected error for call_service at pos 1: [Errno 13] Permission denied: '/config'
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/helpers/script.py", line 468, in _async_step
    await getattr(self, handler)()
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/helpers/script.py", line 704, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/helpers/script.py", line 666, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/core.py", line 2067, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.11/site-packages/homeassistant/core.py", line 2104, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/homeassistant/custom_components/open_epaper_link/__init__.py", line 42, in drawcustomservice
    imgbuff = await hass.async_add_executor_job(customimage,entity_id, service, hass)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/homeassistant/custom_components/open_epaper_link/imagegen.py", line 454, in customimage
    os.makedirs(pathc)
  File "<frozen os>", line 215, in makedirs
  File "<frozen os>", line 215, in makedirs
  File "<frozen os>", line 225, in makedirs
PermissionError: [Errno 13] Permission denied: '/config'

Please change these paths to be dynamically discovered from the config directory instead of hardcoding: