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!

8 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 :-/

Amazing plugin.

I’m connecting from my android phone to hass access point, but I can’t access the home assistant interface.
I’m trying to open the hass interface by address http://192.168.99.1:8123
What is wrong?

ssid: Redzone-HassIO-Ap
wpa_passphrase: '123456789'
channel: '6'
address: 192.168.99.1
netmask: 255.255.255.0
broadcast: 192.168.99.255
interface: wlan0
hide_ssid: '0'
dhcp: '1'
dhcp_start_addr: 192.168.99.10
dhcp_end_addr: 192.168.99.20
allow_mac_addresses: []
deny_mac_addresses: []
debug: 0
hostapd_config_override: []
client_internet_access: '0'
client_dns_override: []

I have usb Ralink Technology, Corp. MT7601U Wireless Adapter and use hassio in proxmox environment
and got a problem too

nl80211: Could not configure driver mode
nl80211: deinit ifname=wlp0s29f7u1 disabled_11b_rates=0
nl80211 driver initialization failed.
wlp0s29f7u1: interface state UNINITIALIZED->DISABLED
wlp0s29f7u1: AP-DISABLED 
wlp0s29f7u1: CTRL-EVENT-TERMINATING 

So i found

driver=nl80211

and then i added

hostapd_config_override:
  - driver=mt7601u

and got

# Custom hostapd config options:
Add to hostapd.conf: driver=mt7601u
Add DNS: dhcp-option=6,192.168.0.3
Configuration file: /hostapd.conf
Line 43: invalid/unknown driver 'mt7601u'
1 errors found in configuration file '/hostapd.conf'
Failed to set up interface with /hostapd.conf
Failed to initialize interface

so seems mt7601u isnt supported by hassio. Is there any options to add this driver to hassio?
Bcs its ok in parental debian 10, lsmod shows working mt7601u

where did you get mt7601u.bin? I found a lot of them including sources MediaTek | MT7601U
but seems they dont work

also i see
“Add Mediatek MT7601U support (#1520) (#1526) @agners
in Home Assistant OS Release-7 build 0 (RC1)

But i updated HA to 7.2 and get in log anyway
Line 43: invalid/unknown driver 'mt7601u'
by the way lsmod seems ok

Module                  Size  Used by    Not tainted
xfrm_user              40960  1
mt7601u               122880  0
mac80211              806912  1 mt7601u
cfg80211              802816  2 mt7601u,mac80211
ch341                  16384  1
libarc4                16384  1 mac80211
virtio_console         36864  1
virtio_balloon         24576  0

idk why it dosnt work

I used hass plugin to access terminal, and then, ran the command:
ip route add 192.168.99.0/24 via 0.0.0.0 wlan0

this made it possible to access the hass interface of my android

seems the addon has problems with accessing to parental drivers.
default nl80211 driver is standart and works in most cases, but not all.
So i moved to supervised version, that is all. Hotspot is working well with default nl80211 driver with embedded realtek pci wifi card. But it was impossible to pass this device through proxmox because my cpu j1900 dosn’t support necessary VT instructions, anyway this adapter didnt work too even on full hass os node. So this mean hass OS has extremely limited set of drivers and its hard to make 2 wifi networks: 1 ordinary and 1 IOT.