Home Automation Docker Containers (Node-red, Hubconnect, Homebridge, Apache, Alexa Cookie)

I’ve been slowly moving my home automation pieces to docker containers and wanted to share them here. I haven’t documented them very much, but will gladly update docs if you have feedback/clarifications. I am running these on a Raspberry pi, so if your host is not an ARM system you might need to adjust the image dependencies. If you’re new to docker, I’ve included shell scripts. Essentially you clone the repo to /var/docker then ./build.sh then ./run.sh. The containers should start automatically on boot.

Homebridge doesn’t need a build as it’s using a pre-defined docker image from docker hub. If you already have homebridge running, you can run the script then copy your configs over afterwards.

Thanks to @csteele for Pi image that I based the node-red piece on.

4 Likes

Nice of you to offer this. I use docker containers on my pi devices for other (non-home automation stuff) and just installed Node-Red or I would jump on your node red container immediately. Docker really makes things simple and easy. :slight_smile: Five stars.

You should be able to copy over your configuration. Shutdown, copy over to config. Worst case, it doesn't work and you go back go your original config.

1 Like

@brianwilson - Thank you for putting together the Docker containers.

I have a novice question that a good bit of Googling leaves me guessing... Thought you may know.

I have a docker container which I opened a shell into using docker exec ... bash

Once inside I am trying to run your ./build.sh script. It tells me the docker command can not be found. I have read so much but am just stumped on how to make the docker command visible inside a container? Add env path, something else?

Many thanks for any help getting me out of this ditch.

The shell command is only if you need to hop into your already built container to get something/see something within that image (ie if you need to debug something). You shouldn’t need to run it. build and run should be run from a system that already has docker on it.

Hope that helps.

Thank you. Yes, it does help as I am very novice level with Docker, etc. I realized after "git"ing your project, I needed to "docker build" an image to then load on my Synolgy NAS Docker app. I did so, see it pulled the buster-slim base image, mixed in the rest, and created about a 150MB image. I was able to load that image and launch it. Now trying to get port 81 and 82 to actually connect to the running Docker container. 'Getting closer. Thanks.

1 Like

@brianwilson - Thanks again for your help. I have you docker image running in a container and have ssh'd into the container (alexa-cookie). Q: Is there a command to determine if all is up and running properly? Like a npm command or something? (Please excuse the extreme novice level of my question.)

docker ps

and

docker logs alexa-cookie

Thank you. I got it working fine on my local Docker install (on my Mac). I just ran ./build.sh and ./run.sh and everything worked fine.

However, on the Synology Docker install, doing the same builds the image fine. When I try to launch it either with your script or via the app, I get the following errors in the log (screenshot).

I've tried with Docker using the host network connection as well as a bridged connection with port 81 and 82 mapped into the container. I see the entry point into the container is "docker-entrypoint.sh" with the command "node AlexaCookie.js".

Any ideas? Was hoping to get some additional utility out of the NAS with Docker instead of buying a Rasberry Pi just for this.

FWIW, "uname -r" on the Synology returns "4.4.59"...

Many thanks,
Marty

Maybe try commenting our this line in Docker file:

RUN sed -i "s/MAINPORT/${MAINPORT}/" /data/config.json && \ sed -i "s/PROXYPORT/${PROXYPORT}/" /data/config.json && \ sed -i "s/USER/${USER}/" /data/config.json && \ sed -i "s/PASS/${PASS}/" /data/config.json

And editing config.json by hand and setting ports to 81 and 82? Then try a build.

Never used a Synology, so I can't tinker with it at home.

That worked fine (commenting out the RUN statement then manually setting the config.json file)! Thank you. Everything running fine in Docker on a Synology NAS.

I'm on to the next problem now. The Alexa TTS Manager appears to authenticate with Amazon as I can see the list of Alexa devices tied to the account used to get the cookie; however, any "speak" commands result the following errors...

It's got me scratching my head as the Manager sees all our Alexas, so I know it is at least getting data from Amazon. Not sure where to head next for this hopefully last step to get TTS working. Any ideas?

Many thanks,
Marty

Got it (and everything) working!

I did nothing more except delete all user-defined app code and user-defined driver code, deleting the TTS manager, devices, etc. Re-did the Node.js cookie generation, plugged in the cookie string, and it work.

The only thing I did differently was OMIT the trailing semicolon (:wink: at the end of the "Raw or edited Cookie" field in the Alexa TTS Manager... Did a test and everything is 100%

Thanks again tutoring me along on Docker. Glad to have the Node.js auto-refresh going and getting more value out of the Synology NAS.

Take care and thanks again.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.