added checking for phone

This commit is contained in:
aj 2019-04-30 23:56:55 +01:00
parent deb35fe160
commit 0c5729d7c5

View File

@ -3,9 +3,26 @@ import spotframework.net.network as networkclass
import os
def checkPhone():
response = os.system("ping -c 1 -w5 " + os.environ['PHONEIP'] + " > /dev/null 2>&1")
print('checking for phone')
if response == 0:
return True
else:
return False
if __name__ == '__main__':
network = networkclass.network(userclass.User())
found = False
for i in range(0, 36):
if checkPhone():
found = True
break
if found:
network.play(os.environ['SPOTALARMURI'], network.getDeviceID(os.environ['SPOTALARMDEVICENAME']))
network.setShuffle(True)