Skip to content

Commit

Permalink
Retry and timeout can be change by setting a class attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
titilambert committed Dec 6, 2020
1 parent f481a9e commit c7ec21c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions miio/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ def __init__(
) -> None:
self.ip = ip
self.token = token
if hasattr(self, "timeout"):
timeout = self.timeout
self._protocol = MiIOProtocol(
ip, token, start_id, debug, lazy_discover, timeout
)
Expand All @@ -143,6 +145,8 @@ def send(
:param int retry_count: How many times to retry on error
:param dict extra_parameters: Extra top-level parameters
"""
if hasattr(self, "retry_count"):
retry_count = self.retry_count
return self._protocol.send(
command, parameters, retry_count, extra_parameters=extra_parameters
)
Expand Down

0 comments on commit c7ec21c

Please sign in to comment.