This is an example of Automate flow. To learn more about Automate for Android phones, click here.
It is always a good idea to disable the WiFi function of your Android phone until you want to connect to a WiFi network. This will help to conserve battery usage, and also prevent your phone from automatically get connected to certain open WiFi without your aware, which might be used to hack in your phone.
Normally, there are fix places with WiFi that you will definitely want to use, to conserve your mobile Internet data quota usage. Those places include your home and/or your work place.
This Automate flow will help you to automatically disable WiFi function of your phone after your leave your home, and automatically enable it back when you arrive your home. It will even inform you by voice so that you are aware when WiFi is automatically enabled and disabled by this flow.
Enabling WiFi function does not guarantee a successful connection, because sometimes your access point (AP) or wireless router might have problem in establishing the WiFi connection.
Therefore, after enabling WiFi, this flow will wait for 10 seconds, which should be long enough for normal WiFi connection to be established. It will then check if the connection is successful or not.
If the connection is successful, it will log down the name a.k.a. SSID (service set identifier) of the AP or wireless router your phone has connected to.
If the connection is not successful, it provides option for you to remain enable WiFi or to disable it. Regardless of your selection, you will still need to troubleshoot and find out why the WiFi connection cannot be established. It could be caused by your AP or wireless router is switched off, or hang, or WiFi function disabled, or DHCP IP address allocation full, or other possible issue. If your phone has never made a successful connection with the WiFi at the location before, or you have made your phone "forget" about it, the connection will also be not successful as well.
Before you can use this flow, you need to tell it where is your home. This can be done by tapping on Block 12 "When at location". The following screen will come out.
Tap on the "Pick a location on map..." button to bring out Google map. You can then search for your home by either tapping on the "target" icon if you are currently at home, or by tapping on the search (magnifying glass) icon and key in your home address for search, or by manually selecting the location by navigating the map and tap on the targetted place.
When you are done, tap on the OK button below to capture the location's coordinate.
The Radius setting determines the area that you consider your phone is at home. Normally, 50 meter radius as shown above is a good choice. You can set its value larger so that your WiFi is automatically enabled faster when your approaching home, and automatically disabled after you have travelled further away from your home.
You can use this same flow for other places with fixed WiFi, such as your work place. Just go through the same steps able to set the location before running it. You might also want to change the word from "home" to "office" in Blocks 14, 15, 16 and 17 of the flow.
With slight modification, you can even expand this flow to be used for multiple locations.