Add HassRespond intent (#129755)

* Add HassHello intent

* Rename to HassRespond

* LLM's ignore HassRespond intent
pull/124168/head
Michael Hansen 2024-11-03 16:38:52 -06:00 committed by GitHub
parent 8b6c99776e
commit c2ef119e50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 1 deletions

View File

@ -137,6 +137,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
intent.async_register(hass, TimerStatusIntentHandler())
intent.async_register(hass, GetCurrentDateIntentHandler())
intent.async_register(hass, GetCurrentTimeIntentHandler())
intent.async_register(hass, HelloIntentHandler())
return True
@ -364,7 +365,7 @@ class NevermindIntentHandler(intent.IntentHandler):
description = "Cancels the current request and does nothing"
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()
@ -420,6 +421,17 @@ class GetCurrentTimeIntentHandler(intent.IntentHandler):
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(
hass: HomeAssistant, domain: str, platform: IntentPlatformProtocol
) -> None:

View File

@ -56,6 +56,7 @@ INTENT_UNPAUSE_TIMER = "HassUnpauseTimer"
INTENT_TIMER_STATUS = "HassTimerStatus"
INTENT_GET_CURRENT_DATE = "HassGetCurrentDate"
INTENT_GET_CURRENT_TIME = "HassGetCurrentTime"
INTENT_RESPOND = "HassRespond"
SLOT_SCHEMA = vol.Schema({}, extra=vol.ALLOW_EXTRA)

View File

@ -279,6 +279,7 @@ class AssistAPI(API):
intent.INTENT_TOGGLE,
intent.INTENT_GET_CURRENT_DATE,
intent.INTENT_GET_CURRENT_TIME,
intent.INTENT_RESPOND,
}
def __init__(self, hass: HomeAssistant) -> None: