Skip to content

Commit

Permalink
Add awaits to service call (untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
magico13 committed Nov 5, 2023
1 parent 17b4bd5 commit 360c625
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions custom_components/emporia_vue/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ async def handle_set_charger_current(call):

charger_entity = None
if device_id:
entity_registry = er.async_get(hass)
entities = er.async_entries_for_device(entity_registry, device_id[0])
entity_registry = await er.async_get(hass)
entities = await er.async_entries_for_device(entity_registry, device_id[0])
for entity in entities:
_LOGGER.info("Entity is %s", str(entity))
if entity.entity_id.startswith("switch"):
Expand All @@ -235,8 +235,8 @@ async def handle_set_charger_current(call):
if not charger_entity:
charger_entity = entities[0]
elif entity_id:
entity_registry = er.async_get(hass)
charger_entity = entity_registry.async_get(entity_id[0])
entity_registry = await er.async_get(hass)
charger_entity = await entity_registry.async_get(entity_id[0])
if not charger_entity:
raise HomeAssistantError("Target device or Entity required.")

Expand Down

0 comments on commit 360c625

Please sign in to comment.