Skip to content

Commit

Permalink
Merge branch 'release/2023.6.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Jul 11, 2023
2 parents 4f01704 + ae9faff commit 6bd4b9f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions custom_components/xiaomi_miio_raw/manifest.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"domain": "xiaomi_miio_raw",
"name": "Custom component for Home Assistant to faciliate the reverse engeneering of Xiaomi MiIO devices",
"version": "2022.12.0.0",
"iot_class": "local_polling",
"codeowners": [
"@syssi"
],
"config_flow": false,
"dependencies": [],
"documentation": "https://github.com/syssi/xiaomi_raw",
"iot_class": "local_polling",
"issue_tracker": "https://github.com/syssi/xiaomi_raw/issues",
"requirements": [
"construct==2.10.56",
"python-miio>=0.5.12"
],
"dependencies": [],
"codeowners": [
"@syssi"
]
"version": "2023.6.0.0"
}
14 changes: 7 additions & 7 deletions custom_components/xiaomi_miio_raw/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@


# pylint: disable=unused-argument
@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
async def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up the sensor from config."""
if DATA_KEY not in hass.data:
hass.data[DATA_KEY] = {}
Expand Down Expand Up @@ -110,8 +109,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
hass.data[DATA_KEY][host] = device
async_add_devices([device], update_before_add=True)

@asyncio.coroutine
def async_service_handler(service):
async def async_service_handler(service):
"""Map services to methods on XiaomiMiioDevice."""
method = SERVICE_TO_METHOD.get(service.service)
params = {
Expand All @@ -129,11 +127,13 @@ def async_service_handler(service):

update_tasks = []
for device in devices:
yield from getattr(device, method["method"])(**params)
update_tasks.append(device.async_update_ha_state(True))
if not hasattr(device, method["method"]):
continue
await getattr(device, method["method"])(**params)
update_tasks.append(asyncio.create_task(device.async_update_ha_state(True)))

if update_tasks:
yield from asyncio.wait(update_tasks)
await asyncio.wait(update_tasks)

for service in SERVICE_TO_METHOD:
schema = SERVICE_TO_METHOD[service].get("schema", SERVICE_SCHEMA)
Expand Down

0 comments on commit 6bd4b9f

Please sign in to comment.