Skip to content

Commit

Permalink
Replace time.sleep() by async.sleep()
Browse files Browse the repository at this point in the history
  • Loading branch information
bouwew authored Mar 2, 2022
1 parent 993cf60 commit a901693
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion custom_components/sems2mqtt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
scan_interval: 150 (optional, default is 300 seconds, keep to 300 seconds or less!)
"""

import asyncio
import json
import logging
import time
Expand Down Expand Up @@ -180,7 +181,7 @@ async def call(url, payload):
token = json.dumps(data['data'])
except await hass.async_add_executor_job(issueException) as exp:
_LOGGER.warning(exp)
time.sleep((2*i) ** 2)
await asyncio.sleep((2*i) ** 2)
else:
_LOGGER.error("Failed to obtain data from the SEMS API")
return {}
Expand Down

0 comments on commit a901693

Please sign in to comment.