Issues with setting up HADashboard (compiling errors?)

Hi,

I’ve been having trouble with getting appdaemon and dashboard working.

It did work for a short while, where I got the standard Hello.dash and test.dash compiled (though the test.dash lights kept showing “entity not found”, and didn’t work), but I have no clue what I have changed to break it.

Now, when I try to connect to the local IP, https://192.168.0.160:5050/, I get a blank page. However, if I type in the IP of a specific dashboard (e.g. https://192.168.0.160:5050/Hello), I get that page served. It seems like it can’t compile, though. If I change the text in Hello.dash and reboot, the text doesn’t change when served in the browser.

I keep getting a warning in the appdaemon.log:

2018-03-18 20:05:12.725253 INFO AppDaemon Version 3.0.0b5 starting
2018-03-18 20:05:12.726786 INFO Configuration read from: /home/homeassistant/.homeassistant/appdaemon.yaml
2018-03-18 20:05:12.728797 INFO AppDaemon: Starting Apps
2018-03-18 20:05:12.735833 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2018-03-18 20:05:12.790254 INFO AppDaemon: HASS: HASS Plugin Initializing
2018-03-18 20:05:12.791274 INFO AppDaemon: HASS: HASS Plugin initialization complete
2018-03-18 20:05:12.792108 INFO Starting Dashboards
2018-03-18 20:05:12.825274 INFO Starting API
2018-03-18 20:05:12.831995 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds

And the last line repeats every 4-5 seconds. I also get an error in the access.log when trying to load a dashboard that has not yet been compiled:

2018-03-18 15:49:47.856228 INFO HADashboard: Succesful logon from 192.168.0.160:5050
2018-03-18 15:49:55.215437 INFO Compiling dashboard 'Hello'
2018-03-18 15:49:56.150546 INFO function [get_dashboard] finished in 944 ms
2018-03-18 15:50:19.250704 INFO function [get_dashboard] finished in 85 ms
2018-03-18 15:54:10.670571 INFO Compiling dashboard 'Hello'
2018-03-18 15:54:11.563656 INFO function [get_dashboard] finished in 901 ms
2018-03-18 15:54:13.254068 INFO HADashboard: New dashboard connected: Hello Panel
2018-03-18 16:04:17.730676 INFO HADashboard: Dashboard disconnected
2018-03-18 16:04:19.726959 INFO Compiling dashboard 'test'
2018-03-18 16:04:21.434504 INFO function [get_dashboard] finished in 1716 ms
2018-03-18 16:04:22.391008 INFO HADashboard: New dashboard connected: Test Panel
2018-03-18 16:06:30.637147 INFO Compiling dashboard 'test'
2018-03-18 16:06:32.356251 INFO function [get_dashboard] finished in 1733 ms
2018-03-18 16:06:32.378096 INFO HADashboard: Dashboard disconnected
2018-03-18 16:06:33.955990 INFO HADashboard: New dashboard connected: Test Panel
2018-03-18 16:22:14.803797 INFO function [get_dashboard] finished in 116 ms
2018-03-18 16:22:16.536257 INFO HADashboard: New dashboard connected: Test Panel
2018-03-18 16:30:42.521042 INFO Compiling dashboard 'test2'
2018-03-18 16:30:42.954578 WARNING Dashboard 'test2' not found
2018-03-18 16:30:42.955402 WARNING ------------------------------------------------------------
2018-03-18 16:30:42.955793 WARNING Unexpected error during DASH creation
2018-03-18 16:30:42.956112 WARNING ------------------------------------------------------------
2018-03-18 16:30:42.961730 WARNING Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/appdaemon/dashboard.py", line 822, in get_dashboard
    with open(include_path, "r") as include_file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/homeassistant/.homeassistant/compiled/html/default/test2_head.html'

(The test2.dash is another I made that has not been compiled, and it seems like it can’t.)

My appdaemon.yaml:

secrets: /home/homeassistant/.homeassistant/secrets.yaml
log:
  accessfile: /mnt/hassdata/appdaemon/access.log
  errorfile: /mnt/hassdata/appdaemon/error.log
  logfile: /mnt/hassdata/appdaemon/appdaemon.log
  log_generations: 3
  log_size: 1000000
appdaemon:
  logfile: STDOUT
  errorfile: STDERR
  threads: 10
  api_port: 5000
  app_dir: /home/homeassistant/.homeassistant/appdaemon/apps
  api_key: !secret appdaemon_api_key
  api_ssl_certificate: /etc/mosquitto/ca.crt
  api_ssl_key: /etc/mosquitto/ca.key
  plugins:
    HASS:
      type: hass
      ha_url: secret_base_url # https:// duckdns IP
#      ha_url: https://192.168.0.160:8123
      ha_key: !secret api_password
      cert_path: /etc/mosquitto/ca.crt
      cert_verify: True
      namespace: default
hadashboard:
#  dash_url: secret hadash_url # https:// duckdns IP : port
  dash_url: https://192.168.0.160:5050
  dash_dir: /home/homeassistant/.homeassistant/appdaemon/dashboards/
  dash_ssl_certificate: !secret letsencrypt_fullchain # location of live let'sencrypt fullchain.pem file
  dash_ssl_key: !secret letsencrypt_prikey # location of live let'sencrypt privkey.pem file
  dash_password: !secret dash_password
  dash_compile_on_start: 1

Where the fullchain.pem and privkey.pem are the ones I use for my duckdns IP.

What I’ve found on the warning by searching mostly relates to either old versions of AppDaemon, something about permissions or ssl.

thats the most important line.
appdaemon cant get a connection to HASS setup.
and off course then it cant startup the dashboard server.

the problems you have are probably because of SSL.
2 https servers that are both using the same outside IP (most routers have only 1 IP) is asking for trouble.
going from inside your network to outside your network (duckdns) to go inside your network again is also not a good way.

if you absolutely want your dashboards to be reachable from the outside i advice you to do it like this:

for that you need to take 3 steps:

  1. delete ssl from the HASS configuration
  2. delete ssl from the appdaemon configuration
  3. install NGINX (or another proxy server like caddy) and use that to reach your dashboards and HASS (and cams, FTP server, or any other thing) from the outside.
1 Like

I did actually find “your solution” image on a different thread while searching (and made a note to self as a github issue in my repo: do that!)

I definitely don’t need HADashboard from outside, only for some old tablets I want to wall-mount, so I really like your idea of having everything within the network circumvent ssl.

I gave nginx a try earlier today, but didn’t delete all the old ssl stuff first (and it didn’t work). I’ll give that a go when I have a bit of spare time.

Thanks!

1 Like

if you still had ssl in HA the nginx solution would get in trouble.

but at least in your appdaemon.yaml you could delete it.
API is only for when you want to reach Appdaemon from inside other programs. (curl, another browser, alexa)
if you dont use that then delete all lines with api (its another server)

then remove the ssl lines in the dashboard section (and pasword 2 if you dont go outside with it (unless you have others in the house that must be restricted)
and use http for your dashboard.
the certpath and certverify should also be unneeded.

with those changes your dashboards should be reachable again untill you have nginx setup.

Great, I’ll definitely want to get the nginx up and running!

For now though, I can access http://192.168.0.160:5050/Hello, but it still doesn’t seem like it re-compiled? And I still get nothing from just http://192.168.0.160:5050. Both access.log and appdaemon.log look like before.

So it seems like it’s the same issue, just that I can get the old (already compiled) dahsboards through http instead if https now?

I changed a bit in the appdaemon.yaml, but no other files (just commented out everything I think you meant?):

secrets: /home/homeassistant/.homeassistant/secrets.yaml
log:
  accessfile: /mnt/hassdata/appdaemon/access.log
  errorfile: /mnt/hassdata/appdaemon/error.log
  logfile: /mnt/hassdata/appdaemon/appdaemon.log
  log_generations: 3
  log_size: 1000000
appdaemon:
  logfile: STDOUT
  errorfile: STDERR
  threads: 10
#  api_port: 5000
  app_dir: /home/homeassistant/.homeassistant/appdaemon/apps
#  api_key: !secret appdaemon_api_key
#  api_ssl_certificate: !secret letsencrypt_cert # full path to cert.pem file used for duckdns
#  api_ssl_key: !secret letsencrypt_prikey # full path to prikey.pem file used for duckdns
  plugins:
    HASS:
      type: hass
#      ha_url: secret_base_url # https:// duckdns IP
      ha_url: http://192.168.0.160:8123
      ha_key: !secret api_password
#      cert_path: !secret letsencrypt_cert # full path to cert.pem file used for duckdns
#      cert_verify: True
      namespace: default
hadashboard:
#  dash_url: secret hadash_url # https:// duckdns IP : port
  dash_url: http://192.168.0.160:5050
  dash_dir: /home/homeassistant/.homeassistant/appdaemon/dashboards/
#  dash_ssl_certificate: !secret letsencrypt_fullchain # location of live let'sencrypt fullchain.pem file
#  dash_ssl_key: !secret letsencrypt_prikey # location of live let'sencrypt privkey.pem file
  dash_password: !secret dash_password
  dash_compile_on_start: 1

Did I miss something?

the ha url must be an url which works in a browser.
if you have setup duckdns and ssl in HA, you probably need to use that url for now.

like https://yourname.duckdns.org or maybe
https://yourname.duckdns.org:8123

Only for HASS though, right? Not for hadashboard? I did try using my duckdns IP (under the plugins > HASS section)

That IP is what I am using to (successfully) access home assistant through browser. But the result is the same, can only load the two that are compiled, and I can’t change them.

Although where the appdaemon.log previously said INFO: Starting API (second to last line in first post), it now says INFO: API is disabled.

obviously. you now have API disabled.
if you can load the dashboards errorless but changes dont take effect, then probably your browser has cashed the dashboards.
so you need to delete the cash from your browser.

you know you have appdaemon setup correctly if this line:

WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds

is not showing up in your logs (unless you did start appdaemon while HA wasnt completely started)

I’ll give it a go once I have some spare time. Thanks for the pointers!

1 Like

Thanks a lot @ReneTode, I have it up and running now. HASS access via duckdns and ningx, hadashboard access through the local IP; works like a charm!

I still get five WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds notifications in the appdaemon.log at reboot, but after the fifth time, it connects, and gives no more errors.

I do have a [email protected] line in the /etc/systemd/system/[email protected], so I think that’s just something I’ll live with? Not really something I notice unless accessing logs anyway.

could be that HASS already tells te service that it is started before it hass the server up and running.
if i restart i have something simular, thats why i have set a delay in my appdaemon startup.

its nothing to worry about, just some extra log entries.