Run code when wifi is dropped

Hi John,

Wow! That’s remote indeed!

In my other reply, I linked to some code that should work to ping. Just to make sure, I tested it and it worked as expected:

For reference, what I used was:

import os
hostname = "google.com" #example
response = os.system("ping -c 1 " + hostname)

#and then check the response...
if response == 0:
  print(hostname, 'is up!')
else:
  print (hostname, 'is down!')

Give this a go with your solenoid, and let us know how it goes!

-James

3 Likes