Restart / stop Home Assistant? Systemd

hi,
how to reboot over ssh when the webfrontend didnt respond anymore?
using the newest hassbian image

after half and hour the process didnt work anymore, it runs, but the webui diodnt respond

thanks

https://www.home-assistant.io/docs/installation/hassbian/common-tasks/

Stop, Start, Restart HASS:
sudo systemctl stop [email protected]
sudo systemctl start [email protected]
sudo systemctl restart [email protected]

2 Likes

In my experience you need to be diligent in seeing what actually gets recorded. I can some up with some cool ideas to create sensors but then fail to think about how data might be kept or anticipate duplicate info.

For example, I have a temp sensor in office which reports with 1 decimal but i prefer to keep it to whole number. So I made a template sensor with round.

Well, this means I should hide the original sensor from logbook and history since all I care about is the whole number custom sensor I made.

You may have entities which report back every few seconds and this fills your DB.

There are queries you can run against the HA database which will count the number of hits a given entity records. Use this to identify those which are filling up your db. They can be ignored from the recorder or history.

This is all annoying to be sure but I feel expected given nature of project.

Itā€™s very confusing to me, to see at one time the homeassistant user being mentioned as the user to start it from, and the other time I see the ā€˜piā€™ as user.

For example here (https://www.home-assistant.io/docs/autostart/systemd/) I read:

ā€œwith [your user] replaced by the user account that Home Assistant will run as (normally homeassistant).ā€

Yet I see tons of commands doing ā€œsudo systemctl start home-assistant@piā€ and concurrently I see tons of commands doing sudo systemctl start home-assistant@homeassistant

So Iā€™m very confused :-P.

Specs:

  • Plain installation of Raspbian with a user called ā€˜piā€™
  • Virtualenvironment created in /srv/homeassistant with a user homeassistant

So when do I need to use the pi user and when the homeassistant user?

I havenā€™t used a Pi in a while but itā€™s just your user / login account.

When Home Assistant was setup an account should have been created in order to run the software. In the old days it was hass but has since changed to homeassistant

This is the command I use to start home assistant

sudo systemctl start home-assistant@homeassistant

1 Like

It depends on how you installed Home Assistant.

If you installed Hassbian, or followed the Raspberry Pi install guide youā€™ll be using homeassistant. If you followed the basic install guide then probably youā€™ll be using pi.

In your case, homeassistant

1 Like

Yeah I found that out in the end. It technically did work with the pi user but it had no write access to itā€™s own configuration folders so I already was wondering why there was no known_devices.yaml and why I got tons of issues. But now it works fine :-). Itā€™s somewhat confusing because you never do something with the homeassistant account in the commands, only for the actual start of the program you need it.

There are times you may want to run commands as the homeassistant user.

I have a bunch of shell commands in my setup (which is why I donā€™t run HASSIO). The commands run under the homeassistant user account and I will switch to the home assistant userā€¦

sudo su -s /bin/bash homeassistant

and then run the command to confirm it works.

You also switch to the homeassistant user when you wish to upgrade

$ sudo su -s /bin/bash homeassistant # switch to homeassistant user
$ source /srv/homeassistant/bin/activate # activate the virtualenv
$ pip3 install --upgrade homeassistant #upgrade home assistant

1 Like