HASS.IO - Wifi setup config file

I needed AP mode because I built independent and isolated network for IoT stuff. My router creates Wi-Fi network for my laptop, phone, etc and RPi creates independent Wi-Fi network for vacuum, lights, humidifier and other IoT stuff. I made such setup in terms of security and to make my network simpler.

1 Like

Hi,
I also want to create AP mode to have an isolated WiFi network for smart devices.
I’ve been playing with some configuration files, but I don’t know how to setup Hassio RPi 3 IP address for that network, neither how to enable dhcp.
Using your example file, and tested with a smartphone, the smartphones connect to the network, but no IP address is assigned.
Do you know how to configure these values?

Thanks!

Hi!
That config only creates Wi-Fi AP. Devices need IP address to work properly. IP address could be assigned manually on device, but not all devices support it, so we need a DHCP server to make things easy. DHCP server doesn’t have to be on Raspberry Pi itself, but it’s easier to have it on Pi. There is an addon for HASSio, called “DHCP Server”, so just install it (connect RPi via Ethernet to get access to it while Wi-Fi network is not configured yet).
Here is my config for that addon (all addons configuration available via Hass.io tab at Homeassistant webgui):

{
  "default_lease": 86400,
  "max_lease": 172800,
  "domain": "local",
  "dns": [
    "8.8.8.8",
    "8.8.4.4"
  ],
  "networks": [
    {
      "subnet": "10.0.1.0",
      "netmask": "255.255.255.0",
      "range_start": "10.0.1.20",      #This range is for automatic DHCP
      "range_end": "10.0.1.40",
      "broadcast": "255.255.255.255",  #Important! Broadcast IP should be like this, otherwise device will not get DHCPOFFER package
      "gateway": "10.0.1.1",           #IP of RPi
      "interface": "wlan0"
    }
  ],
  "hosts": [                           #List of static IP addresses, because Homeassistant often needs static IP of sensor/switch/etc
    {
      "name": "Hassio",                # RPi itself
      "mac": "MAC",
      "ip": "10.0.1.1"
    },
    {
      "name": "XiaomiGateway",
      "mac": "MAC",
      "ip": "10.0.1.2"
    },
             * * *
 ]
}

Pay attention at broadcast option. Documentation says that it should be x.x.x.255, but as far as I know DHCP protocol, it’s not correct: device sends DHCPDISCOVER package to broadcast address 255.255.255.255, server gets it, sends DHCPOFFER back. And if we send DHCPOFFER to x.x.x.255 address, client device will not get it, DHCPOFFER should be sent to broadcast address. Maybe I wrong, or there is a bug in addon, but until I change broadcast address to 255.255.255.255, my client devices don’t get proper IP.

1 Like

Thank you very much!

Well, seems like I was wrong about broadcast address. And faced with another problem.
On Hassio, wi-fi is enabled right after RPi reboots (ResinOS starts it automatically) and wi-fi AP becomes available before Docker is fully initialized and DHCP-server container is being loaded.
And within time after AP available (and no dhcp server yet) and before DHCP server container ready some devices (for example most of Xiaomi devices) decide that DHCP server not present. As a result, devices get APIPA ip addresses and stop send DHCPDISCOVER. And when server is ready, there is no devices request it.
So, add-on itself and its config are fine, sorry, my fault.
Problem is that DHCP server in Docker starts after wi-fi AP.
At this moment I don’t have a solution, but as soon as I find it - I post it here.

There’s no systems connections file when I open up my SD card where do I find it

i too have the same problem cannot reach my wifi router … i created a folder with system-connections put the file in it without .txt , and i also used the usb trick didnt work???

@Sharqawi … I was having the same problem. Here is the solution thanks to @pingme :

  1. Format an USB stick and label it as “CONFIG”
  2. Create a folder “network” on that USB stick and inside this folder create a new file hassos-wifi (with no extension)
  3. Open hassos-wifi file with notepad++ and enter the following:

[connection]
id=hassos-wifi
uuid=72111c67-4a5d-4d5c-925e-f8ee26efb3c3
type=802-11-wireless

[wifi]
mode=infrastructure
ssid=MyWiFi

[wifi-security]
auth-alg=open
key-mgmt=wpa-psk
psk=password

[ipv4]
method=auto

[ipv6]
addr-gen-mode=stable-privacy
method=auto

  1. Put the USB stick in RPI and reboot.
  2. You can scan your network and will see that the RPI is connected to the WiFi. At that point, the file gets added to the RPI config and you can remove the USB stick.

Cheers :wink:

6 Likes

pretty much worked !!!

@TofuNinja see my post. It may help you.

That looks like what I did and it didn’t work but I will give it a try again tomorrow. After I couldn’t get it to work I did a Raspbian home assistant install and couldn’t get the auto start thing to work. Will let you how it goes.

Thanks it worked and is up and running. You are the man.

1 Like

I have the same situation here, and I just posted the topic yesterday. But seem there are no reply.

@3TO16 I did what @Danek said to do and it worked for me so I would try that. Good luck!

THX, it works! I can find the IP address now, but there’s another problem comes out that I can’t access the http://hassio.local:8123 or http://myPiAddress:8123 through the browser. Have you faced this problem?

Other than it take long time for everything to boot up no I have not. Maybe try a reboot and wait like 10-15 min before you go to http://hassio.local:8123/. Good luck

1 Like

Thank you very much, you help a lot

Hi, for me USB magig somehow does not work :frowning:
I’ve followed detailed guide here juanmtech but with wifi no way.
If I did it with LAN cable connected, no problem at all :frowning:
But I need wifi connection.

I did what @Danek said to do and it worked for me give that a try.

Is this still true? It seems that the documentation changed:

hassos Documentation network.md

The file is now called “my-network” instead of “hassos-wifi” and the section markers are now [802-11-wireless] instead of just [wifi]?

Why did this change? What’s true now?