I want to have access to my watering system (based on ESP32) from anywhere using Firebase. When i am at home, connected to the same WiFi as the ESP32, I want to be able to use the manual mode and the configuration of the automatic mode and also know the status of the watering system.
When I am somewere else, connected via the mobile phone network, I want to have access to all but not to manual mode. So, the manual mode must be dislabled when I am not connected to the same WiFi used by the ESP32.
Is it possible to change the behavior of the Web pages in Firebase accordingly to the network used by my cellphone (My WiFi, other WiFi not at my home, cellular network) ?
I’m not sure how to do that. But it should be possible.
To get the client’s IP address, you can check this discussion: https://stackoverflow.com/questions/48032909/how-to-get-client-ip-address-in-a-firebase-cloud-function (note that I never tried this).
Probably, there is a better way to achieve this… but I’m not sure…