mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 14:57:09 +00:00
Add HassRespond intent (#129755)
* Add HassHello intent * Rename to HassRespond * LLM's ignore HassRespond intent
This commit is contained in:
parent
8b6c99776e
commit
c2ef119e50
@ -137,6 +137,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
intent.async_register(hass, TimerStatusIntentHandler())
|
intent.async_register(hass, TimerStatusIntentHandler())
|
||||||
intent.async_register(hass, GetCurrentDateIntentHandler())
|
intent.async_register(hass, GetCurrentDateIntentHandler())
|
||||||
intent.async_register(hass, GetCurrentTimeIntentHandler())
|
intent.async_register(hass, GetCurrentTimeIntentHandler())
|
||||||
|
intent.async_register(hass, HelloIntentHandler())
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -364,7 +365,7 @@ class NevermindIntentHandler(intent.IntentHandler):
|
|||||||
description = "Cancels the current request and does nothing"
|
description = "Cancels the current request and does nothing"
|
||||||
|
|
||||||
async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse:
|
async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse:
|
||||||
"""Doe not do anything, and produces an empty response."""
|
"""Do nothing and produces an empty response."""
|
||||||
return intent_obj.create_response()
|
return intent_obj.create_response()
|
||||||
|
|
||||||
|
|
||||||
@ -420,6 +421,17 @@ class GetCurrentTimeIntentHandler(intent.IntentHandler):
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
class HelloIntentHandler(intent.IntentHandler):
|
||||||
|
"""Responds with no action."""
|
||||||
|
|
||||||
|
intent_type = intent.INTENT_RESPOND
|
||||||
|
description = "Returns the provided response with no action."
|
||||||
|
|
||||||
|
async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse:
|
||||||
|
"""Return the provided response, but take no action."""
|
||||||
|
return intent_obj.create_response()
|
||||||
|
|
||||||
|
|
||||||
async def _async_process_intent(
|
async def _async_process_intent(
|
||||||
hass: HomeAssistant, domain: str, platform: IntentPlatformProtocol
|
hass: HomeAssistant, domain: str, platform: IntentPlatformProtocol
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -56,6 +56,7 @@ INTENT_UNPAUSE_TIMER = "HassUnpauseTimer"
|
|||||||
INTENT_TIMER_STATUS = "HassTimerStatus"
|
INTENT_TIMER_STATUS = "HassTimerStatus"
|
||||||
INTENT_GET_CURRENT_DATE = "HassGetCurrentDate"
|
INTENT_GET_CURRENT_DATE = "HassGetCurrentDate"
|
||||||
INTENT_GET_CURRENT_TIME = "HassGetCurrentTime"
|
INTENT_GET_CURRENT_TIME = "HassGetCurrentTime"
|
||||||
|
INTENT_RESPOND = "HassRespond"
|
||||||
|
|
||||||
SLOT_SCHEMA = vol.Schema({}, extra=vol.ALLOW_EXTRA)
|
SLOT_SCHEMA = vol.Schema({}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
|
@ -279,6 +279,7 @@ class AssistAPI(API):
|
|||||||
intent.INTENT_TOGGLE,
|
intent.INTENT_TOGGLE,
|
||||||
intent.INTENT_GET_CURRENT_DATE,
|
intent.INTENT_GET_CURRENT_DATE,
|
||||||
intent.INTENT_GET_CURRENT_TIME,
|
intent.INTENT_GET_CURRENT_TIME,
|
||||||
|
intent.INTENT_RESPOND,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant) -> None:
|
def __init__(self, hass: HomeAssistant) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user