Add timeout and fix oscillations on Samsung TV component (#17102)
* Add timeout and fix oscillations * Adjust code to py3.5.3 * Clean code
This commit is contained in:
1 parent
b92b24e8a4
commit
02bf07d9df
2 files changed
+24
-3
No files matched your search
@@ -125,10 +125,14 @@ class SamsungTVDevice(MediaPlayerDevice):
|
||||
def update(self):
|
||||
"""Update state of device."""
|
||||
if sys.platform == 'win32':
|
||||
_ping_cmd = ['ping', '-n 1', '-w', '1000', self._config['host']]
|
||||
timeout_arg = '-w {}000'.format(self._config['timeout'])
|
||||
_ping_cmd = [
|
||||
'ping', '-n 3', timeout_arg, self._config['host']]
|
||||
else:
|
||||
_ping_cmd = ['ping', '-n', '-q', '-c1', '-W1',
|
||||
self._config['host']]
|
||||
timeout_arg = '-W{}'.format(self._config['timeout'])
|
||||
_ping_cmd = [
|
||||
'ping', '-n', '-q',
|
||||
'-c3', timeout_arg, self._config['host']]
|
||||
|
||||
ping = subprocess.Popen(
|
||||
_ping_cmd,
|
||||
|
||||
Reference in new issue
Block a user