I am using Moto G2. I would like to know if there are any means of keeping the phone unlocked when it is connected to a known WiFi network.
Delayed Lock might work for you. I've been using it for years and it's done an excellent job of unlocking the phone when connected to chosen wifi networks. https://play.google.com/store/apps/details?id=de.j4velin.delayedlock2.trial
I don't think Smart Lock allows Wifi as an option - at least it doesn't on my S7. I do recall when I used to own a Moto, that Moto had some of its own smart actions, but don't know what happened to those proprietary apps of late.
Some neat tips - I do realize you have the G2, not the OG. http://phandroid.com/2015/08/05/moto-g-2015-first-things/
You can try to use Trusted Places if your device can find your location easily enough - or - use Trusted devices if you have a Bluetooth device you can set up such as a speaker or on your PC.