Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c7ec21c

Browse files
committed
Retry and timeout can be change by setting a class attribute
1 parent f481a9e commit c7ec21c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

miio/device.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ def __init__(
117117
) -> None:
118118
self.ip = ip
119119
self.token = token
120+
if hasattr(self, "timeout"):
121+
timeout = self.timeout
120122
self._protocol = MiIOProtocol(
121123
ip, token, start_id, debug, lazy_discover, timeout
122124
)
@@ -143,6 +145,8 @@ def send(
143145
:param int retry_count: How many times to retry on error
144146
:param dict extra_parameters: Extra top-level parameters
145147
"""
148+
if hasattr(self, "retry_count"):
149+
retry_count = self.retry_count
146150
return self._protocol.send(
147151
command, parameters, retry_count, extra_parameters=extra_parameters
148152
)

0 commit comments

Comments
 (0)