Implement yellow orbs

This commit is contained in:
Kumi 2019-01-13 18:12:09 +01:00
parent 3b623f2693
commit af3df21777

View file

@ -229,7 +229,7 @@ def ping(request, device_id):
else:
try:
socket.inet_aton(device[0].curip)
ajax += str(int(not os.WEXITSTATUS(os.system("ping -c1 -w1 " + device[0].curip + " > /dev/null 2>&1"))))
ajax += str(1 if not os.WEXITSTATUS(os.system("ping -c1 -w1 " + device[0].curip + " > /dev/null 2>&1")) else 2 if (timezone.now() - device[0].lasttime).total_seconds() > 120 and (timezone.now() - device[0].lastbeat).total_seconds() < 60 else 0)
ajax += ',\n "serial": "%s"' % device[0].serial
ajax += ',\n "name": "%s"' % device[0].name if device[0].name else ""
ajax += ',\n "ip": "%s"' % device[0].curip
@ -244,7 +244,7 @@ def ping(request, device_id):
ajax += ',\n "name": "%s"' % device[0].network.name
ajax += '\n }'
except:
except Exception as e:
ajax += "-3"
else: