Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix condition/.. requests with location information #175

Open
wants to merge 3 commits into
base: 21.02
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def initialize(self):
IntentBuilder("")
.optionally("query")
.one_of("weather", "forecast")
.optionally("location")
.optionally("Location")
.optionally("today")
)
def handle_current_weather(self, message: Message):
Expand All @@ -90,7 +90,7 @@ def handle_current_weather(self, message: Message):
.require("query")
.require("like")
.require("outside")
.optionally("location")
.optionally("Location")
)
def handle_like_outside(self, message: Message):
"""Handle current weather requests such as: what's it like outside?
Expand All @@ -105,7 +105,7 @@ def handle_like_outside(self, message: Message):
.optionally("query")
.one_of("weather", "forecast")
.require("number-days")
.optionally("location")
.optionally("Location")
)
def handle_number_days_forecast(self, message: Message):
"""Handle multiple day forecast without specified location.
Expand All @@ -130,7 +130,7 @@ def handle_number_days_forecast(self, message: Message):
.optionally("query")
.one_of("weather", "forecast")
.require("relative-day")
.optionally("location")
.optionally("Location")
)
def handle_one_day_forecast(self, message):
"""Handle forecast for a single day.
Expand All @@ -149,7 +149,7 @@ def handle_one_day_forecast(self, message):
.require("query")
.require("weather")
.require("later")
.optionally("location")
.optionally("Location")
)
def handle_weather_later(self, message: Message):
"""Handle future weather requests such as: what's the weather later?
Expand All @@ -165,7 +165,7 @@ def handle_weather_later(self, message: Message):
.one_of("weather", "forecast")
.require("relative-time")
.optionally("relative-day")
.optionally("location")
.optionally("Location")
)
def handle_weather_at_time(self, message: Message):
"""Handle future weather requests such as: what's the weather tonight?
Expand All @@ -180,7 +180,7 @@ def handle_weather_at_time(self, message: Message):
.require("query")
.one_of("weather", "forecast")
.require("weekend")
.optionally("location")
.optionally("Location")
)
def handle_weekend_forecast(self, message: Message):
"""Handle requests for the weekend forecast.
Expand All @@ -195,7 +195,7 @@ def handle_weekend_forecast(self, message: Message):
.optionally("query")
.one_of("weather", "forecast")
.require("week")
.optionally("location")
.optionally("Location")
)
def handle_week_weather(self, message: Message):
"""Handle weather for week (i.e. seven days).
Expand All @@ -209,7 +209,7 @@ def handle_week_weather(self, message: Message):
IntentBuilder("")
.optionally("query")
.require("temperature")
.optionally("location")
.optionally("Location")
.optionally("unit")
.optionally("today")
.optionally("now")
Expand All @@ -231,7 +231,7 @@ def handle_current_temperature(self, message: Message):
.optionally("query")
.require("temperature")
.require("relative-day")
.optionally("location")
.optionally("Location")
.optionally("unit")
)
def handle_daily_temperature(self, message: Message):
Expand All @@ -250,7 +250,7 @@ def handle_daily_temperature(self, message: Message):
.require("temperature")
.require("relative-time")
.optionally("relative-day")
.optionally("location")
.optionally("Location")
)
def handle_hourly_temperature(self, message: Message):
"""Handle requests for current temperature at a relative time.
Expand All @@ -269,7 +269,7 @@ def handle_hourly_temperature(self, message: Message):
.optionally("query")
.require("high")
.optionally("temperature")
.optionally("location")
.optionally("Location")
.optionally("unit")
.optionally("relative-day")
.optionally("now")
Expand All @@ -292,7 +292,7 @@ def handle_high_temperature(self, message: Message):
.optionally("query")
.require("low")
.optionally("temperature")
.optionally("location")
.optionally("Location")
.optionally("unit")
.optionally("relative-day")
.optionally("now")
Expand All @@ -314,7 +314,7 @@ def handle_low_temperature(self, message: Message):
IntentBuilder("")
.require("confirm-query-current")
.one_of("hot", "cold")
.optionally("location")
.optionally("Location")
.optionally("today")
)
def handle_is_it_hot(self, message: Message):
Expand All @@ -330,7 +330,7 @@ def handle_is_it_hot(self, message: Message):
.optionally("query")
.one_of("hot", "cold")
.require("confirm-query")
.optionally("location")
.optionally("Location")
.optionally("relative-day")
.optionally("today")
)
Expand All @@ -348,7 +348,7 @@ def handle_how_hot_or_cold(self, message):
IntentBuilder("")
.require("confirm-query")
.require("windy")
.optionally("location")
.optionally("Location")
.optionally("relative-day")
)
def handle_is_it_windy(self, message: Message):
Expand All @@ -365,7 +365,7 @@ def handle_is_it_windy(self, message: Message):
.require("windy")
.optionally("confirm-query")
.optionally("relative-day")
.optionally("location")
.optionally("Location")
)
def handle_windy(self, message):
"""Handler for weather requests such as: how windy is it?
Expand All @@ -379,7 +379,7 @@ def handle_windy(self, message):
IntentBuilder("")
.require("confirm-query")
.require("snow")
.optionally("location")
.optionally("Location")
)
def handle_is_it_snowing(self, message: Message):
"""Handler for weather requests such as: is it snowing today?
Expand All @@ -393,7 +393,7 @@ def handle_is_it_snowing(self, message: Message):
IntentBuilder("")
.require("confirm-query")
.require("clear")
.optionally("location")
.optionally("Location")
)
def handle_is_it_clear(self, message: Message):
"""Handler for weather requests such as: is the sky clear today?
Expand All @@ -407,7 +407,7 @@ def handle_is_it_clear(self, message: Message):
IntentBuilder("")
.require("confirm-query")
.require("clouds")
.optionally("location")
.optionally("Location")
.optionally("relative-time")
)
def handle_is_it_cloudy(self, message: Message):
Expand All @@ -419,7 +419,7 @@ def handle_is_it_cloudy(self, message: Message):
self._report_weather_condition(message, "clouds")

@intent_handler(
IntentBuilder("").require("ConfirmQuery").require("Fog").optionally("location")
IntentBuilder("").require("ConfirmQuery").require("Fog").optionally("Location")
)
def handle_is_it_foggy(self, message: Message):
"""Handler for weather requests such as: is it foggy today?
Expand All @@ -430,7 +430,7 @@ def handle_is_it_foggy(self, message: Message):
self._report_weather_condition(message, "fog")

@intent_handler(
IntentBuilder("").require("ConfirmQuery").require("Rain").optionally("location")
IntentBuilder("").require("ConfirmQuery").require("Rain").optionally("Location")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is capitalized

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah it looks like this got changed in a recent commit from @chrisveilleux that's not yet on your fork.

)
def handle_is_it_raining(self, message: Message):
"""Handler for weather requests such as: is it raining today?
Expand All @@ -453,7 +453,7 @@ def handle_need_umbrella(self, message: Message):
IntentBuilder("")
.require("ConfirmQuery")
.require("Thunderstorm")
.optionally("location")
.optionally("Location")
)
def handle_is_it_storming(self, message: Message):
"""Handler for weather requests such as: is it storming today?
Expand All @@ -468,7 +468,7 @@ def handle_is_it_storming(self, message: Message):
.require("When")
.optionally("Next")
.require("Precipitation")
.optionally("location")
.optionally("Location")
)
def handle_next_precipitation(self, message: Message):
"""Handler for weather requests such as: when will it rain next?
Expand All @@ -495,7 +495,7 @@ def handle_next_precipitation(self, message: Message):
.require("Query")
.require("Humidity")
.optionally("RelativeDay")
.optionally("location")
.optionally("Location")
)
def handle_humidity(self, message: Message):
"""Handler for weather requests such as: how humid is it?
Expand All @@ -520,7 +520,7 @@ def handle_humidity(self, message: Message):
@intent_handler(
IntentBuilder("")
.one_of("Query", "When")
.optionally("location")
.optionally("Location")
.require("Sunrise")
.optionally("Today")
.optionally("RelativeDay")
Expand All @@ -546,7 +546,7 @@ def handle_sunrise(self, message: Message):
IntentBuilder("")
.one_of("Query", "When")
.require("Sunset")
.optionally("location")
.optionally("Location")
.optionally("Today")
.optionally("RelativeDay")
)
Expand Down
2 changes: 1 addition & 1 deletion skill/intent.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, message, language):
:param language: The configured language of the device
"""
self.utterance = message.data["utterance"]
self.location = message.data.get("location")
self.location = message.data.get("Location")
self.language = language
self.unit = message.data.get("unit")
self.timeframe = CURRENT
Expand Down