Hadashboard on HASS Vagrant

Hey,
I’m running HASS Vagrant and I’ve followed the steps to install AppDaemon.

My configuration is as empty as:

      logfile: STDOUT
      errorfile: STDERR
    hadashboard:
      dash_url: http://127.0.0.1:5050
    appdaemon:
      threads: 10
      plugins:
        HASS:
          type: hass
          ha_url: http://127.0.0.1:8123

I’ve tried setting the internal vagrant ip, or localhost, but I’m getting:

    2018-05-02 14:28:56.334200 WARNING AppDaemon: HASS: ------------------------------------------------------------
    2018-05-02 14:28:56.334274 WARNING AppDaemon: HASS: Unexpected error:
    2018-05-02 14:28:56.334314 WARNING AppDaemon: HASS: ------------------------------------------------------------
    2018-05-02 14:28:56.336498 WARNING AppDaemon: HASS: Traceback (most recent call last):
      File "/usr/local/lib/python3.5/dist-packages/appdaemon/plugins/hass/hassplugin.py", line 194, in get_updates
        "{}/api/websocket".format(url), sslopt=sslopt
      File "/usr/local/lib/python3.5/dist-packages/websocket/_core.py", line 494, in create_connection
        websock.connect(url, **options)
      File "/usr/local/lib/python3.5/dist-packages/websocket/_core.py", line 217, in connect
        options.pop('socket', None))
      File "/usr/local/lib/python3.5/dist-packages/websocket/_http.py", line 70, in connect
        sock = _open_socket(addrinfo_list, options.sockopt, options.timeout)
      File "/usr/local/lib/python3.5/dist-packages/websocket/_http.py", line 131, in _open_socket
        raise err
      File "/usr/local/lib/python3.5/dist-packages/websocket/_http.py", line 116, in _open_socket
        sock.connect(address)
    ConnectionRefusedError: [Errno 111] Connection refused

any idea how to solve this?

when you want people to help you, you need to place code, logs and for certain YAML in codeblocks as suggested on top of the forum

the url you need to use for the plugin needs to be the same url you use in a browser to go to HASS
if you use a password in HASS then you need to set that too.

@ReneTode I just used the editor and it only inserted indentation, not code markdown, fixed that - thanks!

I am accessing HASS with the default Vagrant URL - http://localhost:8123 - which I also set in the configuration and it resulted in the same error.

log:
  logfile: STDOUT
  errorfile: STDERR
appdaemon:
  threads: 10
  plugins:
    HASS:
      type: hass
      ha_url: http://localhost:8123
      ha_key: welcome

untill a few minutes ago i had never heard from vagrant, so its going to be a bit off guessing :wink:

i read the HA site about vagrant and it seems to me that its something like docker.
is there any configuration from vagrant itselve?

the reason i ask, is that appdaemon needs to go out of vagrant to go to the HA url and in docker thats needs to be configured.

the url you use probably wont work when you are on another device (a tablet, a phone or another PC)
you need an url whith what you can connect to HA with another device.

@ReneTode the vagrant bottom line is that we have a debian based virtual machine.

The box itself has port forwarding enabled so from your browser’s http://localhost:8123 you have access to the internal port 8123.

FYI, I created a similar line for port 5050.
But that’s not the problem since the appDaemon can’t really go out of the Vagrant box and use the host’s (my computer) localhost, it should use its own, which doesn’t work because:

vagrant@contrib-stretch:~$ wget http://localhost:8123
--2018-05-02 17:58:17--  http://localhost:8123/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:8123... failed: Connection refused.
Connecting to localhost (localhost)|127.0.0.1|:8123... failed: Connection refused.

and yes, HASS is running and accessible from my computer (into the Vagrant box).

well… I installed debian’s net-tools and from there:

$ netstat -pln
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:8123            0.0.0.0:*               LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
udp        0      0 0.0.0.0:68              0.0.0.0:*                           -

setting:

ha_url: http://0.0.0.0:8123

did the trick!

2018-05-02 18:10:14.412007 INFO AppDaemon: HASS: Connected to Home Assistant 0.68.0
2018-05-02 18:10:14.413906 DEBUG AppDaemon: HASS: get_ha_config()
2018-05-02 18:10:14.414049 DEBUG AppDaemon: HASS: get_ha_config: url is http://0.0.0.0:8123/api/config
2018-05-02 18:10:14.417664 DEBUG AppDaemon: HASS: get_ha_state: url is http://0.0.0.0:8123/api/states
2018-05-02 18:10:14.420392 DEBUG AppDaemon: HASS: Got state

I also added:

hadashboard:
  dash_url: http://0.0.0.0:5050

so the dashboard is indeed available on my browser @ http://localhost:5050

Now to figure out how the paths work:

ValueError: !secret used but no secrets file found
1 Like

you need to have a file called secrets.yaml in the same dir as your appdaemon.yaml
thats the default.
if you want another path you need full path, so probably something from the base from your box.

Yes, thanks!
just thought I could you the same one used for HASS.

you can if you know the full path to the file.
probably starting with /home

@ReneTode yes, I know.
The problem with non-relative links is that they are not system agnostic.
I.e in my vagrant (dev box) they might not be in the same place as in my final (standalone) setup.

right.
but you have the choice between non relative and none at all :wink:
and you will see that you get that on several places in HA and AD.