Monitoring WIFI Signal and Reset Hotspot if Lost - Need help!

Hello, I created / pieced together a single code to check for the presence of a WIFI signal from my wifi hotspot by using "listNetworks()". If the number is 1 or greater, I know the hotspot is working. If it's less than 1, I know the hotspot has turned off or locked-up (a past issue). I can then take action to reset the hotspot. This works fabulous... given that there is only one wifi signal...

I've recently added a wireless bridge that expands the number of devices I can connect to the hotspot (the hotspot itself is limited to 15 devices). Now, the problem is there are 2 networks found by the Arduino. This is fine, except that I only want to take action if the hotspot wifi is missing. I don't want to take action if the secondary router / bridge goes missing.

Is there a way to assign an integer to an SSID or a MAC address that I could use to identify which network is missing? My thinking is if I can assign "2" to the hotspot and "1" to the secondary router, I could sum the total and as long as I get 2 or greater, I know the hotspot is working.

Thank you for any thoughts you might have on this issue.

Where is this listNetworks() function in your code? The most likely example I can find is here.

You could try adding...

    Serial.print("\tBSSID: ");
    Serial.print(WiFi.BSSIDstr(thisNet));

to the listNetworks() function and see what the BSSID is for your hotspot. If you have this then you can see if it's working or not.
Another approach to this problem is to try and connect to the hotspot and ping a website (like google.com) if either fail then reboot the hotspot.

That example is exactly the code I started with. Regardless if I have the SSID of the BSSID, I don't know how to convert to an integer or a value that I can do something with. Can I look for a specific BSSID and act accordingly?

Good suggestion about pinging a site like google to verify the hotspot is working. My concern is that there has been cases where the 4G is lost (actually happened last week!) despite the hotspot being on and correctly functioning. I wouldn't want to reset in this case. While it's rare to lose 4G signal, it's happened a few times that I know of. Trying to avoid a known shortcoming.

Hoping to make a somewhat simple modification to my code to take action if/if not a MAC, BSSID, or SSID is found.

WiFi.BSSIDstr(thisNet) returns a String so using the various String methods will work.

As BSSID is a 6 byte value you could store its raw value in a uint64_t data type