Add HassNevermind intent (bump intents package) (#102131)

* Add HassNevermind intent

* Bump intents package to 2023.10.16
This commit is contained in:
Michael Hansen 2023-10-16 19:13:26 -05:00 committed by GitHub
parent 6d457e808f
commit 25671a2e42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 4 deletions

View file

@ -7,5 +7,5 @@
"integration_type": "system",
"iot_class": "local_push",
"quality_scale": "internal",
"requirements": ["hassil==1.2.5", "home-assistant-intents==2023.10.2"]
"requirements": ["hassil==1.2.5", "home-assistant-intents==2023.10.16"]
}

View file

@ -56,6 +56,10 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
hass,
GetStateIntentHandler(),
)
intent.async_register(
hass,
NevermindIntentHandler(),
)
return True
@ -206,6 +210,16 @@ class GetStateIntentHandler(intent.IntentHandler):
return response
class NevermindIntentHandler(intent.IntentHandler):
"""Takes no action."""
intent_type = intent.INTENT_NEVERMIND
async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse:
"""Doe not do anything, and produces an empty response."""
return intent_obj.create_response()
async def _async_process_intent(hass: HomeAssistant, domain: str, platform):
"""Process the intents of an integration."""
await platform.async_setup_intents(hass)

View file

@ -31,6 +31,7 @@ INTENT_TURN_OFF = "HassTurnOff"
INTENT_TURN_ON = "HassTurnOn"
INTENT_TOGGLE = "HassToggle"
INTENT_GET_STATE = "HassGetState"
INTENT_NEVERMIND = "HassNevermind"
SLOT_SCHEMA = vol.Schema({}, extra=vol.ALLOW_EXTRA)

View file

@ -23,7 +23,7 @@ hass-nabucasa==0.73.0
hassil==1.2.5
home-assistant-bluetooth==1.10.3
home-assistant-frontend==20231005.0
home-assistant-intents==2023.10.2
home-assistant-intents==2023.10.16
httpx==0.25.0
ifaddr==0.2.0
janus==1.0.0

View file

@ -1009,7 +1009,7 @@ holidays==0.28
home-assistant-frontend==20231005.0
# homeassistant.components.conversation
home-assistant-intents==2023.10.2
home-assistant-intents==2023.10.16
# homeassistant.components.home_connect
homeconnect==0.7.2

View file

@ -798,7 +798,7 @@ holidays==0.28
home-assistant-frontend==20231005.0
# homeassistant.components.conversation
home-assistant-intents==2023.10.2
home-assistant-intents==2023.10.16
# homeassistant.components.home_connect
homeconnect==0.7.2

View file

@ -283,3 +283,13 @@ async def test_shopping_list_add_item(
assert result.response.speech == {
"plain": {"speech": "Added apples", "extra_data": None}
}
async def test_nevermind_item(hass: HomeAssistant, init_components) -> None:
"""Test HassNevermind intent through the default agent."""
result = await conversation.async_converse(hass, "nevermind", None, Context())
assert result.response.intent is not None
assert result.response.intent.intent_type == intent.INTENT_NEVERMIND
assert result.response.response_type == intent.IntentResponseType.ACTION_DONE
assert not result.response.speech