Add-on: Create a Wi-Fi access point with Hass.io Access Point

Hass.io Access Point

Create an access point on your Raspberry Pi (and potentially) other devices from HAOS. Useful for off-grid & standalone installations, or areas without Wi-Fi coverage.

This was initially a fork of a hassio-hostapd but the PR is still pending, so I created this new add-on with some extra features.

Main features:

  • Create an access point with built-in or external WiFi (USB) cards (using hostapd)
  • Hidden or visible SSIDs
  • Optional: DHCP server (using dnsmasq)
  • Optional: MAC address filtering (allow/deny)
  • Optional: Override hostapd config options
  • Optional: Internet routing for clients
  • Optional: Override DNS servers for clients (requires DHCP)

Installation

Use the instructions here to add the repo:

https://github.com/mattlongman/Hassio-Access-Point

or if you want to test the version with internet access for clients, download the add-on folder from the dev branch and install as a local add-on. See here for more info & config.

Example config

    "ssid": "AP-NAME",
    "wpa_passphrase": "AP-PASSWORD",
    "channel": "6",
    "address": "192.168.10.1",
    "netmask": "255.255.255.0",
    "broadcast": "192.168.10.255",
    "interface": "wlan0",
    "hide_ssid": "1",
    "dhcp": "1",
    "dhcp_start_addr": "192.168.10.10",
    "dhcp_end_addr": "192.168.10.20",
    "allow_mac_addresses": [],
    "deny_mac_addresses": ['ab:cd:ef:fe:dc:ba'],
    "debug": "0",
    "hostapd_config_override": [],
    "client_internet_access": '1',
    "client_dns_override": ['1.1.1.1', '8.8.8.8']

Disclaimer

This is quite a niche use-case, so I wasn’t planning on posting this here, but it looks like some people are still getting stuck with the previous version, so wanted to at least provide this as an option. However, it’s worth pointing out that I’m not very familiar with hostapd and dnsmasq, so if you think you see some kind of vulnerability or error in the way I’ve configured things, you’re probably right. Any suggestions on improving it would be greatly appreciated!

7 Likes

Version 0.4.1 just released into main.

This adds internet routing for clients, and configurable DNS servers for DHCP clients (whether or not internet routing is enabled).

2 Likes

Hi @mattlongman,
Thank you so much for this add-on, it’s exactly what I’m looking for !
Unfortunately I have the following issue upon installing the add-on :


Do you have any idea on how to bypass this ?
I’m running HAOS on Intel Nuc

Is it possible to configure the Access Point so you can use dnsmasq static ips?

This is the format documented in the /etc/dnsmasq.conf file I believe:

dhcp-host=d0:50:99:82:e7:2b,192.168.10.46

Adding a way to override the dnsmasq config (in the same way as the hostapd override works) is on the list, but not possible as it stands. Replicating the hostapd override should work if you want to create a PR.

That looks like the same error as Raspbian Supervised installations are getting, but I’ve not seen it on HAOS. I’ll do some testing when I have some time.

1 Like

Thank you @mattlongman for your answer.
I did some digging by trying to install other custom addons and comparing them to yours, and I actually found something interesting : I almost always (90%) encounter the “/bin/bash -o pipefail -c” … returned a non-zero code (but not always the same integer, in your case it stays at 2) on Intel NUC (using this HAOS version : Generic x86-64 - Home Assistant (home-assistant.io)) WHILE these addons seem to work fine on Raspberry Pi hardware.
Unfortunately I’m new to addon development on HA, so I might have missed something. I tryed some tweaking in a local addon (mostly using the code from your dev branch because I’d like the devices to reach internet from the AP).
I really hope there will be an easy way to fix it soon. If you need any report/testing, please feel free to ask me, I’d be glad to !

FYI : I’m currently running this version on Intel NUC

Hi community,
I tried this addon, and it works fine. I succeded to connect to the hotspot and I was allowed to have internet through my wired connection.
My idea is to use this addon to continue having access to Home Assistant from a dedicated tablet, even if my main rooter is down, and so my wired connection.
I’m a quite newbie in network configuration, and I’m wondering if someone could point me to how allocate the ha core an IP address from the new created hotspot…
Or maybe another way to accomplish this without the hotspot addon.
Thanks in advance for your help.
Kind regards,
Bilel

Hello @mattlongman, did you please find a way to make it work ? :slight_smile:

Here is the System log error from the supervisor when trying to install your addon from your github link :

21-09-20 20:14:06 ERROR (SyncWorker_1) [supervisor.docker.addon] Can't build 30e576d0/amd64-addon-hassio-access-point:0.4.1: The command '/bin/bash -o pipefail -c apk update && apk add --no-cache bash jq iw hostapd networkmanager net-tools sudo dnsmasq && rm -rf /var/cache/apk/*' returned a non-zero code: 2
21-09-20 20:14:06 ERROR (SyncWorker_1) [supervisor.docker.addon] Build log: 
Step 1/17 : ARG BUILD_FROM
Step 2/17 : FROM $BUILD_FROM
 ---> 8ae976d039fd
Step 3/17 : MAINTAINER Matt Longman <[email protected]>
 ---> Running in 504f3be13052
Removing intermediate container 504f3be13052
 ---> 9b7ff5985a0f
Step 4/17 : SHELL ["/bin/bash", "-o", "pipefail", "-c"]
 ---> Running in eb4c8dc9a673
Removing intermediate container eb4c8dc9a673
 ---> 14973e382286
Step 5/17 : ENV LANG C.UTF-8
 ---> Running in 2a00e28718c2
Removing intermediate container 2a00e28718c2
 ---> 6f0048c351a6
Step 6/17 : RUN apk update && apk add --no-cache bash jq iw hostapd networkmanager net-tools sudo dnsmasq && rm -rf /var/cache/apk/*
 ---> Running in ff0e268fff96
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.14/main: temporary error (try again later)
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.14/main: No such file or directory

fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.14/community: temporary error (try again later)
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.14/community: No such file or directory

2 errors; 39 distinct packages available
Removing intermediate container ff0e268fff96

Looks like some links are unavailable for my version of HAOS right ?

My bad everyone, all I had to do was to fix my DNS settings (8.8.8.8)…
Hint : docker can’t build because of alpine error - Stack Overflow
Thanks ! :smiley:

Thank you alot its very useful.

Hey, I found your add-on a while back by creeping through the interwebs, had initially forked it to run a little AP myself but when I saw you post it in the forums I switched to your actual repo. such a good add-on, I super appreciate your work.

I’ve just come back around because I’m trying to set up a USB wifi adapter to get a better signal to some of my devices. It’s an old NetGear A6210 I had sitting around. Unfortunately it isn’t included in the linux kernel. I’ve used it in the past by installing the driver manually from the community repo that’s based off the chipset manufacturer’s no-longer-compiling-codebase.

Any ideas how to install the driver for this on haOS? Or might I need to make a fork of your repo again to try implement it within the add-on for myself?

Again, thanks for the polished add-on, great work!

1 Like

Many thanks to @mattlongman for creating / forking the add-on its perfect for my campervan (hoping to get both zigbee and some esp32-via-wifi to report sensors), and having a static IP (esp for MQTT) via the hotspot is defiantly something I need.

@FreelancerJ
Had the same issue (although with a different driver), here were the steps I followed in inject the specific driver into the Hassio image file used at boot. From there the add-on seems to work (with a few other little settings, but in my case I used the in-build Pi0 Wifi as the AP (wlan0), and the USB-device as a client-connection device (wlan1)). I would expect it to break after a hassOS update (as my guess is the way that part works is to replace the image file of the OS).

  1. Figure out which driver you need, and download it (mt7601u.bin in my case)
  2. Mount to external machine (Ubuntu 20 VM seems to work ok)
  3. Find the USB device number (example here is /dev/sdb3)
  4. unsquashfs /dev/sdb3 - uncompress image
  5. copy over the files which you want to add (squashfs-root is the whole image folder)
  6. mksquashfs squashfs-root/ live.squashfs -noappend -always-use-fragments compress new image
  7. sudo -i (required for permissions)
  8. umount /dev/sdb3
  9. cat live.squashfs > /dev/sdb3 - replace image on the sdcard partition

I did also have to disable ipv6 (directly using nmcli con modify 'Supervisor' ipv6.mode disabled as the internal dns container was taking all of the CPU)

Hmmm, hoping not to have to go quite so custom as that, I plan to leave my Home Assistant host here if I sell up and move, so that the smart stuff like the Z-Wave lights, Air Conditioner and power monitoring can be used by whomever lives here next, since it would be quite a mess to remove those devices and reinstall the original dumb versions. I’ve been avoiding stuff in HACS for the same reason, just trying to stick with things that are native Home Assistant and only doing custom stuff via Supervisor Addons since they won’t break the rest of the system if deprecated…
Might have to go looking for a replacement USB wifi dongle that has mainline kernel support :-/