How do I prevent Home Assistant from shutting down in virtual environment?

Hello. I have a Raspberry Pi 3B. It is running on Raspbian Buster. This is my Pi Hole setup but I wanted to install Home Assistant. I found these instructions and followed them.

To access the raspberry pi, I am using the terminal app on my iMac.

The problem is that Home Assistant keeps shutting down. I’m not sure what events shut it down but when I close the terminal app, Home Assistant shuts down. Even if I keep the terminal app open but my mac goes to sleep, Home Assistant shuts down.

How do I keep Home Assistant from shutting down? Thanks.

You run Home Assistant Core in a venv, and start it from a SSH session. Any program (not just HA) started in a SSH session (except services) will shutdown when you close your SSH session. That is expected behavior.

The instructions to start HA as a service are linked on the page you linked above, but I repeat them here again :

https://www.home-assistant.io/docs/autostart/

Thanks. I am such a noob!

Another noob question. It seems there are 3 ways to so this: systemd, Upstart, and init.d. Which way should I use for Raspbian Buster?

You’d use systemd

Thanks you so very much.