Lutron caseta - unable to find certificates after moving installation to docker

Hi all,
I’m scratching my head trying to figure out what has gone wrong here. I’ve been running this setup for well over 2 years updating every time a new release is out. My install method is virtualenv, so I have everything packed up underneath my config and i’m able to move from one venv to the next. My OS is aging (debian bullseye), so I finally decided to begin migrating my setup to a docker install instead which should still be portable. I’m using the official docker image. Everything seems to work, except my caseta integration.

From the logs, I see

homeassistant    | Traceback (most recent call last):                                                                                                        
homeassistant    |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 327, in async_setup                                                 
homeassistant    |     result = await component.async_setup_entry(hass, self)                                                                                
homeassistant    |   File "/usr/src/homeassistant/homeassistant/components/lutron_caseta/__init__.py", line 117, in async_setup_entry                        
homeassistant    |     bridge = Smartbridge.create_tls(                                                                                                      
homeassistant    |   File "/usr/local/lib/python3.9/site-packages/pylutron_caseta/smartbridge.py", line 110, in create_tls                                   
homeassistant    |     ssl_context.load_verify_locations(ca_certs)                                                                                           
homeassistant    | FileNotFoundError: [Errno 2] No such file or directory  

I have confirmed that the files are there, and the configuration has the correct paths to the files

bash-5.1# ls -al /app/support/lutron/
total 28
drwxr-xr-x    2 1001     1001          4096 Oct 29  2019 .
drwxr-xr-x    3 1001     1001          4096 Feb  6 19:50 ..
-rw-r--r--    1 1001     1001           790 Oct 29  2019 caseta-bridge.crt
-rw-r--r--    1 1001     1001          2149 Oct 29  2019 caseta.crt
-rw-r--r--    1 1001     1001          1704 Oct 29  2019 caseta.key

Relevant section of the config:

lutron_caseta:
  - host: 192.168.N.NN
    keyfile: /app/support/lutron/caseta.key
    certfile: /app/support/lutron/caseta.crt
    ca_certs: /app/support/lutron/caseta-bridge.crt

Again, this has been working for a very long time in a virtualenv install under my home directory, but now that i’m moving the install to docker, this is the only thing that does not work.

Anyone got any idea what’s wrong with this?

When running in a container, that container has its own filesystem (think chroot), so /app/support/lutron is not accessible to HA in the container unless you do a bind mount in your docker run command or your docker-compose.yaml file.

I do have /app/support/lutron bind mounted. The result of ls I posted on the initial post is from inside the container, so I know the files are there.

Here is the relevant portion of my docker-compose.yml:

                volumes:
                        - ./data/config:/config
                        - ./data/bin:/app/bin
                        - ./data/support:/app/support

Oh, ok.
As puzzled as you are, then…

For anyone who comes across this, I found a workaround for this issue.

Looks like the virtualenv install was happy having the certs and key files in config/lutron/, but this is not ok for a container installation. My work around was to move the certs and key files directly to the config/ dir and update my configuration.yaml to reflect the new paths.