Skip to content

Commit

Permalink
Merge pull request #21 from bouwew/blocking_loop
Browse files Browse the repository at this point in the history
Fix blocking loop reported in issue #19
  • Loading branch information
bouwew authored Mar 3, 2022
2 parents 993cf60 + ae97541 commit 4205ef2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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
2 changes: 1 addition & 1 deletion custom_components/sems2mqtt/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "sems2mqtt",
"name": "Goodwe SEMS API to MQTT sensor",
"version": "0.4.7",
"version": "0.4.8",
"documentation": "https://github.com/bouwew/sems2mqtt",
"dependencies": [],
"codeowners": ["bouwew"],
Expand Down

0 comments on commit 4205ef2

Please sign in to comment.