OpenEPaperLink / Home_Assistant_Integration

Home assistant Integration for the OpenEPaperLink project
Apache License 2.0
133 stars 32 forks source link

Integration attempts to write to root directory #70

Closed psfales closed 6 months ago

psfales commented 7 months ago

Describe the bug

Getting log messages like:

023-12-10 19:02:00.510 ERROR (MainThread) [homeassistant.components.script.epaper_clock2] Epaper Clock2: Error executing script. Unexpected error for call_service at pos 1: [Errno 13] Permission denied: '/config/www/open_epaper_link/open_epaper_link.000020b993188534.jpg'

To Reproduce

I believe this only started after upgrading to the latest release (0.3.6.2)

Expected behavior Integration should not write to directories under root, especially non-existent ones

Additional context I was able to work around the problem for now with:

mkdir -p /config/www/open_epaper_link
chmod 777 /config/www/open_epaper_link
emufan commented 6 months ago

The integration is storing/copying the generated images to the webserver-path you have linked. With this you can put them on the dashboard. Nothing else than HACS do if it places the custom UI elements there, etc.

psfales commented 6 months ago

I don't think this is a configurable option. The path is hardcoded in imagegen.py:

296      pathb = os.path.join("/config/www/open_epaper_link", str(entity_id).lower() + '.jpg')
297      pathc = "/config/www/open_epaper_link"
298      isExist = os.path.exists(pathc)
299      if not isExist:
300          os.makedirs(pathc)
psfales commented 6 months ago

How can I put the generated image on the dashboard? That sounds interesting and useful!

emufan commented 6 months ago

How can I put the generated image on the dashboard? That sounds interesting and useful!

It is generating a camera entitiy. Unfortunately you cannot find it bound and listed in the tag device (yet), but in your entitiy list.

And then just use HA-cards liks

type: picture-entity
show_state: false
show_name: false
camera_view: auto
entity: camera.00000xxxxxxxxx_cam
psfales commented 6 months ago

How can I put the generated image on the dashboard? That sounds interesting and useful!

It is generating a camera entitiy. Unfortunately you cannot find it bound and listed in the tag device (yet), but in your entitiy list.

And then just use HA-cards liks

type: picture-entity
show_state: false
show_name: false
camera_view: auto
entity: camera.00000xxxxxxxxx_cam

Yes, that's great. Thanks!

psfales commented 6 months ago

It would be nice if this could be fixed the same way that #51 was (keep everything under the open_epaper_link directory), but if that's a real problem for some reason, and you want to close this issue, I guess I can live with the current workaround.

jonasniesner commented 6 months ago

The problem is that the cam thing wont work if we do not write to that directory. The frontend can not access the open_epaper_link directory. Im closing it for now to better focus on the other issues but if it is important to you, I can add a configuration option.