WiFi Connection issue

Hello,

I am currently using balenaOS on my Raspberry Pi 4 (RPI4), along with balenaDash, and it’s connected to the internet via WiFi. In the WiFi’s .nmconnection file, under the [ipv4] section, I have set route-metric=0.

Additionally, the RPI4 is connected to a router via Ethernet to control some of my ESP32 Modules. In the Ethernet’s .nmconnection file, I have set route-metric=1 under the [ipv4] section.

Occasionally, my RPI4 disconnects from the WiFi and activates its WiFi Connect hotspot. However, the page only displays one WiFi network, which is the default SSID for the RPI. When I enter the password and attempt to connect to the WiFi by clicking the button, it fails to connect and does not open the WiFi Connect hotspot.

Please Help
Thank you

Hi,

It would help to know more about your setup, for example:

  • How are you connected to the router with ESP32 modules?
  • Which WiFi settings are you trying to connect to?

The WiFi SSID not showing up, could be a bug in refreshing the list, or it could be on a channel that’s not allowed by current settings; specifying the correct country in the your config.json should help with the latter.

Assuming your WiFi is working properly some of the time, I think this might have to do with your routing.

When you set your WiFi metric to 0, you effectively tell it to have the highest priority.
My guess is that WiFi Connect creates a new .nmconnection where the metric is set to the WiFi default, which is 600 if I’m not mistaking.

That would mean that your internet traffic would be run through the ethernet because metric 1 has higher priority than 600.
If your router is not actually connected to the internet, this could make the connectivity check to fail, which should cause it to switch back to hotspot mode.

Something you can try, is to set the option ipv4.never-default=true in your ethernet connection.
That would prevent it from adding a default route, and ensure that only that specific subnet gets routed through ethernet. The rest of your traffic should then be run through the WiFi.

2 Likes

@TJvV
I have 2 Routers Namely: Router1 with Internet, I have provided this Router’s SSID and Password to my BalenaOS RPI4 and Router2 without Internet which is connected to BalenaOS RPI4 via Ethernet. I have some ESP32 modules that are connected to Router2 by Providing Router2’s SSID and Password credentials to all ESP32 Modules. Now I have some code running in one of the containers which receives information from the internet and performs the task by sending API requests to ESP32 modules.

where can I find this config.json file

I can see WiFi Connect.nmconnection and WiFi Connect54{soomething}.nmconnection files inside /etc/Network-Manager/system-connections but it is empty

So, if I understand correctly, you are using a pre-configured wifi connection for internet, and an offline ethernet (for the ESP32s). Where exactly does WiFi Connect come into play here?
Which wifi are you trying to connect to through Wifi Connect?
Do you intend to get rid of pre-configuring the wifi?


Looking at the sources
, it seems that if you try to connect to the same network, it will first remove the existing connection, which would also reset your pre-configured metric.

This configuration can be found in the boot partition of your SD card.
If you log in on the HostOS, it will be mounted under /mnt/boot.

I would have to try this out when I get the time, probably Wednesday, to give an answer as to why it’s empty.

1 Like

@TJvV

Whenever there is no internet connection available to BalenaDevice or Somehow it gets disconnected from Router1
I have yet to check the network connections that my device is connected to whenever my BalenaDevice gets disconnected from the internet and opens its wifi connect hotspot.

I can only see 1 WiFi Network(Router1 Network which has internet)on the WiFi Connect page even though there are multiple WiFi connections available around my BalenaDevice

This has solved my problem below for now at least

No, this WiFi is the main source of internet at my home