Await service calls in emulated_hue instead of making them blocking (#111674)

This commit is contained in:
J. Nick Koston 2024-02-27 12:44:27 -10:00 committed by GitHub
parent 105a1ca127
commit 2b19783311
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -586,21 +586,17 @@ class HueOneLightChangeView(HomeAssistantView):
# Separate call to turn on needed # Separate call to turn on needed
if turn_on_needed: if turn_on_needed:
hass.async_create_task( await hass.services.async_call(
hass.services.async_call( core.DOMAIN,
core.DOMAIN, SERVICE_TURN_ON,
SERVICE_TURN_ON, {ATTR_ENTITY_ID: entity_id},
{ATTR_ENTITY_ID: entity_id}, blocking=False,
blocking=True,
)
) )
if service is not None: if service is not None:
state_will_change = parsed[STATE_ON] != _hass_to_hue_state(entity) state_will_change = parsed[STATE_ON] != _hass_to_hue_state(entity)
hass.async_create_task( await hass.services.async_call(domain, service, data, blocking=False)
hass.services.async_call(domain, service, data, blocking=True)
)
if state_will_change: if state_will_change:
# Wait for the state to change. # Wait for the state to change.