mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-08 09:56:30 +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"}}
|
slots = {"entity": {"value": "Kitchen"}}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
intent_response = yield from intent.async_handle(
|
intent_response = await intent.async_handle(
|
||||||
hass, "example_component", intent_type, slots
|
hass, "example_component", intent_type, slots
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -13,8 +13,7 @@ from homeassistant.helpers import intent
|
|||||||
DATA_KEY = "example_key"
|
DATA_KEY = "example_key"
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_setup(hass, config):
|
||||||
def async_setup(hass, config):
|
|
||||||
hass.data[DATA_KEY] = 0
|
hass.data[DATA_KEY] = 0
|
||||||
intent.async_register(hass, CountInvocationIntent())
|
intent.async_register(hass, CountInvocationIntent())
|
||||||
|
|
||||||
@ -30,8 +29,7 @@ class CountInvocationIntent(intent.IntentHandler):
|
|||||||
# 'item': cv.string
|
# 'item': cv.string
|
||||||
# }
|
# }
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def async_handle(self, intent_obj):
|
||||||
def async_handle(self, intent_obj):
|
|
||||||
"""Handle the intent."""
|
"""Handle the intent."""
|
||||||
intent_obj.hass.data[DATA_KEY] += 1
|
intent_obj.hass.data[DATA_KEY] += 1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user