Skip to content

Commit

Permalink
Context slot decisions moved into hassil (#104132)
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Nov 17, 2023
1 parent fd7f75e commit 8c99cf1
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 20 deletions.
11 changes: 2 additions & 9 deletions homeassistant/components/conversation/default_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,11 @@ async def async_process(self, user_input: ConversationInput) -> ConversationResu
# loaded in async_recognize.
assert lang_intents is not None

# Include slot values from intent_context, such as the name of the
# device's area.
# Slot values to pass to the intent
slots = {
entity_name: {"value": entity_value}
for entity_name, entity_value in result.context.items()
entity.name: {"value": entity.value} for entity in result.entities_list
}

# Override context with result entities
slots.update(
{entity.name: {"value": entity.value} for entity in result.entities_list}
)

try:
intent_response = await intent.async_handle(
self.hass,
Expand Down
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.5.0", "home-assistant-intents==2023.11.13"]
"requirements": ["hassil==1.5.1", "home-assistant-intents==2023.11.17"]
}
4 changes: 2 additions & 2 deletions homeassistant/package_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ fnv-hash-fast==0.5.0
ha-av==10.1.1
ha-ffmpeg==3.1.0
hass-nabucasa==0.74.0
hassil==1.5.0
hassil==1.5.1
home-assistant-bluetooth==1.10.4
home-assistant-frontend==20231030.2
home-assistant-intents==2023.11.13
home-assistant-intents==2023.11.17
httpx==0.25.0
ifaddr==0.2.0
janus==1.0.0
Expand Down
4 changes: 2 additions & 2 deletions requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ hass-nabucasa==0.74.0
hass-splunk==0.1.1

# homeassistant.components.conversation
hassil==1.5.0
hassil==1.5.1

# homeassistant.components.jewish_calendar
hdate==0.10.4
Expand Down Expand Up @@ -1018,7 +1018,7 @@ holidays==0.36
home-assistant-frontend==20231030.2

# homeassistant.components.conversation
home-assistant-intents==2023.11.13
home-assistant-intents==2023.11.17

# homeassistant.components.home_connect
homeconnect==0.7.2
Expand Down
4 changes: 2 additions & 2 deletions requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ habitipy==0.2.0
hass-nabucasa==0.74.0

# homeassistant.components.conversation
hassil==1.5.0
hassil==1.5.1

# homeassistant.components.jewish_calendar
hdate==0.10.4
Expand All @@ -802,7 +802,7 @@ holidays==0.36
home-assistant-frontend==20231030.2

# homeassistant.components.conversation
home-assistant-intents==2023.11.13
home-assistant-intents==2023.11.17

# homeassistant.components.home_connect
homeconnect==0.7.2
Expand Down
8 changes: 4 additions & 4 deletions tests/components/conversation/test_default_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,10 @@ async def test_device_area_context(
)
device_registry.async_update_device(bedroom_satellite.id, area_id=area_bedroom.id)

# Turn on all lights in the area of a device
# Turn on lights in the area of a device
result = await conversation.async_converse(
hass,
"turn on all lights",
"turn on the lights",
None,
Context(),
None,
Expand All @@ -367,7 +367,7 @@ async def test_device_area_context(
# Ensure we can still target other areas by name
result = await conversation.async_converse(
hass,
"turn on all lights in the bedroom",
"turn on lights in the bedroom",
None,
Context(),
None,
Expand All @@ -388,7 +388,7 @@ async def test_device_area_context(
# Turn off all lights in the area of the otherkj device
result = await conversation.async_converse(
hass,
"turn all lights off",
"turn lights off",
None,
Context(),
None,
Expand Down

0 comments on commit 8c99cf1

Please sign in to comment.