Addon - Raspberry Pi as hotspot in hass.io

hassio-hostapd

Raspberry Pi as hotspot in hass.io

Buy me a coffee

Link to github repository

This Hass.io Addon

This add-on allows you to use the Raspberry Pi a3s a hotspot to connect the different devices directly to the hass.io network without going through the router.

Installation

To use this repository with your own Hass.io installation please follow the official instructions on the Home Assistant website with the following URL:

https://github.com/davidramosweb/hassio-addons

Configuration

The available configuration options are as follows (this is filled in with some example data):

{
    "ssid": "WIFI_NAME",
    "wpa_passphrase": "WIFI_PASSWORD",
    "channel": "6",
    "address": "192.168.99.1",
    "netmask": "255.255.255.0",
    "broadcast": "192.168.99.254"
}

Note: This is just an example, don’t copy and paste it! Create your own!

Conflicts

To prevent the addon stop working after a few minutes, you must disable NetworkManager for wlan0.
You can use the SSH & Web Terminal addon with the option “Protection mode” disabled and run the following command:

nmcli dev set wlan0 managed no
3 Likes

Is it able to route the traffic to another access point?
So that means to use the wlan0 as station and access point in the same time.

I think not with this addon :grimacing:

Hi David, congratulations for this, but I would like to have it going through the router, like a access point, can you show me how to do it? Thank you very much. :grin:

Hello again, I just installed it. The only problem is that after the reboot and connecting into the cable, I am no longer able to connect to the GUI. I tried cable and wifi, it saw in both cases it is reachable via ping but not from the browser.
I am not sure why this happened as the plugin was not started, unless it was set to start with the boot, but I am 100% sure I didn’t do it.
I had the chance to set the ssid and password but it is not broadcasting the SSID. Samba still works.
I wonder if this has something to do with the DNS plugin I also have installed.

Hello, the plug is not designed for devices connected to the hotspot have access to internet. Sorry.

Awesome, exactly what I was trying to do but failed :wink: thank you!

1 Like

Hi,
I got the following error during installation:

20-01-11 06:57:18 INFO (SyncWorker_8) [hassio.docker.addon] Start build 567c2022/armv7-addon-hassio-hostapd:1.0.2
20-01-11 06:57:25 ERROR (SyncWorker_8) [hassio.docker.addon] Can't build 567c2022/armv7-addon-hassio-hostapd:1.0.2: The command '/bin/bash -o pipefail -c apk update && apk add --no-cache bash jq iw hostapd networkmanager=1.18.1-r2 net-tools=1.60_git20140218-r2 sudo=1.8.27-r0 && rm -rf /var/cache/apk/*' returned a non-zero code: 2

Do you have any suggestion, how to fix it?

Hi,
Is it possible that you have a firewall that blocks some connections of the Raspberry pi?

Hi,

I found out that, the folowing line caused the issue:

RUN apk update && apk add --no-cache bash jq iw hostapd networkmanager=1.18.1-r2 net-tools=1.60_git20140218-r2 sudo=1.8.27-r0 && rm -rf /var/cache/apk/*

the issue was the version of networkmanager, and sudo.
I removed the version tag, and this part was fine.

Now I have other issue with run.sh:

[FATAL tini (6)] exec /run.sh failed: No such file or directory

it is because of first line #!/bin/bash

/bin/bash seems to missing in container. Don’t know yet, how to fix it. I am new in Docker.

Hi! Great work with this AddOn. It is the perfect solution for small houses to increase security without more gear. I need some help to fix some stability issues: I use it to control Shelly devices and it works well, but sometimes some devices go offline for no apparent reason. I am using the DHCP server offered in the store to assign stati IPs to devices. Do you think that might be the issue?
Thank you!

Hello Dear, i’am using Raspberry Pi4 and i can not able to install this app. is there a solution for that? Thank you in advanced

Hi, I understand that the hotspot network is closed and add no access to internet, but if the HA server (Pi3 in my case) is also wired to the rooter, does it conserve its internet access ?

Hey David,

Great add-on, kinda hope this could just end up in the community add-ons repo.

Wondering two things:
– do you know if this plays well with the offical DHCP Server add-on?
– have you considered allowing MAC address filtering in your add-on?
This would just allow a smidge of extra security for networks set up with this. It really just would require adding an optional config boolean for hostapd’s ‘macaddr_acl’, and two optional lists for ‘accept_mac_file’ and ‘deny_mac_file’ that make the respective files when entered in. Orrrrrr they could just be optional strings pointing to a file the user makes in their /config/ directory for Hass.

I know MAC address filtering is no substitute for making a good damn password anyway, but since the Pi only supports WPA2 anyway, any extra obstacles to pop in the way of bored, mischievous local script kiddies is appreciated (especially by those of us in, um, crowded wifi environments like apartment buildings :sweat_smile: )

Thanks for the effort!

I also got ‘exit code 2’ and fixed it by removing the version numbers from sudo and networkmanager. Thanks lordrobert. I’m running on a Pi4 with the firmware updated recently in 2021.

I didn’t install from git, that didn’t allow me to fix the version numbers. But i followed the instructions here: https://developers.home-assistant.io/docs/add-ons/tutorial by downloading a copy of https://github.com/davidramosweb/hassio-addons/tree/master/hassio-hostapd to my addons directory. Then ‘reload’ as instructed in the tutorial from the Add-ons page and it shows up as a local repository.

Edit the Docker file to remove the version numbers, so you get this line:

RUN apk update && apk add --no-cache bash jq iw hostapd networkmanager net-tools=1.60_git20140218-r2 sudo && rm -rf /var/cache/apk/*

Then from home assistant add-ons page for this add-on, just click “Install” and it worked for me.

I haven’t yet tried to add a wifi device yet, but at least the service starts and will start on boot. I just have a couple of cheapy esphome thermometers but they’re wifi, and i have no wifi out there, so the remote (hardwired) Pi out there will hopefully be able to read the temperature from those wifi devices.

Cheers,

For anyone still trying to get this work, I submitted PR16 to fix a few issues and add a few features - you could download that fork and install as a local add-on as it’s still not been approved.

I’ve also created a new add-on inspired by this, which adds extra functionality (DHCP server, hidden or visible SSID, MAC address filtering, currently testing internet access for clients).

1 Like

@davidramosweb can this run along a wired connection?
so when the network is down that i can connect to the hotspot for emergency controls?

Home Assistant 2023.8.2
Supervisor 2023.08.1
Operating System 10.4
Frontend 20230802.0 - latest

23-08-15 16:24:29 WARNING (SyncWorker_3) [supervisor.addons.validate] Add-on config ‘devices’ use a deprecated format, the new format uses a list of paths only. Please report this to the maintainer of Hassio Hostapd
23-08-15 16:24:29 WARNING (SyncWorker_3) [supervisor.addons.validate] Add-on have full device access, and selective device access in the configuration. Please report this to the maintainer of Hassio Hostapd