Skip to content

Commit

Permalink
Set an interval of 500ms when sending batch requests
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Feb 23, 2024
1 parent 58c3aeb commit 7413a73
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion custom_components/echonetlite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,9 @@ async def async_update(self, **kwargs):
async def async_update_data(self, kwargs):
update_data = {}
no_request = "no_request" in kwargs and kwargs["no_request"]
for flags in self._update_flag_batches:
for i, flags in enumerate(self._update_flag_batches):
if i > 0:
await asyncio.sleep(0.5)
batch_data = await self._instance.update(flags, no_request)
if batch_data is not False:
if isinstance(batch_data, dict):
Expand Down

0 comments on commit 7413a73

Please sign in to comment.