1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Update service call return values and error handling (#94657)

* Update return signature of service calls

* Add timeout error handling in websocket api for service calls

* Update recorder tests to remove assertion on service call

* Remove timeout behavior and update callers that depend on it today

* Fix tests

* Add missing else

* await coro directly

* Fix more tests

* Update the intent task to use wait instead of timeout

* Remove script service call limits and limit constants

* Update tests that depend on service call limits

* Use wait instead of wait_for and add test

* Update homeassistant/helpers/intent.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Allen Porter
2023-06-16 07:01:40 -07:00
committed by GitHub
parent 950b25bf42
commit 12129e9d21
63 changed files with 388 additions and 434 deletions

View File

@@ -106,7 +106,7 @@ async def test_fan_reset_filter_service(
hass: HomeAssistant, pywemo_device, wemo_entity
) -> None:
"""Verify that SERVICE_RESET_FILTER_LIFE is registered and works."""
assert await hass.services.async_call(
await hass.services.async_call(
DOMAIN,
fan.SERVICE_RESET_FILTER_LIFE,
{ATTR_ENTITY_ID: wemo_entity.entity_id},
@@ -130,7 +130,7 @@ async def test_fan_set_humidity_service(
hass: HomeAssistant, pywemo_device, wemo_entity, test_input, expected
) -> None:
"""Verify that SERVICE_SET_HUMIDITY is registered and works."""
assert await hass.services.async_call(
await hass.services.async_call(
DOMAIN,
fan.SERVICE_SET_HUMIDITY,
{
@@ -157,7 +157,7 @@ async def test_fan_set_percentage(
hass: HomeAssistant, pywemo_device, wemo_entity, percentage, expected_fan_mode
) -> None:
"""Verify set_percentage works properly through the entire range of FanModes."""
assert await hass.services.async_call(
await hass.services.async_call(
FAN_DOMAIN,
SERVICE_SET_PERCENTAGE,
{ATTR_ENTITY_ID: [wemo_entity.entity_id], ATTR_PERCENTAGE: percentage},
@@ -170,7 +170,7 @@ async def test_fan_mode_high_initially(hass: HomeAssistant, pywemo_device) -> No
"""Verify the FanMode is set to High when turned on."""
pywemo_device.fan_mode = FanMode.Off
wemo_entity = await async_create_wemo_entity(hass, pywemo_device, "")
assert await hass.services.async_call(
await hass.services.async_call(
FAN_DOMAIN,
SERVICE_TURN_ON,
{ATTR_ENTITY_ID: [wemo_entity.entity_id]},