Skip to content

Commit d597c23

Browse files
committed
fix ping for esp8266
1 parent 6aa1bce commit d597c23

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

adafruit_espatcontrol/adafruit_espatcontrol.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,11 @@ def ping(self, host):
384384
"""Ping the IP or hostname given, returns ms time or None on failure"""
385385
reply = self.at_response('AT+PING="%s"' % host.strip('"'), timeout=5)
386386
for line in reply.split(b'\r\n'):
387-
if line and line.startswith(b'+PING:'):
387+
if line and line.startswith(b'+'):
388388
try:
389-
return int(line[6:])
389+
if line[1:5] == b'PING':
390+
return int(line[6:])
391+
return int(line[1:])
390392
except ValueError:
391393
return None
392394
raise RuntimeError("Couldn't ping")

0 commit comments

Comments
 (0)