Restart / stop Home Assistant? Systemd


#21

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


#22

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


#23

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.


#24

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 [email protected]” and concurrently I see tons of commands doing sudo systemctl start [email protected]

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?


#25

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 [email protected]


#26

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


#27

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.


#28

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