Wifi-Connect and Home Assistant - Noob :)

First post, and new to balena and docker so I know I have loads of learning to do, take it easy :slight_smile:

I am trying to run Home Assistant and WIFI-Connect within the docker/balena environment and having issues combining them both. What happens is that I dont see any WIFI hotspot created once the Pi3 boots.

Below is a few of the config files used, I am sure its something simple which I am just missing, any pointers appreciated.

docker-compose.yml:

version: '2.1'
volumes:
    config:
services:
  homeassistant:
    build: homeassistant
    ports:
      - 80:8123
    privileged: true
    volumes:
      - 'config:/config'
    restart: always
    devices:
      - "/dev:/dev"
      - "/dev/serial/by-id/usb-0658_0200-if00:/dev/zwave"
  mqtt:
    image: arm32v6/eclipse-mosquitto
    ports:
      - "1883:1883"
    restart: always
  hass-configurator:
    image: "causticlab/hass-configurator-docker:arm"
    restart: always
    ports:
      - "8080:3218"
    volumes:
      - 'config:/hass-config'
    environment:
      - HC_BASEPATH=/hass-config
  wifi-connect:
    build: ./wifi-connect
    network_mode: "host"
    labels:
        io.balena.features.dbus: '1'
    cap_add:
        - NET_ADMIN
    environment:
        DBUS_SYSTEM_BUS_ADDRESS: "unix:path=/host/run/dbus/system_bus_socket"

homeassistant Dockerfile:

FROM homeassistant/raspberrypi3-homeassistant:stable
 
COPY sense.yaml /tmp/sense.yaml
COPY ui-lovelace.yaml /tmp/ui-lovelace.yaml
COPY lovelace.sh /tmp/lovelace.sh
COPY sensors.sh /tmp/sensors.sh
COPY start.sh /tmp/start.sh
 
RUN chmod +x /tmp/start.sh
 
CMD ["bash","/tmp/start.sh"]

wifi-connect Dockerfile:

FROM balenalib/raspberrypi3-debian
 
RUN install_packages dnsmasq wireless-tools
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
 
WORKDIR /usr/src/app
 
ARG VERSION="4.4.5"
RUN curl -Ls https://github.com/balena-io/wifi-connect/releases/download/v$VERSION/wifi-connect-v4.4.5-linux-rpi.tar.gz \
  | tar -xvz -C  /usr/src/app/
 
COPY scripts/start.sh .
 
CMD ["bash", "start.sh"]

Hello @YouGenerateCIC welcome to the forums and balena!

No worries if you are a noob today! We all gone through this one day :slight_smile:

Related with the WiFi-connect project I would recommend to read more about the docker-compose parts from the balenablock here and maybe use the block instead of the project.

Do you get any error or anything on the balenaCloud logs?

1 Like

thanks @mpous for the encouragement :slight_smile:

ok managed to get blocks for both home assistant and also WIFI connect into a release and its running ok.

However WIFI connect has made a good job of creating a hotspot but when I connect to that hotspot and navigate to the IP I get a HA screen.

I presume this is because HA and WIFI connect are using the same port. I could move one or the other onto another port but is there any way of suppressing HA listening to port 80 until WIFI-Connect is happy.

Also I would like to pass PORTAL_SSID etc… to WIFI-connect using the docker-compose.yml file. What’s the syntax for this as I tried and it could not read it.

Update: worked out the syntax for the docker-compose.yml file for setting environment variables.
environment:
- PORTAL_LISTENING_PORT=81
- PORTAL_SSID=YouGenerateConnect

Thanks,
Richard.

1 Like

Hey Richard - you seem to have graduated from noob status pretty quickly. :slight_smile: I’d say you’re up to blue belt already.

Glad you’re up and running.

Phil

2 Likes

Thanks @phil-d-wilson the blocks work really well your guys are on to something :slight_smile: With WIFI-connect on another port I can boot the PI and navigate to the IP:Port and setup internet fine and away we go.

Just would be nice if we had a way to keep WIFI-connect on port 80 and allow it to do its biz before HA kicks in.

Thanks for all the hard work…
Richard.