AppDaemon had issues and restarted itself

Has anyone seen AppDaemon do this? Yesterday when I got home, I noticed my outdoor lights were on in the daytime. This could only mean that my automations were not firing and all my automations are in AppDaemon. So I went and checked the logs, and it appears that appdaemon started getting errors prior to sunrise and fixed itself sometime around 3:35 pm.

Has anyone else seen this? What could have caused it. Unfortunately, I don’t have the logs from when the issue occured, only when it fixed itself:

It looks like it somehow lost credentials mid use?

logs:

  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 581, in worker
    funcref(self.sanitize_timer_kwargs(app, args["kwargs"]))
  File "/config/appdaemon/apps/doorsensors.py", line 63, in nofity_in
    self.call_service(service.call, message=service.message, data=service.data)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 457, in call_service
    r.raise_for_status()
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 939, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://hassio/homeassistant/api/services/notify/ios_petro
2018-07-24 16:49:30.916978 WARNING AppDaemon: ------------------------------------------------------------
2018-07-24 16:50:19.908701 WARNING AppDaemon: ------------------------------------------------------------
2018-07-24 16:50:19.910127 WARNING AppDaemon: Unexpected error in worker for App doorsensors:
2018-07-24 16:50:19.914420 WARNING AppDaemon: Worker Ags: {'name': 'doorsensors', 'id': UUID('8c421ba5-7643-442f-8654-ef18ece4dc8c'), 'type': 'timer', 'function': <bound method Doorsensors.turn_off_entitys of <doorsensors.Doorsensors object at 0x747090f0>>, 'kwargs': {'sensor_id': 'sensor.entry_door_hindge'}}
2018-07-24 16:50:19.915742 WARNING AppDaemon: ------------------------------------------------------------
2018-07-24 16:50:19.922617 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 581, in worker
    funcref(self.sanitize_timer_kwargs(app, args["kwargs"]))
  File "/config/appdaemon/apps/doorsensors.py", line 56, in turn_off_entitys
    self.turn_off(entity.id)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 345, in turn_off
    self.call_service("homeassistant/turn_off", **rargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 457, in call_service
    r.raise_for_status()
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 939, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://hassio/homeassistant/api/services/homeassistant/turn_off
2018-07-24 16:50:19.924071 WARNING AppDaemon: ------------------------------------------------------------
2018-07-24 16:52:26.905691 WARNING AppDaemon: ------------------------------------------------------------
2018-07-24 16:52:26.906933 WARNING AppDaemon: Unexpected error in worker for App doorsensors:
2018-07-24 16:52:26.909323 WARNING AppDaemon: Worker Ags: {'name': 'doorsensors', 'id': UUID('8c421ba5-7643-442f-8654-ef18ece4dc8c'), 'type': 'timer', 'function': <bound method Doorsensors.turn_off_entitys of <doorsensors.Doorsensors object at 0x747090f0>>, 'kwargs': {'sensor_id': 'sensor.entry_door_hindge'}}
2018-07-24 16:52:26.910422 WARNING AppDaemon: ------------------------------------------------------------
2018-07-24 16:52:26.914562 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 581, in worker
    funcref(self.sanitize_timer_kwargs(app, args["kwargs"]))
  File "/config/appdaemon/apps/doorsensors.py", line 56, in turn_off_entitys
    self.turn_off(entity.id)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 345, in turn_off
    self.call_service("homeassistant/turn_off", **rargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 457, in call_service
    r.raise_for_status()
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 939, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://hassio/homeassistant/api/services/homeassistant/turn_off
2018-07-24 16:52:26.915625 WARNING AppDaemon: ------------------------------------------------------------
2018-07-24 17:34:58.802727 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-07-24 17:35:18.827817 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-07-24 17:35:18.829043 WARNING AppDaemon: Scheduler clock skew detected - delta = 15.000546216964722 - resetting
2018-07-24 17:35:23.832179 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-07-24 17:35:28.836464 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-07-24 17:35:33.841493 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-07-24 17:35:53.868033 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-07-24 17:35:53.871012 WARNING AppDaemon: Scheduler clock skew detected - delta = 14.04191279411316 - resetting
2018-07-24 17:35:58.907516 INFO AppDaemon: HASS: Connected to Home Assistant 0.74.0
2018-07-24 17:35:59.441563 INFO AppDaemon: Processing restart for HASS
2018-07-24 17:35:59.443190 INFO AppDaemon: Terminating sundownlighttoggle
2018-07-24 17:35:59.444678 INFO AppDaemon: Terminating doorsensors
2018-07-24 17:35:59.446160 INFO AppDaemon: Terminating extendlighttoggle
2018-07-24 17:35:59.447521 INFO AppDaemon: Terminating sunsetlights
2018-07-24 17:35:59.448659 INFO AppDaemon: Terminating mediavolume
2018-07-24 17:35:59.449807 INFO AppDaemon: Terminating minimote
2018-07-24 17:35:59.451404 INFO AppDaemon: Initializing app sundownlighttoggle using class SunDownLightToggle from module sundown_light_toggle
2018-07-24 17:35:59.559868 INFO AppDaemon: Initializing app doorsensors using class Doorsensors from module doorsensors
2018-07-24 17:35:59.712749 INFO AppDaemon: Initializing app extendlighttoggle using class ExtendLightToggle from module extend_light_toggle
2018-07-24 17:35:59.728469 INFO AppDaemon: Initializing app sunsetlights using class SunsetLights from module sunset_lights
2018-07-24 17:35:59.734752 INFO AppDaemon: Initializing app mediavolume using class MediaVolume from module media_player_volume
2018-07-24 17:35:59.755336 INFO AppDaemon: Initializing app minimote using class Minimotes from module minimote

Hello @petro,

It was not Appdaemon but Homeassistant.

For some reason it seems it could not connect to HA, and that’s when you began to get those errors. AppD did nothing wrong here :slight_smile:

That’s why this showed up

2018-07-24 17:34:58.802727 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-07-24 17:35:18.827817 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-07-24 17:35:18.829043 WARNING AppDaemon: Scheduler clock skew detected - delta = 15.000546216964722 - resetting
2018-07-24 17:35:23.832179 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-07-24 17:35:28.836464 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-07-24 17:35:33.841493 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-07-24 17:35:53.868033 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-07-24 17:35:53.871012 WARNING AppDaemon: Scheduler clock skew detected - delta = 14.04191279411316 - resetting

Then this

2018-07-24 17:35:58.907516 INFO AppDaemon: HASS: Connected to Home Assistant 0.74.0
2018-07-24 17:35:59.441563 INFO AppDaemon: Processing restart for HASS

i think that’s what was referenced here Appdeamon stopped working after duckdns cert auto updated

Regards

Right but the issues before hand occurred out of the blue. I understand why it restarted, i’m failing to understand why these errors occured for upwards of 12 hours when it was working find the night before.

requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://hassio/homeassistant/api/services/homeassistant/turn_off

Mind you, I had not restarted the system since last wednesday and these errors started occuring sometime overnight from monday to tuesday this week.

EDIT: These errors were causing all automations to fail for that duration.

Yeah they will fail.

I honestly have no clue about what’s making it behave weirdly. I don’t use Hass.io, so I am well ignorant of it to a good extent.

is it possible you updated anything within before these issues started? I know after the last Rasbian kernel update, it broke my docker containers and I had to re-install it. Now Hass.io doesn’t use Rasbian, but I don’t know if it could be linked in any way

Maybe @ReneTode could shed a few more light on this.

Regards

It’s likely that duckdns updated silently because duckdns addon is up to date, but I have appdaemon connected through a proxy so it shouldn’t have been affected by duckdns. And without config changes you can see it automatically reconnected and is working as intended.

Very good point.

Well at least its working now. but if I may ask, why go via a proxy between AppD and HA? Isn’t that just looking for trouble?

I’m doing that because I want to access HA from an outside source but I want my automations to work without needing internet.

Oh ok makes sense, should have figured that out.

Thanks for explaining :slight_smile:

this is what i see:

hassio has something called supervisor and that gets updated automaticly.
the update from supervisor did cause a problem with autentication for AD and node red.

some time ago i did see a simular thing happening, and from the conversation that followed i remember that there is no way to remove the auto update from supervisor.

if that is true i would advise people to get away from hassio when you can and dont want outside people to be able to cause trouble in your home. if it isnt true i would be glad to hear that, because it is a very bad thing in my eyes.

auto update is something you NEVER want in a homeautomation environment.