Autostart problems on Raspbian

I manually installed Home Assistant on my Raspberry Pi2 as per the instructions here and it runs OK when I start it manually with
$ sudo -u homeassistant -H -s
$ source /srv/homeassistant/bin/activate
$ hass

I then tried to set up autostart as per the instructions here but it isn’t working. I created a file named [email protected] using WinSCP in /etc/systemd/system with permissions 0644 and the contents of the file are:

[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=%i
ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"

[Install]
WantedBy=multi-user.target

I also tried changing User=%i to User=pi and User=homeassistant but with no success. I’m not very experienced with Linux would be grateful for any help.

What output do you get from

$ systemctl status [email protected] 

and

$ sudo systemctl start [email protected] 

systemctl status [email protected]

gives the output: [email protected] - Home Assistant Loaded: loaded (/etc/systemd/system/[email protected]; dis Active: inactive (dead) lines 1-3/3 (END)

$ sudo systemctl start [email protected]

Does not give any output but if I then run

$ systemctl status [email protected]

I get:

[email protected] - Home Assistant

Loaded: loaded (/etc/systemd/system/[email protected]; dis

Active: active (running) since Thu 2018-08-23 18:06:06 UTC; 36s ago

 Main PID: 22528 (hass)

CGroup: /system.slice/system-home\x2dassistant.slice/home-assistant@homeassis

└─22528 /srv/homeassistant/bin/python3 /srv/homeassistant/bin/hass -c

Aug 23 18:06:23 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:23 INFO (MainThre

Aug 23 18:06:23 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:23 INFO (MainThre

Aug 23 18:06:23 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:23 INFO (MainThre

Aug 23 18:06:23 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:23 INFO (MainThre

Aug 23 18:06:23 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:23 INFO (MainThre

Aug 23 18:06:23 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:23 INFO (MainThre

Aug 23 18:06:23 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:23 INFO (MainThre

Aug 23 18:06:27 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:27 INFO (MainThre

Aug 23 18:06:27 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:27 INFO (Thread-1

Aug 23 18:06:28 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:28 INFO (MainThre

lines 1-17/17 (END)...skipping...

● [email protected] - Home Assistant

Loaded: loaded (/etc/systemd/system/[email protected]; disabled; vendor preset: enabled)

Active: active (running) since Thu 2018-08-23 18:06:06 UTC; 36s ago

 Main PID: 22528 (hass)

CGroup: /system.slice/system-home\x2dassistant.slice/[email protected]

└─22528 /srv/homeassistant/bin/python3 /srv/homeassistant/bin/hass -c /home/homeassistant/.homeassistant

Aug 23 18:06:23 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:23 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=config.config_entries>

Aug 23 18:06:23 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:23 INFO (MainThread) [homeassistant.setup] Setup of domain config took 4.7 seconds.

Aug 23 18:06:23 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:23 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=config>

Aug 23 18:06:23 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:23 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: service=google_say, domain=tts>

Aug 23 18:06:23 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:23 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: service=clear_cache, domain=tts>

Aug 23 18:06:23 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:23 INFO (MainThread) [homeassistant.setup] Setup of domain tts took 0.3 seconds.

Aug 23 18:06:23 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:23 INFO (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=tts>

Aug 23 18:06:27 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:27 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=None, entity_id=media_player.rebecca, new_state=<state media_player.rebecca=unavaila

Aug 23 18:06:27 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:27 INFO (Thread-18) [pychromecast] Querying device status

Aug 23 18:06:28 raspberrypi2-dwl hass[22528]: 2018-08-23 18:06:28 INFO (MainThread)

The output is truncated, but it looks like you have not enabled the service (see the next steps section of the auto start installation guide)

sudo systemctl enable [email protected]
1 Like

Thanks so much, that fixed it. Not sure how I managed to miss that!

1 Like