mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-07 17:36:29 +00:00
Update intent code
This commit is contained in:
parent
cb5af0ecc4
commit
66f0fae3e4
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user