Setting path to hass in order to check configuration file

I am using HA installed on a Raspberry Pi via the All in One installer, and it is working very well, with one small exception.

I see references in the documentation to running “hass --script check_config” in order to check the syntax of config files, but I can only run it if I first cd to /srv/hass/hass_venv/bin.
Is this normal, or have I missed a step somewhere that would have set a path or symlink to allow running this command from the /home/hass/.homeassistant directory where the config files are stored?

Off the top of my head, I think it’s:

hass --script check_config -c /path/to/config

2 Likes

I’m going to follow this because I have never been able to get this command to work. I always get:

-bash: hass: command not found

You have to activate the virtual environment first using

source /srv/hass/hass_venv/bin/activate

1 Like

Ugggg, you know, that thought did pass through my mind believe it or not. However, in all the times I have seen that command on this site I have never seen it mentioned, so I assumed (yeah, I know), that it could be run without that. Thanks for the help @Bahnburner

Thanks for the quick replies. Now I just have to remember to use that command.

Hello,

I have a similar issue with a brand new AIO installer 0.37.1, even if I set the virtual env first:
pi@pi:~ $ source /srv/homeassistant/homeassistant_venv/bin/activate
(homeassistant_venv) pi@pi:~ $ hass --script check_config
Config does not exist: /home/pi/.homeassistant/configuration.yaml
(homeassistant_venv) pi@pi:~ $ hass --script check_config -c /home/homeassistant/.homeassistant/configuration.yaml
INFO:homeassistant.util.package:Attempting install of colorlog>2.1,<3
Exception:
Traceback (most recent call last):
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pip/basecommand.py”, line 215, in main
status = self.run(options, args)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pip/commands/install.py”, line 388, in run
ensure_dir(options.target_dir)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pip/utils/init.py”, line 83, in ensure_dir
os.makedirs(path)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/os.py”, line 237, in makedirs
mkdir(name, mode)
NotADirectoryError: [Errno 20] Not a directory: ‘/home/homeassistant/.homeassistant/configuration.yaml/deps’
Aborting scipt, could not install dependency colorlog>2.1,<3

finally, got it to work. Proper sequence is:
sudo su -s /bin/bash homeassistant
source /srv/homeassistant/homeassistant_venv/bin/activate
hass --script check_config

I’m still looking how to restart service without rebooting the PI.

How did you setup the service? If you used init.d, you can restart it with something like:
sudo service hass-daemon restart
(depending on what you called it)
That’s what I do.

I’m using sudo systemctl restart home-assistant.service (AIO installer).