Haven't read all your posts (on my phone), but wifi connect means just that - the wifi is connected. It doesn't mean your MQTT broker is connected. Use a LED and control it with the GPIO command and you'll see.

// Routine to check which WiFi network the WeMos D1 Mini is connected to
// Default is a PlusNet network at the student's home
on System#Boot do
Gateway,192.168.1.254 // Set GW for student's home network
DNS,192.168.1.254 // Set DNS for student's home network
Let,1,0 //zero the ping counter
timerSet,1,60
endon
on Rules#Timer=1 do
If [VAR#1]=0 // Check for ZERO pings (looks like the student is connected to the IoT Club's router)
Gateway,192.168.1.1 // Set GW for IoT Club's router
DNS,192.168.1.1 // Set DNS for IoT Club's router
endif
endon
on ping#value do
if [ping#value]>0 //Check if 'good' ping received
if [VAR#1] < 5
Let,1,%v1%+1 //Increment the ping counter
endif
endif
endon