Made progress. The type showed me what I needed for the ExecStart.
I made the change and rebooted, still showed failed. I updated my service start config.
Here is a screen shot showing you the type command, my config, and showing the ExecStart is now configure (I copy it and ran it on the command line, at bottom.
I had to change two things.
I changed the user=%i to user=root.
Then I got an error my execstart was not an absolute path, sure enough there was not root /
First when I ran the ‘type appdaemon’ I and saw what I needed, I must have missed the first /.
So then it started. I went back and changed root back to %i and it failed.
What is %i ?
Now the log makes since, the %i was before the execstart, that is why there never was any logs after I changed the user to root, then it made it down enough to find the path error on the execstart command.
will try to run as the appdaemon user, which probably doesn’t exist.
Rename the file to [email protected], or set user=homeassistant (or even user pi as I don’t think it makes a difference) . Running as root is probably not a good idea for security reasons.
Can I add one more thing under the systemctl config.
I just restarted hass and lost my appdaemon. I saw something where if one of the required stops, you stop. What I not sure is when the required starts how to start you. Just wanted to throw that thought while were in the area.
Sorry miscommunication, I was asking how long before AppDaemon reconnect to hass once hass is back up?
I didn’t time it, but it seems like after about 20 seconds it wasn’t reconnected yet, at least my dashboard didn’t connect .
Next time I will try and bee more scientific .
The logs should tell the story. HADashboard will stay connected over a hass restart, AppDaemon will reconnect to hass within 5 seconds of it becoming available.
I had to reload my hass for configuration change. The HADashborad dropped as expected, but did not connect. Let me document some of my observations, then I will see if it does it every time.
The log does not show any activity from when hass dropped till I restarted appdaemon. Also I ran status before the restart and it showed appdaemon was running.
2017-07-15 11:55:33.220262 WARNING 'text_sensor' widget is deprecated, please use 'sensor' instead for widget 'mode'
2017-07-15 11:55:34.119485 INFO function [compile_dash] finished in 1510 ms
2017-07-15 11:55:34.471150 INFO Dashboard disconnected
2017-07-15 11:55:38.443345 INFO New dashboard connected: Main Panel
2017-07-15 13:27:44.352984 INFO AppDaemon Version 2.0.4 starting
2017-07-15 13:27:44.353708 INFO Configuration read from: /home/homeassistant/.homeassistant/AppDaemon/conf/appdaemon.yaml
2017-07-15 13:27:44.534526 INFO Got initial state
2017-07-15 13:27:44.543922 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/apps/hello.py
2017-07-15 13:27:44.548469 INFO Loading Object hello_world using class HelloWorld from module hello
2017-07-15 13:27:44.704949 INFO hello_world: Hello from AppDaemon
2017-07-15 13:27:44.707739 INFO hello_world: You are now ready to run Apps!
2017-07-15 13:27:44.708324 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/modes.py
2017-07-15 13:27:44.710166 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/grandfather.py
2017-07-15 13:27:44.712027 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/smart_heat.py
2017-07-15 13:27:44.713931 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/outside_lights.py
2017-07-15 13:27:44.715699 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/momentary_switch.py
2017-07-15 13:27:44.717464 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/battery.py
2017-07-15 13:27:44.719243 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/sensor_notification.py
2017-07-15 13:27:44.721028 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/sensor_notify.py
2017-07-15 13:27:44.722822 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/switch_reset.py
2017-07-15 13:27:44.732205 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/motion_lights.py
2017-07-15 13:27:44.734241 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/dark_day.py
2017-07-15 13:27:44.736097 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/presence.py
2017-07-15 13:27:44.737916 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/motion_notification.py
2017-07-15 13:27:44.739688 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/minimote.py
2017-07-15 13:27:44.742143 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/door_notification.py
2017-07-15 13:27:44.745548 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/hwcheck.py
2017-07-15 13:27:44.748771 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/sound.py
2017-07-15 13:27:44.752073 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/ObjectTracker/objectcontrole.py
2017-07-15 13:27:44.755184 INFO Loading Module: /home/homeassistant/.homeassistant/AppDaemon/conf/example_apps/ObjectTracker/general_app_functions.py
2017-07-15 13:27:44.758200 INFO App initialization complete
2017-07-15 13:27:44.759770 INFO Starting dashboard
2017-07-15 13:27:44.795619 INFO Connected to Home Assistant 0.48.1
2017-07-15 13:28:04.514004 INFO New dashboard connected: Test Panel
2017-07-15 13:28:16.712820 INFO function [compile_dash] finished in 16 ms
2017-07-15 13:28:20.881114 INFO New dashboard connected: Main Panel
Here you can see appdaemon was running but dead (whatever that means)
pi@hassbian:~ $ systemctl status [email protected]
● [email protected] - AppDaemon
Loaded: loaded (/etc/systemd/system/[email protected]; enabled)
Active: inactive (dead) since Sat 2017-07-15 13:13:14 UTC; 13min ago
Process: 4304 ExecStart=/usr/local/bin/appdaemon -c /home/homeassistant/.homeassistant/AppDaemon/conf (code=killed, signal=TERM)
Main PID: 4304 (code=killed, signal=TERM)
pi@hassbian:~ $ systemctl restart [email protected]
Failed to restart [email protected]: Access denied
pi@hassbian:~ $ sudo systemctl restart [email protected]
pi@hassbian:~ $
Just for future lookers my hass .48.1 and appdamon is 2.0.4.
I can reproduce what I am seeing every time.
restart hass and dashboard does not seem to reconnect.
Something is terminating it - presumably systemctl, when hass stops?
I have a very cut down systemctl file that works fine:
[Unit]
Description=AppDaemon service for Home Assistant
[Service]
ExecStart=/usr/local/bin/appdaemon
[Install]
WantedBy=multi-user.target
You should see seomthing like this when you are restarting hass:
2017-07-15 17:02:38.423161 INFO AppDaemon Version 2.0.4b2 starting
2017-07-15 17:02:38.423584 INFO Configuration read from: /etc/appdaemon/appdaemon.yaml
2017-07-15 17:02:38.589124 INFO Got initial state
2017-07-15 17:02:38.596547 INFO Loading Module: /etc/appdaemon/apps/globals.py
...
2017-07-15 17:02:38.795600 INFO App initialization complete
2017-07-15 17:02:38.796236 INFO Starting dashboard
2017-07-15 17:02:38.828319 INFO Connected to Home Assistant 0.48.1
2017-07-15 17:02:40.084175 WARNING Disconnected from Home Assistant, retrying in 5 seconds
2017-07-15 17:02:45.093866 WARNING Disconnected from Home Assistant, retrying in 5 seconds
2017-07-15 17:02:50.112288 WARNING Disconnected from Home Assistant, retrying in 5 seconds
2017-07-15 17:02:55.118644 WARNING Disconnected from Home Assistant, retrying in 5 seconds
2017-07-15 17:03:00.293360 INFO Got initial state
2017-07-15 17:03:00.311958 INFO Reloading Module: /etc/appdaemon/apps/globals.py
...```
That was it. By having the required in the unit area then systemctl stop appdaemon. if appdaemon starts before hass, no big deal just connect in 5 seconds.
I think we can put the service conf to bed.