Update intent code

This commit is contained in:
Paulus Schoutsen 2023-01-08 21:32:17 -05:00
parent cb5af0ecc4
commit 66f0fae3e4
2 changed files with 3 additions and 5 deletions

View File

@ -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
)

View File

@ -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