Where is homeassistant hiding?

I installed Home-Assistant in a virtual environment using the following guide:

I opened it manually:

$ hass --open-ui

And saw it posting weather data once a minute and concluded it was working.

I had to stop it while taking care of other things. I used Putty to access the command line in order to configure autostart and got the following responses:

klrock@orangepizero:~$ cd homeassistant

-bash: cd: homeassistant: No such file or directory

klrock@orangepizero:~$ hass --open -ui

Command ‘hass’ not found, did you mean:

command ‘sass’ from deb ruby-sass

command ‘pass’ from deb pass

command ‘ass’ from deb irpas

Try: sudo apt install <deb name>

klrock@orangepizero:~$ whereis hass

hass:

It apparently knows where hass is but does not give the path. In fact, I now cannot find the location of anything associated with Home Assistant. It is apparently hidden and I have visited many websites to find out how to unhide it.

I am close to wiping out this installation, if I can, and starting over. But I would still like to learn what caused this and how to undo it.

Your assistance would be greatly appreciated.

Did you not install it as a separate user?

If so you’ll need to look in that user’s home directory.

The directory is .homeassistant (note the dot)

This is how I access the HA install in my virtual environment"

sudo su -s /bin/bash homeassistant
source /srv/homeassistant/bin/activate

Not sure if that is still the same with the latest instructions.

Once you have set it up to run as a daemon you can also manage it with:

sudo systemctl start/restart/stop home-assistant@homeassistant

or however, you set it up as a service.

The path to all your config files might be
/home/homeassistant/.homeassistant/

Searching in my home directory .homeassistant is not found. Same for a global search.

Those command results are:
klrock@orangepizero:~$ sudo su -s /bin/bash homeassistant
No passwd entry for user ‘homeassistant’
klrock@orangepizero:~$ source /srv/homeassistant/bin/activate
-bash: /srv/homeassistant/bin/activate: No such file or directory

Repeat the first 3 steps from the install instructions.

Just to be a little more explicit, the virtual environment needs to be activated in order to use it, so you need to

change to virtual environment directory (called homeassistant if you followed the steps in your link)

cd homeassistant

Activate the virtual environment

source bin/activate

Then hass is available in the path and

hass --open-ui

will work.

You can start HA directly by specifying the exact path within the virtual environment, which is what the autostart procedure does, but the above procedure makes it explicit what is happening.

Thanks for enlarging @gpbenton, I was on my tablet and typing all that was too hard.

Thought I was on the wrong forum for a second there…

2 Likes

Thanks for the suggestions. I have moved forward now and just tried to install Home Assistant resulting in the following error:
root@orangepizero:~# cd /srv

root@orangepizero:/srv# sudo mkdir homeassistant

root@orangepizero:/srv#

root@orangepizero:/srv# sudo useradd -rm homeassistant

root@orangepizero:/srv# sudo chown homeassistant:homeassistant homeassistant

root@orangepizero:/srv# sudo -u homeassistant -H -s

homeassistant@orangepizero:/srv$ cd /srv/homeassistant

homeassistant@orangepizero:/srv/homeassistant$ python3 -m venv .

homeassistant@orangepizero:/srv/homeassistant$ source bin/activate

(homeassistant) homeassistant@orangepizero:/srv/homeassistant$ /srv/homeassistant $ python3 -m pip install wheel

bash: /srv/homeassistant: Is a directory

(homeassistant) homeassistant@orangepizero:/srv/homeassistant$ sudo chown homeassistant:homeassistant homeassistant

[sudo] password for homeassistant:

Sorry, try again.

[sudo] password for homeassistant:

Sorry, try again.

[sudo] password for homeassistant:

sudo: 3 incorrect password attempts

(homeassistant) homeassistant@orangepizero:/srv/homeassistant$ chown homeassistant:homeassistant homeassistant

chown: cannot access ‘homeassistant’: No such file or directory

(homeassistant) homeassistant@orangepizero:/srv/homeassistant$

(homeassistant) homeassistant@orangepizero:/srv/homeassistant$ python3 -m pip install wheel

Collecting wheel ………….

Complete output from command /srv/homeassistant/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-build-jkw23df_/cryptography/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” bdist_wheel -d /tmp/tmpz71p_0evpip-wheel- --python-tag cp36:

c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory

#include <ffi.h>

compilation terminated.

Googled this to this site: https://stackoverflow.com/questions/22073516/failed-to-install-python-cryptography-package-with-pip-and-setup-py where the following was suggested:

sudo apt-get install libffi-dev g++ libssl-dev

which led to this:

(homeassistant) homeassistant@orangepizero:/srv/homeassistant$ sudo apt-get install libffi-dev g++ libssl-dev

[sudo] password for homeassistant:

Here we go again. I think I may have left something out or done it out of order. The folder system has become very confusing.

Looks like you’ve got a bit lost working through that, you’ve pasted in parts of prompts, and repeated steps.

A few things:

  1. You can’t use sudo as homeassistant, use root (no need for sudo) or an account that does have sudo access.
  2. Formatting your post (see the big blue box at the top) makes a huge difference to people being able to read your posts

There quite a few commands with errors due to my bad typine. I tried to clean this up by removing, but apparently missed some. Sorry about that.

1 The only use of sudo as homeassistant was:
(homeassistant) homeassistant@orangepizero:/srv/homeassistant$ sudo chown homeassistant:homeassistant homeassistant.
I tried it without sudo just now
homeassistant@orangepizero:/srv/homeassistant$ chown homeassistant:homeassistant homeassistant
chown: cannot access ‘homeassistant’: No such file or directory

  1. I tried the formatting but did not see much difference.

You can only chown as root, or with sudo, and as I said, you can’t use sudo with Home Assistant.

Formatting makes a big difference for others. For example

switch:

  • platform: template
    switches:
    skylight:
    value_template: “{{ is_state(‘sensor.skylight’, ‘on’) }}”

If you tried to use that switch template as it appears to be, you’d end up in a mess, because it’s really:

switch:
  - platform: template
    switches:
      skylight:
        value_template: "{{ is_state('sensor.skylight', 'on') }}"

Now, honestly, maybe you should have a look at the platforms the Hass.io installer supports and buy one of those. You’ll find it much easier than you’re finding it so far, since you don’t need to learn so much about Linux.

I am actually using this as an exercise to help me learn about Linux and make something useful at the same time.

The last install I tried led me to this site where the install method has been updated:
https://github.com/home-assistant/home-assistant.io/commit/a757a34c4005c0326c5bb0a81e7687927ba36f13

I used this method but had to add the follow commands to get a good installation of Home Assistant:
apt-get update && apt-get install -y python-pip libpython-dev
pip install awscli
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
pip3 install wheel

The install worked and HASS started publishing sun data once a minute.
I opened the HASS web interface and logged in.

Unfortunately, I unplugged the orange Pi to rearrange some things and when I restarted it, I had no access to Homeassistant. Could not find the directory either.

I am now reinstalling per:https://github.com/home-assistant/home-assistant.io/commit/a757a34c4005c0326c5bb0a81e7687927ba36f13
When I get to the step
sudo su -s /bin/bash homeassistant
It responds:
No passwd entry for user ‘homeassistant’
and it leaves me at root@orangpizero rather than switching me to the homeassistant user.

Any thoughts?

Thanks for your patience

You haven’t created the homeassistant user.

Presuming you have installed all the requirements as root prior to this point you want…

sudo useradd -rm homeassistant
sudo usermod -aG dialout homeassistant
cd /srv
sudo mkdir homeassistant
sudo chown homeassistant:homeassistant homeassistant
sudo su -s /bin/bash homeassistant
cd /srv/homeassistant
python3.6 -m venv .
source bin/activate
pip3 install homeassistant
hass

(if you’re actually running as root you can drop the sudo, but if you’re trying to learn Linux at the same time, you should be aware that using root is bad practice and what you want is a ‘privileged user’ that can access most root functions via the Sudo command - but that’s a lesson for another day perhaps :wink: )

Thanks for your help Marc

Everything went well until the homeassistant install. It gave several instances of:

error: invalid command ‘bdist_wheel’
Failed building wheel for MarkupSafe and several others

It then showed setup done for 9 items

I had previously installed wheel

The following are all the items I installed prior to starting on homeassistant:

root@orangepizero:~# sudo apt-get install python3-pip python3-dev python3-venv
root@orangepizero:~# pip install awscli
root@orangepizero:~# apt install python-pip
root@orangepizero:~# sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
root@orangepizero:~# pip3 install wheel
root@orangepizero:~# sudo pip3 install --upgrade virtualenv

Did I leave anything out?

Ummm, reaching the limit of my expertise on this particular subwhere if I’m honest. Try doing…

sudo su -s /bin/bash homeassistant
source /srv/homeassistant/bin/activate 
pip3 install --upgrade wheel homeassistant

If this is your limit, your are still light years ahead of me. This worked and I started hass. The web configuration (hassio.local:8123) did not work, but I got the web interface using IP Address,8123, I signed in and it started loading data which it has been doing for over one hour now. One website said it might take 20 minutes. Is this an issue?. Must be, because I can’t do anything at this point

Another thought I still have the command line open via Putty. Could that prevent the web interface from getting the data?

You’re not using hassio, so hassio.local will never work :wink:

Clear the cache on your browser and try to log in again :+1: