HADashbord AppDaemon excessive time spent in utility loop

Hey All,

I’m having some state refresh problems in HADashboard so started to look at what is causing it. I keep finding sets of these in the AppDaemon logs. Does anyone know what this is? Seems to happen a few times an hour, I suspect this may be the cause?

I don’t know what a utility loop is, does anyone know?

2018-09-23 19:57:50.478708 WARNING AppDaemon: Excessive time spent in utility loop: 1142.0ms
2018-09-23 20:07:51.708667 WARNING AppDaemon: Excessive time spent in utility loop: 1146.0ms
2018-09-23 20:17:52.931288 WARNING AppDaemon: Excessive time spent in utility loop: 1121.0ms
2018-09-23 20:26:41.692608 INFO HADashboard: Dashboard disconnected
2018-09-23 20:26:42.164961 INFO function [get_dashboard] finished in 275 ms
2018-09-23 20:26:45.223579 INFO HADashboard: New dashboard connected: Magnolia Control Panel
2018-09-23 20:27:54.277389 WARNING AppDaemon: Excessive time spent in utility loop: 1147.0ms

the utilityloop is the basic appdaemon loop.
do you have active apps?

normally the loop takes up to 1 second, and then it doesnt send a warning.
if it takes more then you get that warning.
it means that something is slowing down your AD instance, and mostly that are apps.
but also new loading from a dashboard can cause the slowdown.

how long ago did you restart the device running appdaemon?

The only app that is running is HADashoard, serving one client a Fire 7 Tablet running fully kiosk browser.

I don’t have any other apps running, i have also restarted HA a number times over the last few days and the problems till exists.

I’m finding that HAD does not pickup state or if it does its a 10 - 15 seconds behind the change.

What else can i check?

I notice that your warning are happening every 10 minutes, so I would check to see if you have anything running at that sort of interval. It could be something in AD, HA or anything else running on your computer.

please show how you configured your appdaemon.yaml and your logfile right after a restart.

and i didnt ask if you restarted HA, but the device that runs HA (the RPI? )

@gpbenton the 10 mins is the interval that AD checks the values from HA, so i suspect a bad connection between HA and AD (so probably an outside DNS in the yaml)

@ReneTode please see below;

Yes running hassio on RPI3, appdaemon installed using the hassio store.

 secrets: /config/secrets.yaml
log:
  logfile: STDOUT
  errorfile: STDERR
appdaemon:
  threads: 10
 # production_mode: true
  app_dir: /config/appdaemon/apps
  plugins:
    HASS:
      type: hass
      ha_url: https://urltomyha:8123
      ha_key: mykey
hadashboard:
  dash_url: http://127.0.0.1:5050
  dash_dir: /config/appdaemon/dashboards

ha logfile after restart;

2018-09-24 18:21:55 WARNING (MainThread) [homeassistant.components.http] legacy_api_password support has been enabled. If you don't require it, remove the 'api_password' from your http config.
2018-09-24 18:22:04 ERROR (SyncWorker_1) [pywemo.ssdp] Found malformed XML at http://192.168.0.14:9080: status=ok
2018-09-24 18:22:10 WARNING (MainThread) [homeassistant.setup] Setup of wemo is taking over 10 seconds.
2018-09-24 18:22:20 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/discovery.py", line 168, in scan_devices
    results = await hass.async_add_job(_discover, netdisco)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/discovery.py", line 194, in _discover
    netdisco.scan()
  File "/usr/local/lib/python3.6/site-packages/netdisco/discovery.py", line 57, in scan
    self.ssdp.scan()
  File "/usr/local/lib/python3.6/site-packages/netdisco/ssdp.py", line 41, in scan
    self.update()
  File "/usr/local/lib/python3.6/site-packages/netdisco/ssdp.py", line 89, in update
    entry for entry in scan()
  File "/usr/local/lib/python3.6/site-packages/netdisco/ssdp.py", line 225, in scan
    for addr in zeroconf.get_all_addresses():
TypeError: get_all_addresses() missing 1 required positional argument: 'address_family'
2018-09-24 18:22:25 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2018-09-24 18:22:25 WARNING (MainThread) [homeassistant.components.light] Updating hue light took longer than the scheduled update interval 0:00:05

also the app daemon log taken from the front end;

> 2018-09-24 17:04:54.418177 INFO HADashboard: Dashboard disconnected
> 2018-09-24 17:04:54.748643 INFO function [get_dashboard] finished in 210 ms
> 2018-09-24 17:04:57.924151 INFO HADashboard: New dashboard connected: Magnolia Control Panel
> 2018-09-24 18:09:27.341075 WARNING AppDaemon: Excessive time spent in utility loop: 1124.0ms
> 2018-09-24 18:19:28.566485 WARNING AppDaemon: Excessive time spent in utility loop: 1122.0ms
> 2018-09-24 18:21:12.993664 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
> 2018-09-24 18:21:18.020979 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
> 2018-09-24 18:21:23.050402 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
> 2018-09-24 18:21:28.079483 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
> 2018-09-24 18:21:33.106417 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
> 2018-09-24 18:21:38.133365 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
> 2018-09-24 18:21:43.162217 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
> 2018-09-24 18:21:48.190552 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
> 2018-09-24 18:21:53.218669 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
> 2018-09-24 18:21:58.246883 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
> 2018-09-24 18:22:03.275731 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
> 2018-09-24 18:22:08.307365 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
> 2018-09-24 18:22:13.343373 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
> 2018-09-24 18:22:25.611886 WARNING AppDaemon: Scheduler clock skew detected - delta = 6.61172890663147 - resetting
> 2018-09-24 18:22:25.619776 INFO AppDaemon: HASS: Connected to Home Assistant 0.78.1
> 2018-09-24 18:22:28.259068 INFO AppDaemon: Processing restart for HASS
> 2018-09-24 18:22:28.260657 INFO AppDaemon: Terminating hello_world
> 2018-09-24 18:22:28.262784 INFO AppDaemon: Initializing app hello_world using class HelloWorld from module hello
> 2018-09-24 18:22:28.273645 INFO hello_world: Hello from AppDaemon
> 2018-09-24 18:22:28.283738 INFO hello_world: You are now ready to run Apps!

you did restart home assistant, but you didnt restart appdaemon.

just to clarify for you:

hassio is your operating system (like windows or linux)
home assistant is an program that you have running (like microsoft word or google chrome)
appdaemon is another program that you have running.

restarting home assistant doesnt restart your device, just the program.
and it also doesnt restart appdaemon.

you got this in your appdaemon. yaml

      ha_url: https://urltomyha:8123

which suggest to me that you probably use something like duckdns.
that means that you send all your information over the internet and then back to your home network.
that slows down your dashboard quite a bit.

but it can also be that restarting home assistant over and over, without ever restarting appdaemon caused some slow down.

so the things i advice:

  1. restart your entire device (if you dont know how, just shut down the power
  2. in the near future find out how to use a proxyserver, so that you can use a local IP without SSL in your appdaemon.yaml
  3. regularly shutdown and restart your tablet. tablets are not really created to be wallpanels and cashe problems can occur after some time.

Thanks @ReneTode,

I see your point about the ha address, I’ll get nginx installed and get a reverse proxy setup and address the ha instance using a local ip. It’s likely to be further aggravated because my internet connection is slow as I’m in a rural area.

I’ll get it changed tomorrow and report back with anything further

1 Like

but first restart your device, because it will for sure help speed up things.

Have done, done a full host restart and also set my tablet to auto restart at night.

1 Like

Hi @ReneTode,

I have altered my setup and the app daemon is far more responsive! Running nginx and address ha locally has done the trick. thanks for your help

1 Like

and the big bonus you got:
when internet is down, appdaemon will keep connected to HA :wink:

glad i could help.

1 Like