Fix display of offline devices
This commit is contained in:
parent
745fa3aa02
commit
8123042305
1 changed files with 3 additions and 2 deletions
|
@ -110,8 +110,9 @@ def ping(request, device_id):
|
|||
ajax += "-3"
|
||||
else:
|
||||
try:
|
||||
ajax += str(1 if (device.curip and not os.WEXITSTATUS(os.system("ping -c1 -w1 " + device.curip + " > /dev/null 2>&1"))) else 2 if (True if not device.lasttime else (timezone.now() - device.lasttime).total_seconds() > 120) and (timezone.now() - device.lastbeat).total_seconds() < 60 else 0)
|
||||
except:
|
||||
ajax += str(1 if (device.curip and (timezone.now() - device.lasttime).total_seconds() < 300 and not os.WEXITSTATUS(os.system("ping -c1 -w1 " + device.curip + " > /dev/null 2>&1"))) else 2 if (True if not device.lasttime else (timezone.now() - device.lasttime).total_seconds() > 120) and (timezone.now() - device.lastbeat).total_seconds() < 60 else 0)
|
||||
except Exception as e:
|
||||
ajax += str(e)
|
||||
ajax += "-4"
|
||||
else:
|
||||
ajax += ',\n "serial": "%s"' % device.serial
|
||||
|
|
Loading…
Reference in a new issue