i8beef / HomeAutio.Mqtt.GoogleHome

MIT License
215 stars 29 forks source link

Device configuration not found #75

Closed adukale closed 4 years ago

adukale commented 4 years ago

Hi, I've got everything set up and was able to see devices configured in UI. But after restarting and doing google actions I am getting this error. Device configuration file /home/adwait/config/googleDevices.json not found, starting with empty set I have tried removing the container and creating a new container but the device configuration not found error continues.

i8beef commented 4 years ago

Are you running in Docker I'm assuming? The file locations that are specified in the config file need to be specified in terms of the container, and usually relative to the app root running in the container. Its best to leave this alone:

  "deviceConfigFile": "config/googleDevices.json",

And then when you create the container mount a "config" directory into "/app/config" in the container:

  ... -v /srv/homeautio.mqtt.googlehome/config:/app/config ...

Then you just dump those config files into /srv/homeauto.mqtt.googlehome/config (or wherever you chose on the host system), and the container has access to those via the /app/config path its expecting inside the container.

i8beef commented 4 years ago

Also, make sure your permissions are correct and the user running the container has write permissions on the host file system (UUID needs to match for owner, if you're running as root it doesn't matter, but I would recommend running your container as a different user).

adukale commented 4 years ago

Thanks @i8beef I did mount the config and logs directory from current user's home directory so no permission issue. And yes I am running docker as root/sudo. The device config file got detected initially but later it is not detected. The container can access "appsettings.Production.json" from config. I modified "deviceConfigFile": "config/googleDevices.json" to "config/googleDevicesNew.json" just to debug this issue, then the logs showed this message Device configuration file /home/adwait/config/googleDevicesNew.json not found, starting with empty set but /home/adwait/config/googleDevicesNew.json file exists in config directory.

i8beef commented 4 years ago

/home/adwait/

^ this is what confuses me. If you are running the Docker container, everything in the Docker container will be looking at /app/ as a root. That it knows anything about your host system's FS makes me think you actually have "deviceConfigFile": "/home/adwait/config/googleDevices.json" in the config file, as you would have had to tell it to look for such a location...

adukale commented 4 years ago

@i8beef I got it. My bad. I put the actual path for deviceConfigFile, I should put the relative path for container directory. Thank you. :)

i8beef commented 4 years ago

Bingo 😄