diff --git a/homeassistant/components/binary_sensor/ping.py b/homeassistant/components/binary_sensor/ping.py index cb5bc4333a21c..1919c7ab64d6b 100644 --- a/homeassistant/components/binary_sensor/ping.py +++ b/homeassistant/components/binary_sensor/ping.py @@ -35,6 +35,9 @@ PING_MATCHER = re.compile( r'(?P\d+.\d+)\/(?P\d+.\d+)\/(?P\d+.\d+)\/(?P\d+.\d+)') +PING_MATCHER_BUSYBOX = re.compile( + r'(?P\d+.\d+)\/(?P\d+.\d+)\/(?P\d+.\d+)') + WIN32_PING_MATCHER = re.compile( r'(?P\d+)ms.+(?P\d+)ms.+(?P\d+)ms') @@ -126,7 +129,14 @@ def ping(self): 'avg': rtt_avg, 'max': rtt_max, 'mdev': ''} - + if 'max/' not in str(out): + match = PING_MATCHER_BUSYBOX.search(str(out).split('\n')[-1]) + rtt_min, rtt_avg, rtt_max = match.groups() + return { + 'min': rtt_min, + 'avg': rtt_avg, + 'max': rtt_max, + 'mdev': ''} match = PING_MATCHER.search(str(out).split('\n')[-1]) rtt_min, rtt_avg, rtt_max, rtt_mdev = match.groups() return {