From 66f0fae3e404ec5e2fe76d8034e4a8f6605caa2b Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 8 Jan 2023 21:32:17 -0500 Subject: [PATCH] Update intent code --- docs/intent_firing.md | 2 +- docs/intent_handling.md | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/intent_firing.md b/docs/intent_firing.md index bec92f25..efdf2be2 100644 --- a/docs/intent_firing.md +++ b/docs/intent_firing.md @@ -13,7 +13,7 @@ intent_type = "TurnLightOn" slots = {"entity": {"value": "Kitchen"}} try: - intent_response = yield from intent.async_handle( + intent_response = await intent.async_handle( hass, "example_component", intent_type, slots ) diff --git a/docs/intent_handling.md b/docs/intent_handling.md index 6c3a9b6a..7a84f698 100644 --- a/docs/intent_handling.md +++ b/docs/intent_handling.md @@ -13,8 +13,7 @@ from homeassistant.helpers import intent DATA_KEY = "example_key" -@asyncio.coroutine -def async_setup(hass, config): +async def async_setup(hass, config): hass.data[DATA_KEY] = 0 intent.async_register(hass, CountInvocationIntent()) @@ -30,8 +29,7 @@ class CountInvocationIntent(intent.IntentHandler): # 'item': cv.string # } - @asyncio.coroutine - def async_handle(self, intent_obj): + async def async_handle(self, intent_obj): """Handle the intent.""" intent_obj.hass.data[DATA_KEY] += 1