mattlongman / Hassio-Access-Point

Hass.io addon to let you create a WiFi access point, perfect for using WiFi devices on off-grid installations.
MIT License
91 stars 64 forks source link

Issues with wireless regulatory domain #62

Open mijofa opened 7 months ago

mijofa commented 7 months ago

I'm trying to get this running to remove the handful of Tasmota devices from my main network. Couple of light globes I wanted to change their own colour temperature based on time of day, and some power points for heaters and such that I want to turn themselves off after N mins of activity regardless of how they were turned on and whether the network's even working.

Problem I'm running into is that the range is terrible, despite this hardware being able to connect WiFi with far better range. I started looking into whether I could increase the txpower and got stuck down a rabbit hole with not being able to set the correct regulatory domain. I'm in Australia, so I should get the 'AU' regulatory domain, in theory I should be able to just set the hostapd.conf override of country_code=AU but that's not working. I've manually run iw reg set AU, but that's not helping either. I even went and added cfg80211.ieee80211_regdom=AU to cmdline.txt and options cfg80211 ieee80211_regdom=AU to modprobe.d

The closest I'm getting is the system's "global" reg being set correctly, but not the physical device's per:

674b3982-hassio-access-point:/# iw reg get
global
country AU: DFS-ETSI
    (915 - 920 @ 4), (N/A, 30), (N/A)
    (920 - 928 @ 8), (N/A, 30), (N/A)
    (2400 - 2483 @ 40), (N/A, 36), (N/A)
    (5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW
    (5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW
    (5470 - 5600 @ 80), (N/A, 26), (0 ms), DFS
    (5650 - 5730 @ 80), (N/A, 26), (0 ms), DFS
    (5730 - 5850 @ 80), (N/A, 36), (N/A), AUTO-BW
    (5850 - 5875 @ 20), (N/A, 13), (N/A), AUTO-BW
    (5925 - 6425 @ 160), (N/A, 23), (N/A), NO-OUTDOOR
    (57000 - 71000 @ 2160), (N/A, 43), (N/A), NO-OUTDOOR

phy#0
country 99: DFS-UNSET
    (2402 - 2472 @ 40), (N/A, 20), (N/A)
    (2457 - 2482 @ 40), (N/A, 20), (N/A), PASSIVE-SCAN
    (5140 - 5360 @ 80), (N/A, 30), (N/A)
    (5460 - 5860 @ 80), (N/A, 30), (N/A)

I'm not getting any errors when setting any of this, it seems everything is working as intended, and just not setting what I want.

In my regulatory domain I should be able to increase the txpower to 30dBm, but I'm stuck with 20dBm because of this. Although I'm still not sure if that will actually be enough to solve my problem, it seems like a good first step since the WiFi module is built-in and I'd rather avoid another USB dongle and pringles cantenna

I also tried just using nmcli to set up the built-in NetworkManager as a hotspot, but that's failed due to lack of dnsmasq, and a bunch of apparmor rules around what iptables commands the built-in NetworkManager can run. That's a whole other thing I might later raise with home-assistant/operating-system though.