Skip to content

Commit 6d54282

Browse files
authored
Fix weather sentences without a name (#1690)
1 parent df071d9 commit 6d54282

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

sentences/en/weather_HassGetWeather.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ intents:
33
HassGetWeather:
44
data:
55
- sentences:
6-
- "<what_is>[ the] weather[ like][( for| in| at) <name>]"
7-
- "<what_is>[ the] weather[( for| in| at) <name>] like"
6+
- "<what_is>[ the] weather[ like]"
7+
- sentences:
8+
- "<what_is>[ the] weather[ like] (for|in|at) <name>"
9+
- "<what_is>[ the] weather (for|in|at) <name>[ like]"
810
- "<what_is>[ the] <name> weather[ like]"
911
requires_context:
1012
domain: weather

shared/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ def get_matched_states(
6161
if result.intent.name in ("HassClimateGetTemperature", "HassClimateSetTemperature"):
6262
# Match climate entities only
6363
states = [state for state in states if state.domain == "climate"]
64+
elif result.intent.name in ("HassGetWeather",):
65+
# Match weather entities only
66+
states = [state for state in states if state.domain == "weather"]
6467

6568
# Implement some matching logic from Home Assistant
6669
entity_name: Optional[str] = None

tests/en/weather_HassGetWeather.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
language: en
22
tests:
3+
- sentences:
4+
- "what's the weather?"
5+
- "what is the weather like"
6+
intent:
7+
name: HassGetWeather
8+
response: 47 °F and raining
9+
310
- sentences:
411
- "what's the weather like in london?"
512
- "what is the weather in London like"

0 commit comments

Comments
 (0)