Labels

Thursday, September 5, 2019

HomeLink HA Interface #6 - finishing off the Interface including coding

So this project has been on the back burner for some time.  I never got the hardware over to something besides a breadboard, and I did not have the software running in the RPi0W.  I have a three day weekend coming up and I thought I might revive it and get it working with the Home-Assistant setup in my house.  I am trying to at least get the interface to my car working with the lights on the porch using this setup.  At this point I am thinking my best bet will be to load docker into the raspberry pi zero w and spin up a container of nodered to interface with the RPi0W and to send out packets to my MQTT server when buttons are pressed on my Subaru rear view mirror.  I decided to use an 8GB micro SD for this project since not much will change.

1. First things first - install Buster using the Win32DiskImager (see Stupid RPi Tip #5)

2. Next update the OS (Buster went from test to stable, so have to use apt instead of apt-get first)

sudo apt update
sudo apt-get upgrade

3. Next install docker

curl -sSL https://get.docker.com | sh

4. now that we have docker installed, need to get a working version of nodered in a docker container; also, it might be nice to have Portainer running to check status; we will use docker-compose for this (I usually set everything up in a directory in /srv/docker/); docker-compose.yml file is as follows:

version: '3'
services:
  portainer:
    container_name: portainer
    image: portainer/portainer
    volumes:
      - /srv/docker/portainer:/data
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - "9000:9000"
  nodered1:
    container_name: node-red-1
    restart: unless-stopped
    image: nodered/node-red-docker
    user: root
    volumes:
      - /srv/docker/node-red-1/user:/data
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "1880:1880"

Prior to launching DockerCompose we need to have a directory /srv/docker/node-red-1/ and /srv/docker/portainer/ ready to go.

mkdir /srv/docker/portainer
mkdir /srv/docker/node-red-1

Now put the docker-compose.yml file into /srv/docker/ directory.  Next launch DockerCompose

DockerCompose up

This should get us started with node-red running in the container

To Be Continued ...