I am trying to get AppDaemon to autostart with systemd however I am struggling.
I have a file named [email protected] in /etc/systemd/system folder that looks like:
[Unit]
Description=AppDaemon service for Home Assistant
After=network.target mosquitto.service
[Service]
Type=simple
User=%i
ExecStart=/usr/local/bin/appdaemon -c /home/.homeassistant/appdaemon.cfg
Restart=on-failure
[Install]
WantedBy=multi-user.target
I then used the following commands:
sudo systemctl --system daemon-reload
sudo systemctl enable appdaemon@mgranger
sudo systemctl start appdaemon@mgranger
when i type:
sudo systemctl status appdaemon@mgranger
I get the following error:
[email protected] - AppDaemon service for Home Assistant
Loaded: loaded (/etc/systemd/system/[email protected] ; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Fri 2017-04-07 17:38:35 EDT; 239ms ago
Process: 3880 ExecStart=/usr/local/bin/appdaemon -c /.homeassistant/appdaemon.cfg (code=exited, status=1/FAILURE)
Main PID: 3880 (code=exited, status=1/FAILURE)
Apr 07 17:38:35 Finalizer systemd[1]: [email protected] : Unit entered failed state.
Apr 07 17:38:35 Finalizer systemd[1]: [email protected] : Failed with result 'exit-code'.
Apr 07 17:38:35 Finalizer systemd[1]: [email protected] : Service hold-off time over, scheduling restart.
Apr 07 17:38:35 Finalizer systemd[1]: Stopped AppDaemon service for Home Assistant.
Apr 07 17:38:35 Finalizer systemd[1]: [email protected] : Start request repeated too quickly.
Apr 07 17:38:35 Finalizer systemd[1]: Failed to start AppDaemon service for Home Assistant.
Any help would be greatly appreciated.
Mike_D
(Mike D.)
April 7, 2017, 10:13pm
2
What install method did you use? In hassbian that path should be /home/homeassistant/.homeassistant/
grangemd
(Matt)
April 7, 2017, 10:24pm
3
I used the PIP3 method and for home assistant I installed with python as well. I am sorry mine i have tried a couple of different things and forgot to change this back but I did try this as well and I have switched it back to this:
ExecStart=/usr/local/bin/appdaemon -c /home/homeassistant/.homeassistant/appdaemon.cfg
Also when I run the following from inside of the homeassistant folder in the command line it works but I can’t get autostart to work:
appdaemon -c appdaemon.cfg
garvarma
(Manuel)
April 7, 2017, 10:31pm
4
grangemd
(Matt)
April 7, 2017, 10:45pm
5
I was able to get home assistant to start with autostart however I am struggling to get app daemon to start.
garvarma
(Manuel)
April 7, 2017, 10:54pm
6
Hi,
As i told you i had the same problem, and i resolve it as link say.
grangemd
(Matt)
April 7, 2017, 11:28pm
7
So i assume you are talking about the command:
which hass
So i did this with:
which appdaemon
and my result was
/usr/local/bin/appdaemon
This is what i already had in the ExecStart line:
ExecStart=/usr/local/bin/appdaemon -c /home/homeassistant/.homeassistant/appdaemon.cfg
garvarma
(Manuel)
April 7, 2017, 11:43pm
8
Hello,
First of all, did you try to execute HA manually?
In the case that you did it and worked, then try to chage line “ExecStart” by this one:
ExecStart=/usr/local/bin/appdaemon -c “/home/homeassistant/.homeassistant/”
And then execute next commands:
sudo systemctl --system daemon-reload
sudo systemctl enable appdaemon@mgranger
sudo systemctl start appdaemon@mgranger
And check with the command status if work. But first be sure that you execute HA manually with appdaemon instruction
grangemd
(Matt)
April 8, 2017, 12:00am
9
So here is what i have determined and I don’t understand it. From the command line if I run:
/usr/local/bin/appdaemon -c /home/mgranger/.homeassistant/appdaemon.cfg
nothing happens; however if I cd /.homeassistant before I run this command then it works. Not sure why I have to be in the homeassitant folder first though.
garvarma
(Manuel)
April 8, 2017, 12:08am
10
nothing happens; however if I cd /.homeassistant before I run this command then it works. Not sure why I have to be in the homeassitant folder first though.
I’m not sure, but i understand that in second route, you must specify where is the configuration.yaml file, for HA can initialize with the configuration as you declare.
grangemd
(Matt)
April 8, 2017, 12:27am
11
This is kind of how I understand it too. The second route it for the appdaemon.cfg file location (not configuration.yaml) My appdaemon.cfg file is in the /.homeassistant folder
grangemd
(Matt)
April 8, 2017, 6:52pm
12
Anyone have any other ideas?
seems to me that you installed appdaemon in your homeassistant directory.
to start appdaemon you need to be in the directory where it is installed.
grangemd
(Matt)
April 9, 2017, 1:22am
14
So do i need to change where it is installed or is there a way to get into the homeassistant directory when I startup?
aimc
(Andrew Cockburn)
April 9, 2017, 7:07am
15
Does it actually start properly from the command line?
gpbenton
(Graham)
April 9, 2017, 8:02am
16
This would try and run appdaemon as user mgranger. If you have your appdaemon files in the homeassistant user’s directory (/home/homeassistant/.homeassistant/appdaemon.cfg), it probably doesn’t have the correct permissions to read or write them.
I suggest renaming the file [email protected]
which will run appdaemon as the homeassistant user. This is not only the place where you apparently have your appdaemon files, but is a restricted user, which will prevent appdaemon (or your apps) doing anything it shouldn’t to your system.
at first i would advice a visual program to see where you have what files installed.
on windows i use winscp and on the RPI i have the gui active.
programs like that let you easy and fast look through all kind off directories and subdirectories.
that is very helpfull to look at where you have which files installed.
i recommend so etwas because it seems like you dont know exactly where you have installed files at all.
grangemd
(Matt)
April 9, 2017, 12:28pm
18
aimc yes it works properly if I start it from the command line.
grangemd
(Matt)
April 9, 2017, 12:29pm
19
gpbenton I have tried running this as [email protected] but I get the same error.
grangemd
(Matt)
April 9, 2017, 12:36pm
20
ReneTode I am not sure if this is what you are looking for but his is the what I have in each folder using the ls command from the command line.
mgranger@Finalizer:~$ cd appdaemon
mgranger@Finalizer:~/appdaemon$ ls
API.md CODE_OF_CONDUCT.md HISTORY.md MANIFEST.in scripts
appdaemon conf LICENSE.md README.md setup.py
CLA.md Dockerfile log requirements.txt TUTORIAL.md
mgranger@Finalizer:~/appdaemon$ cd conf
mgranger@Finalizer:~/appdaemon/conf$ ls
appdaemon.cfg appdaemon.cfg.example apps examples examples.cfg
mgranger@Finalizer:~/appdaemon/conf$ cd
mgranger@Finalizer:~$ cd /etc/systemd/system
mgranger@Finalizer:/etc/systemd/system$ ls
[email protected] hibernate.target.wants
[email protected] [email protected]
bluetooth.target.wants hybrid-sleep.target.wants
dbus-org.bluez.service multi-user.target.wants
dbus-org.freedesktop.Avahi.service network-online.target.wants
dbus-org.freedesktop.ModemManager1.service paths.target.wants
dbus-org.freedesktop.nm-dispatcher.service plexmediaserver.service
dbus-org.freedesktop.thermald.service printer.target.wants
default.target.wants shutdown.target.wants
display-manager.service sockets.target.wants
display-manager.service.wants suspend.target.wants
final.target.wants sysinit.target.wants
getty.target.wants syslog.service
graphical.target.wants timers.target.wants
mgranger@Finalizer:/etc/systemd/system$ cd
mgranger@Finalizer:~$ cd .homeassistant
mgranger@Finalizer:~/.homeassistant$ ls
appdaemon device_tracker.yaml pyozw.sqlite
appdaemon.cfg google_calendars.yaml secrets.yaml
apps home-assistant.log sensor.yaml
automation home-assistant_v2.db switch.yaml
automation.yaml input_boolean.yaml tts
bravia.conf input_select.yaml tts.yaml
camera.yaml input_slider.yaml www
climate.yaml known_devices.yaml zwave.yaml
config light.yaml zwcfg_0xcabe0eaa.xml
configuration.yaml media_player.yaml zwcfg_0xdcb2da72.xml
cover.yaml notify.yaml zwscene.xml
customize.yaml OZW_Log.txt
deps plex.conf
mgranger@Finalizer:~/.homeassistant$