Fix calling sync api in counter/ffmpeg/device_tracker tests (#113441)

This commit is contained in:
J. Nick Koston 2024-03-14 08:34:44 -10:00 committed by GitHub
parent 2b3f0a9459
commit aaac879c83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 7 deletions

View file

@ -19,7 +19,7 @@ from homeassistant.loader import bind_hass
@bind_hass @bind_hass
def async_increment(hass, entity_id): def async_increment(hass, entity_id):
"""Increment a counter.""" """Increment a counter."""
hass.create_task( hass.async_create_task(
hass.services.async_call(DOMAIN, SERVICE_INCREMENT, {ATTR_ENTITY_ID: entity_id}) hass.services.async_call(DOMAIN, SERVICE_INCREMENT, {ATTR_ENTITY_ID: entity_id})
) )
@ -28,7 +28,7 @@ def async_increment(hass, entity_id):
@bind_hass @bind_hass
def async_decrement(hass, entity_id): def async_decrement(hass, entity_id):
"""Decrement a counter.""" """Decrement a counter."""
hass.create_task( hass.async_create_task(
hass.services.async_call(DOMAIN, SERVICE_DECREMENT, {ATTR_ENTITY_ID: entity_id}) hass.services.async_call(DOMAIN, SERVICE_DECREMENT, {ATTR_ENTITY_ID: entity_id})
) )
@ -37,6 +37,6 @@ def async_decrement(hass, entity_id):
@bind_hass @bind_hass
def async_reset(hass, entity_id): def async_reset(hass, entity_id):
"""Reset a counter.""" """Reset a counter."""
hass.create_task( hass.async_create_task(
hass.services.async_call(DOMAIN, SERVICE_RESET, {ATTR_ENTITY_ID: entity_id}) hass.services.async_call(DOMAIN, SERVICE_RESET, {ATTR_ENTITY_ID: entity_id})
) )

View file

@ -50,4 +50,4 @@ def async_see(
} }
if attributes: if attributes:
data[ATTR_ATTRIBUTES] = attributes data[ATTR_ATTRIBUTES] = attributes
hass.create_task(hass.services.async_call(DOMAIN, SERVICE_SEE, data)) hass.async_create_task(hass.services.async_call(DOMAIN, SERVICE_SEE, data))

View file

@ -27,7 +27,7 @@ def async_start(hass, entity_id=None):
This is a legacy helper method. Do not use it for new tests. This is a legacy helper method. Do not use it for new tests.
""" """
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
hass.create_task(hass.services.async_call(DOMAIN, SERVICE_START, data)) hass.async_create_task(hass.services.async_call(DOMAIN, SERVICE_START, data))
@callback @callback
@ -37,7 +37,7 @@ def async_stop(hass, entity_id=None):
This is a legacy helper method. Do not use it for new tests. This is a legacy helper method. Do not use it for new tests.
""" """
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
hass.create_task(hass.services.async_call(DOMAIN, SERVICE_STOP, data)) hass.async_create_task(hass.services.async_call(DOMAIN, SERVICE_STOP, data))
@callback @callback
@ -47,7 +47,7 @@ def async_restart(hass, entity_id=None):
This is a legacy helper method. Do not use it for new tests. This is a legacy helper method. Do not use it for new tests.
""" """
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
hass.create_task(hass.services.async_call(DOMAIN, SERVICE_RESTART, data)) hass.async_create_task(hass.services.async_call(DOMAIN, SERVICE_RESTART, data))
class MockFFmpegDev(ffmpeg.FFmpegBase): class MockFFmpegDev(ffmpeg.FFmpegBase):