Skip to content

Commit

Permalink
Add HassNevermind intent (bump intents package) (home-assistant#102131)
Browse files Browse the repository at this point in the history
* Add HassNevermind intent

* Bump intents package to 2023.10.16
  • Loading branch information
synesthesiam authored Oct 17, 2023
1 parent 6d457e8 commit 25671a2
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/conversation/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
14 changes: 14 additions & 0 deletions homeassistant/components/intent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
hass,
GetStateIntentHandler(),
)
intent.async_register(
hass,
NevermindIntentHandler(),
)

return True

Expand Down Expand Up @@ -206,6 +210,16 @@ async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse
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)
Expand Down
1 change: 1 addition & 0 deletions homeassistant/helpers/intent.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
INTENT_TURN_ON = "HassTurnOn"
INTENT_TOGGLE = "HassToggle"
INTENT_GET_STATE = "HassGetState"
INTENT_NEVERMIND = "HassNevermind"

SLOT_SCHEMA = vol.Schema({}, extra=vol.ALLOW_EXTRA)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/package_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions tests/components/conversation/test_default_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 25671a2

Please sign in to comment.