Appdaemon setup using docker

So I’m new to appdaemon and I’m trying to get it going for the first time and I can’t seem to get it to run the first hello world app.

HA config location (includes appdaemon.cfg):

/home/adam/Docker/homeassistant/config

appdaemon apps folder location:

/home/adam/Docker/homeassistant/config/apps

Docker command:

docker run -d -v /home/adam/Docker/homeassistant/config:/conf --name appdaemon appdaemon:latest

appdaemon config file:

[AppDaemon]
ha_url = http://localhost:8123/
#ha_key = 
logfile = STDOUT
errorfile = STDERR
app_dir = /conf/apps
threads = 10

# Apps
[hello_world]
module = hello
class = HelloWorld

Result from docker logs appdaemon:

2017-03-28 07:09:51.800094 INFO AppDaemon Version 1.5.2 starting
2017-03-28 07:09:51.803960 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2017-03-28 07:09:56.811073 WARNING Unable to connect to Home Assistant, retrying in 5 seconds

I’ve also tried changing the app_dir = /conf/apps in the appdaemon config to app_dir = /home/adam/Docker/homeassistant/config/apps with the same result. Any idea what I’ve mucked up?

AD can’t find your HA instance, so either HA isn’t started, or the above line can’t resolve to wherever HA is running.

I don’t know how docker resolves localhost, but at a first attempt I’d put the actual IP address of the machine in and see if that helps.

I gave it a go, but the same result unfortunately. I removed my front-end password as well to make sure that wasn’t blocking anything.
I probably should ask more questions, but is the ha_key = in the appdaemon.cfg supposed to have your front end password in there? (if not what is the ha_key?)

I’m running homeassistant with docker as well if that’s of any importance. Following the guide on the HA website.

If your log file is saying the same thing, it is not getting as far as using the key. The problem is that it is not making a connection to HA.

I’m afraid I don’t know about how docker routes network messages, so I can’t help further.

Me either :slight_smile: thanks for trying!

@aimc sorry to name drop, but you seem like someone that would know this!?

You shouldn’t need to do anything special to connect to HA via docker, but do specify the ha_key if you have a password on your home assistant instance.

ok thanks, any idea about why I cant connect to my home assistant instance with appdaemon? It’s probably something really simple but I can’t see it!

Definitely don’t use localhost, use the IP of the machine HA is running on and remove the trailing “/”. IF that doesn’t work we can look at some additional debug info.

It was the trailing “/”. FML haha. Thanks heaps!

Excellent - glad you got it running :slight_smile:

1 Like
[AppDaemon]
ha_url = https://10.10.10.200:8123/
ha_key = xxxxxxx
logfile = STDOUT
errorfile = STDERR
app_dir = /volume1/docker/appdaemon/conf/apps
threads = 10
cert_path = /volume1/docker/homeassistant/config/certs
latitude = 
longitude = 
elevation = 
time_zone = 
# Apps
[hello_world]
module = hello
class = HelloWorld

This is the docker command:

docker run -v /etc/localtime:/etc/localtime:ro -v /volume1/docker/homeassistant/config/conf:/conf -v /volume1/docker/homeassistant/config/certs:/certs --restart always --net=host --name appdaemon mezz64/appdaemon

and I get this error:

2017-03-30 17:15:40.562142 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2017-03-30 17:15:45.590381 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2017-03-30 17:15:50.618638 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2017-03-30 17:15:55.647313 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2017-03-30 17:16:00.676223 WARNING Unable to connect to Home Assistant, retrying in 5 seconds

Anyone can help me?

Try removing the “/” from the end of the URL.

@aimc I have done it as you suggested but I have the same result as before:

root@DSM01:~# docker run -v /etc/localtime:/etc/localtime:ro -v /volume1/docker/homeassistant/config/conf:/conf -v /volume1/docker/homeassistant/config/certs:/certs --restart always --net=host --name appdaemon mezz64/appdaemon
2017-03-30 17:40:44.450834 INFO AppDaemon Version 1.5.2 starting
2017-03-30 17:40:44.469180 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2017-03-30 17:40:49.488777 WARNING Unable to connect to Home Assistant, retrying in 5 seconds

Not sure if this will work, but can you try:

#  docker run -v /etc/localtime:/etc/localtime:ro -v -D DEBUG

to see if we can get some additional info in the logs.

I don’t have debug command :frowning:

root@DSM01:~# docker run --help

Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG…]

Run a command in a new container

-a, --attach= Attach to STDIN, STDOUT or STDERR
–add-host= Add a custom host-to-IP mapping (host:ip)
–blkio-weight Block IO (relative weight), between 10 and 1000
–blkio-weight-device= Block IO weight (relative device weight)
–cpu-shares CPU shares (relative weight)
–cap-add= Add Linux capabilities
–cap-drop= Drop Linux capabilities
–cgroup-parent Optional parent cgroup for the container
–cidfile Write the container ID to the file
–cpu-period Limit CPU CFS (Completely Fair Scheduler) period
–cpu-quota Limit CPU CFS (Completely Fair Scheduler) quota
–cpuset-cpus CPUs in which to allow execution (0-3, 0,1)
–cpuset-mems MEMs in which to allow execution (0-3, 0,1)
-d, --detach Run container in background and print container ID
–detach-keys Override the key sequence for detaching a container
–device= Add a host device to the container
–device-read-bps= Limit read rate (bytes per second) from a device
–device-read-iops= Limit read rate (IO per second) from a device
–device-write-bps= Limit write rate (bytes per second) to a device
–device-write-iops= Limit write rate (IO per second) to a device
–disable-content-trust=true Skip image verification
–dns= Set custom DNS servers
–dns-opt= Set DNS options
–dns-search= Set custom DNS search domains
-e, --env= Set environment variables
–entrypoint Overwrite the default ENTRYPOINT of the image
–env-file= Read in a file of environment variables
–expose= Expose a port or a range of ports
–group-add= Add additional groups to join
-h, --hostname Container host name
–help Print usage
-i, --interactive Keep STDIN open even if not attached
–ip Container IPv4 address (e.g. 172.30.100.104)
–ip6 Container IPv6 address (e.g. 2001:db8::33)
–ipc IPC namespace to use
–isolation Container isolation technology
–kernel-memory Kernel memory limit
-l, --label= Set meta data on a container
–label-file= Read in a line delimited file of labels
–link= Add link to another container
–log-driver Logging driver for container
–log-opt= Log driver options
-m, --memory Memory limit
–mac-address Container MAC address (e.g. 92:d0:c6:0a:29:33)
–memory-reservation Memory soft limit
–memory-swap Swap limit equal to memory plus swap: ‘-1’ to enable unlimited swap
–memory-swappiness=-1 Tune container memory swappiness (0 to 100)
–name Assign a name to the container
–net=default Connect a container to a network
–net-alias= Add network-scoped alias for the container
–oom-kill-disable Disable OOM Killer
–oom-score-adj Tune host’s OOM preferences (-1000 to 1000)
-P, --publish-all Publish all exposed ports to random ports
-p, --publish= Publish a container’s port(s) to the host
–pid PID namespace to use
–pids-limit Tune container pids limit (set -1 for unlimited)
–privileged Give extended privileges to this container
–read-only Mount the container’s root filesystem as read only
–restart=no Restart policy to apply when a container exits
–rm Automatically remove the container when it exits
–security-opt= Security Options
–shm-size Size of /dev/shm, default value is 64MB
–sig-proxy=true Proxy received signals to the process
–stop-signal=SIGTERM Signal to stop a container, SIGTERM by default
-t, --tty Allocate a pseudo-TTY
–tmpfs= Mount a tmpfs directory
-u, --user Username or UID (format: <name|uid>[:<group|gid>])
–ulimit= Ulimit options
–userns User namespace to use
–uts UTS namespace to use
-v, --volume= Bind mount a volume
–volume-driver Optional volume driver for the container
–volumes-from= Mount volumes from the specified container(s)
-w, --workdir Working directory inside the container

1 Like

I’m running HA on docker, can some please give me a quick guide on how to get appdaemon running on Synology NAS, I’m trying to piece this all together from different posts etc running HA on docker seems like a real pain as every time I do something the normal guides I need to follow don’t work and then I have to spend hours trying to put it all together. I need appdaemon so I can get HADashboard running.

I was recently successful in getting appdaemon / HA dashboard running in docker on Ubuntu.

Do you have anything in your /etc/docker/daemon.json file? Did you change from using the default docker bridge network?

If using the default bridge network, try running this command and restarting the docker container to see if it helps:

sudo iptables -A FORWARD -i br0 -o br0 -j ACCEPT

Is your home assistant setup using SSL with lets encrypt and a dynamic DNS provider? If so your ha_key must be your dynamic DNS name. An example:

ha_url = https://my_dynamic_dns_name:8123

instead of using different posts you can better use the docs :wink:
http://appdaemon.readthedocs.io/en/latest/DOCKER_TUTORIAL.html

read it carefully and do exactly what it says, and i dont think you will have trouble.