Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appdaemon won't connect to HASSIO #3

Open
dellablue opened this issue Aug 8, 2017 · 14 comments
Open

appdaemon won't connect to HASSIO #3

dellablue opened this issue Aug 8, 2017 · 14 comments

Comments

@dellablue
Copy link

dellablue commented Aug 8, 2017

Running HASSIO on Raspberry Pi3 and can't get the appdaemon to connect. I just get many of the same error messages: WARNING Unable to connect to Home Assistant, retrying in 5 seconds.

Here is my \HASSIO\config\hadaemon\appdaemon.yaml file:

AppDaemon:
  cert_verify: False
  logfile: STDOUT
  errorfile: STDERR
  threads: 10
  app_dir: /config/hadaemon/apps
HASS:
  ha_url: https://hassio.local:8123/
  ha_key: STRONGPASS
  ssl_certificate: '/ssl/fullchain.pem'
  ssl_key: '/ssl/privkey.pem'
HADashboard:
  dash_url: http://cp.local.io
  dash_dir: /config/hadaemon/dashboards

@vkorn
Copy link
Owner

vkorn commented Aug 8, 2017

Could you please try to change ha_url and remove ssl_cert/key options?

ha_url: http://172.17.0.1:8123

@dellablue
Copy link
Author

just tried this config and still have same problem:

AppDaemon:
  cert_verify: False
  logfile: STDOUT
  errorfile: STDERR
  threads: 10
  app_dir: /config/hadaemon/apps
HASS:
  ha_url: http://172.17.0.1:8123
  ha_key: STRONGPASS
  # ssl_certificate: '/ssl/fullchain.pem'
  # ssl_key: '/ssl/privkey.pem'
HADashboard:
  dash_url: http://cp.local.io
  dash_dir: /config/hadaemon/dashboards

@vkorn
Copy link
Owner

vkorn commented Aug 8, 2017

And you're sure that port is 8123 and password is correct? Because 172.17.0.1 is internal network and it's always accessible, so issues could be with port/password only

@dellablue
Copy link
Author

Double checked the password and it matches the api_password for home assistant. Not sure how to check if port is correct. But I can access HA via https://192.168.1.25:8123/ and if I SSH into HASSIO via the plugin, I can ping 127.17.0.1 and 127.17.0.1:8123.

@vkorn
Copy link
Owner

vkorn commented Aug 8, 2017

Hm, just to make, could you please perform last check?
Using ssh plugin, make sure that curl is installed

apk add curl

and call

curl -H "x-ha-access: YOUR_STRONGPASS" http://172.17.0.1:8123/api/history/period

Are you getting long JSON grid or 401 error?

@dellablue
Copy link
Author

addon_core_ssh:/# apk add curl
WARNING: Ignoring APKINDEX.84815163.tar.gz: No such file or directory
WARNING: Ignoring APKINDEX.24d64ab1.tar.gz: No such file or directory
OK: 44 MiB in 39 packages
addon_core_ssh:/# curl -H "x-ha-access: YOUR_STRONGPASS" http://172.17.0.1:8123/api/history/period
curl: (52) Empty reply from server

@vkorn
Copy link
Owner

vkorn commented Aug 8, 2017

So, this is basically the issue. I'm not sure what's your configuration and whether you've modified default resinos network config but ha is not responding on this address/port.
What's your server_port in ha http section configuration?

@dellablue
Copy link
Author

dellablue commented Aug 8, 2017

the only change I made to the resinos network config was to change the default interface from wlan0 to eth0 since I use Ethernet to connect to my Raspberry Pi. As for my HA config, I don't specify a server_port. Here is the relevant excerpt from my HA config:

homeassistant:
  name: Home
  latitude: !secret home_latitude
  longitude: !secret home_longitude
  elevation: !secret home_elevation
  unit_system: imperial
  time_zone: America/Chicago
  customize: !include_dir_merge_named customizations

http:
  api_password: !secret api_password
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem
  trusted_networks:
    - 192.168.1.0/24
  ip_ban_enabled: True
  login_attempts_threshold: 5

updater:
  include_used_components: true
discovery:
conversation:
history:
recorder:
  db_url: mysql://hass:[email protected]/homeassistant
logbook:
sun:
frontend:
config:

@vkorn
Copy link
Owner

vkorn commented Aug 8, 2017

Oh, it seems that you're serving https right from ha, my bad could you please run curl again?

curl -k -H "x-ha-access: YOUR_STRONGPASS" https://172.17.0.1:8123/api/history/period

If it works, you need to put
ha_url: https://172.17.0.1:8123

@dellablue
Copy link
Author

The curl command worked...got a huge data dump of my HA logfile.

But making it https, still didn't work. Config below:

AppDaemon:
  cert_verify: False
  logfile: STDOUT
  errorfile: STDERR
  threads: 10
  app_dir: /config/hadaemon/apps
HASS:
  ha_url: https://172.17.0.1:8123
  ha_key: STRONGPASS
HADashboard:
  dash_url: http://cp.local.io
  dash_dir: /config/hadaemon/dashboards

Not sure if it helps but prior to using HASSIO, I was using HADashboard successfully on same RPI as HA with this config:

AppDaemon:
  threads: 10
  app_dir: /home/pi/appdaemon/conf/apps
  logfile: /home/pi/appdaemon/appdaemon.log
  errorfile: /home/pi/appdaemon/appdaemon_errorfile.log
  cert_verify: False 
HASS:
  ha_url: https://192.168.1.25:8123
  ha_key: STRONGPASS
  cert_verify: False
  ssl_certificate: '/etc/letsencrypt/live/XXX.duckdns.org/fullchain.pem'
  ssl_key: '/etc/letsencrypt/live/XXX.duckdns.org/privkey.pem'
  disable_apps: 1
#Apps
hello_world:
  module: hello
  class: HelloWorld 
HADashboard:
  dash_url: http://192.168.1.25:5050

@vkorn
Copy link
Owner

vkorn commented Aug 8, 2017

cert_verify means something only on AppDaemon level. You can try to use https://192.168.1.25:8123 but it shouldn't make any difference, as we've checked internal network availability

I'm kinda out of ideas. Try to do following:
ssh to host os (not ssh plugin, but directly to the resin) look at the containers list and get all logs

docker ps
docker logs -f CONTAINER_ID_OF_APP_DAEMON

There might be more details

@vkorn
Copy link
Owner

vkorn commented Aug 8, 2017

There was an issue some time ago with self-signed certs, but you're using LE, so you should be fine. Anyway, as a last resort you could try following:

Modify run.sh to execute

appdaemon -c "$CONFIG_DIR" --commtype "SSE"

bump version in config and rebuild plugin (if you're using pre-built image you'll need to stop it first and then build locally). If it will help, I'll add an option to addon config. It was there before but I've removed it after appdaemon was patched.

@dellablue
Copy link
Author

Thanks for helping...couldn't get it to work. FYI, I wasn't able to try that last step because I don't know how to modify the run.sh file.

@vkorn
Copy link
Owner

vkorn commented Aug 9, 2017

You need to do following:

  1. Clone/download this repo
  2. Modify run.sh from appdaemon folder
  3. Copy appdaemon folder to the samba share /addons
  4. In HASSIO ui hit update plugins, then you'll see local one
  5. Hit install -- it will take ~10 mins to build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants