I have currently integrated an IoT system into a project using the NodeMCU ESP32. The ESP32 speaks to a Firebase RTDB and that information is further received by a website where the data is displayed. For the website, I am now building a troubleshooting mode to check the status of the various sensors in play e.g. an IR sensor. If certain things are not working as expected, the troubleshooting system would notify the user.
I am trying to figure out how I might go about checking the WiFi status of the ESP32? I understand that in the code you can do:
WiFi.status() != WL_CONNECTED
But I am wondering if the ESP32 is unable to connect to the WiFi, how might I receive this information? Without connecting to the WiFi, the ESP32 cannot speak to Firebase. Is there a solution to this? Is there a way I might be able to check the WiFi network to see if the ESP32 has joined?
Edit 1: I would like to add an example. I have an Air Purifier that can be controlled via my phone through an app. If the Air Purifier is off, my phone knows that it is off. I would like to do something similar. How might I go about this?