Please advise how to run a Python3 script that is located outside HA directory on a Host machine?
I have a custom Python Yolo inference script that uses Nvidia CUDA (available form a host machine). Everything works pretty well, except impossibility to run this script from a shell_command within HA.
Is there a workaround for this?
If your script is outside of HA directory, you may have to whitelist the folder in Configuration>homeassistant>allowlist_external_dirs so HA can ‘see’ it.
My python scripts are inside HA folder and run fine on my Home Assistant Core using shell_command, for example:
I’ve tried to whitelist my folder /home/max/yolov5-flask/
and it seems that HA doesn’t allow it. I receive the error Not a directory @ data['allowlist_external_dirs'][1]
like here
Yeah, but allowlist_external_dirs if I place there my /home/... directory also gives same mistake.
My script when I execute the shell_command just leaves the error in the Log:
If I read this correctly, your Home Assistant is running as a guest VM with the Host having the Yolo/CUDA-hardware python executable. If correct, you may need to have HA treat Yolo/CUDA-hardware as being on a remote machine. There are a few threads around in the HA community on how to do this using ssh. Here is one of them:
I am using HA in docker, and it seems to be some kind of privileges issue specifically for my HA user. But I don’t understand what I need to do to make it fixed.
From a 3rd party PC I execute this script successfully & it does the job.
/home/max/yolov5-flask/
is my host machine (which concurrently runs Home Assistant docker) path.
Need help, scratching my head on finding solution.