diff --git a/__init__.py b/__init__.py index 1c112cbf..b30d509e 100644 --- a/__init__.py +++ b/__init__.py @@ -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): @@ -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? @@ -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. @@ -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. @@ -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? @@ -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? @@ -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. @@ -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). @@ -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") @@ -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): @@ -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. @@ -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") @@ -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") @@ -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): @@ -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") ) @@ -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): @@ -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? @@ -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? @@ -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? @@ -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): diff --git a/skill/dialog.py b/skill/dialog.py index b356810d..cd3d6edf 100644 --- a/skill/dialog.py +++ b/skill/dialog.py @@ -38,7 +38,7 @@ from mycroft.util.time import now_local from .config import WeatherConfig from .intent import WeatherIntent -from .util import get_speakable_day_of_week, get_time_period +from .util import get_speakable_day_of_week, get_time_period, get_tz_info from .weather import ( CURRENT, CurrentWeather, @@ -154,7 +154,7 @@ def build_sunrise_dialog(self): if self.intent_data.location is None: now = now_local() else: - now = now_local(tz=self.intent_data.geolocation["timezone"]) + now = now_local(tz=get_tz_info(self.intent_data.geolocation["timezone"])) if now < self.weather.sunrise: self.name += "-sunrise-future" else: @@ -167,11 +167,11 @@ def build_sunset_dialog(self): if self.intent_data.location is None: now = now_local() else: - now = now_local(tz=self.intent_data.geolocation["timezone"]) + now = now_local(tz=get_tz_info(self.intent_data.geolocation["timezone"])) if now < self.weather.sunset: - self.name += ".sunset.future" + self.name += "-sunset-future" else: - self.name = ".sunset.past" + self.name += "-sunset-past" self.data = dict(time=nice_time(self.weather.sunset)) self._add_location() diff --git a/skill/intent.py b/skill/intent.py index 2f39c77e..b62ceb5f 100644 --- a/skill/intent.py +++ b/skill/intent.py @@ -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