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
81 stars 63 forks source link

Hassio AP removes interface from NetworkManager #64

Open FloerlPhilip opened 4 months ago

FloerlPhilip commented 4 months ago

The Hassio AP addon removes the interface from being managed by Network Manager. The interface then doesn't show up on the UI, and users can't connect to a Wifi-Network via that interface anymore.

Possible fix: Remove these lines from run.sh:

logger "Run command: nmcli dev set $INTERFACE managed no" 1
nmcli dev set $INTERFACE managed no
ROBOT0-VT commented 4 months ago

As far as I'm aware, you can't simultaneously host a WiFi network and connect to one from the same device/interface, thus this would be intended behaviour.

If you remove that line, can you connect to a network and host at the same time without issues? What hardware/network card are you running?

FloerlPhilip commented 4 months ago

@ROBOT0-VT Yeah you're right, removing this line might break the access point. I use an RPi 4. But, could it possibly work to define a virtual interface on wifi interface and configure the AP to use that interface? As mentioned here: https://raspberrypi.stackexchange.com/a/119668 Gonna test this throughout the week, but would love to hear your thougts :)

FloerlPhilip commented 4 months ago

Could be achieved through

iw dev wlan0 interface add <virtual_interface_name> type __ap

Maybe assign IP here? and then

ip link set dev <virtual_interface_name> up
ROBOT0-VT commented 4 months ago

If we do go this route, we'll have to enable NM management and figure out how we can ensure that NM allows the connection and the AP without causing issues with hostapd. Having the WiFi connection managed by anything other than NM would suck for users and be way out of scope of what I'm willing to maintain

ROBOT0-VT commented 4 months ago

It could be possible to configure hostapd.conf to work as a bridge... But I've got other things to work on in the short term

ROBOT0-VT commented 4 months ago

Wait, if a virtual interface can work, then we can allow the original interface to be managed by the system, as NM won't be managing hostap's interface :D

FloerlPhilip commented 4 months ago

Virtual interface seemed to work on my system, gotta assign it a mac adress though

ROBOT0-VT commented 4 months ago

Alrighty, I've got it working in a local repo of mine. Unfortunately for you, I'm also in the process of refactoring the networking from the ground up, so you'll have to wait for me to either clean up my commits to make a push, or to finish the refactor :D

I'm gonna close your PR tho, the solution is a little more complex