Yes, add as many address as you need in the same flow, all of them as trigger. The logic is OR, one triggered, it will execute the flow.
For exiting, you need AND logic, as you need to check that you are not in any one of the location you put there. But the better trigger for exit is Wifi disconnected and added up some action sleep as buffer. My wifi geofencing flow use 5 minutes as buffer. As you don't want the main action to be executed just because you are roaming around the room and get disconnected temporary.
No need to check for the location again. Because if you are entering any of those location again, the entering flow will be executed and wifi turned on again.
If you really need to check for multiple address at once, just store them in list and loop check the distance. Use
Init Variable Location to get you current location as the starting point to count the distance, store in {location}. You can use the variable from the trigger location or condition too, but remember you want your current position. Then copy the list of the coordinate point of your favourite location into the script.
Code: Select all
listloc = newList(
newLocation(1.234567, 98.765432),
newLocation(2.345678, 87.654321),
newLocation(3.456789, 76.543210),
newLocation(4.567890, 65.432109) );
dis = newList();
for(i in listloc)
addElement(dis, round(distance(i, location)));
min = sort(dis,true,true)[0];
Replace the coordinate in the listloc with yours. The loop will check the distance, round it to the nearest meter and store it at {dis} list. Then we sort the list, so the minimum distance is at the first element, which we query use [0]. {min} now contain the minimum distance from the list of address you have in the list to the current position.
After the script, add condition expression to check the minimum distance tolerance you need. Example, you want 20 meters.
Which mean if the minimum distance is less than 20 meters, you are in one the location you have specified, true branch - turn on the wifi. Or vice versa, you can use the false branch for denoting you are not in the location, turn off wifi.
But be careful, newer android version now require you to enable wifi before it can scan the location using network provider. So turning on/off wifi might not be a good idea.