Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisveilleux committed May 12, 2021
1 parent 5d38589 commit 4c62179
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
7 changes: 6 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ def handle_hourly_temperature(self, message: Message):
.optionally("Location")
.optionally("Unit")
.optionally("RelativeDay")
.optionally('Now')
.optionally("Today")
)
def handle_high_temperature(self, message: Message):
"""Handle a request for the high temperature.
Expand All @@ -303,6 +305,8 @@ def handle_high_temperature(self, message: Message):
.optionally("Location")
.optionally("Unit")
.optionally("RelativeDay")
.optionally("Now")
.optionally("Today")
)
def handle_low_temperature(self, message: Message):
"""Handle a request for the high temperature.
Expand Down Expand Up @@ -331,11 +335,12 @@ def handle_is_it_hot(self, message: Message):

@intent_handler(
IntentBuilder("")
.optionally("How")
.optionally("Query")
.one_of("Hot", "Cold")
.require("ConfirmQuery")
.optionally("Location")
.optionally("RelativeDay")
.optionally("Today")
)
def handle_how_hot_or_cold(self, message):
"""Handler for temperature requests such as: how cold will it be today?
Expand Down
5 changes: 0 additions & 5 deletions locale/en-us/Temperature.voc
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
temperature
temp
cold
chilly
cool
warm
hot
11 changes: 9 additions & 2 deletions source/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ def build_temperature_dialog(self, temperature_type: str):
self.data = dict(temperature=self.weather.low_temperature)
else:
self.data = dict(temperature=self.weather.temperature)
self.data.update(
temperature_unit=self.intent_data.unit or self.config.temperature_unit
)
self._add_location()

def build_condition_dialog(self, intent_match: bool):
Expand Down Expand Up @@ -226,7 +229,7 @@ def __init__(

def build_weather_dialog(self):
"""Build the components necessary to speak the forecast for a hour."""
self.name = ".weather"
self.name += ".weather"
self.data = dict(
condition=self.weather.condition.description,
time=self.weather.date_time.strftime("%H:00"),
Expand All @@ -240,6 +243,7 @@ def build_temperature_dialog(self, _):
self.data = dict(
temperature=self.weather.temperature,
time=get_time_period(self.weather.date_time),
temperature_unit=self.intent_data.unit or self.config.temperature_unit
)
self._add_location()

Expand Down Expand Up @@ -300,7 +304,10 @@ def build_temperature_dialog(self, temperature_type: str):
self.data = dict(temperature=self.weather.temperature.low)
else:
self.data = dict(temperature=self.weather.temperature.day)
self.data.update(day=get_speakable_day_of_week(self.weather.date_time))
self.data.update(
day=get_speakable_day_of_week(self.weather.date_time),
temperature_unit = self.intent_data.unit or self.config.temperature_unit
)
self._add_location()

def build_condition_dialog(self, intent_match: bool):
Expand Down
2 changes: 1 addition & 1 deletion test/behave/hourly-weather-local.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Feature: Mycroft Weather Skill local hourly forecasts
Scenario Outline: what is the weather later
Given an english speaking user
When the user says "<what is the weather later>"
Then "mycroft-weather" should reply with dialog from "daily.weather.local.dialog"
Then "mycroft-weather" should reply with dialog from "hourly.weather.local.dialog"

Examples: What is the weather later
| what is the weather later |
Expand Down
2 changes: 1 addition & 1 deletion test/behave/hourly-weather-location.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Feature: Mycroft Weather Skill hourly forecasts at a specified location
Scenario Outline: User asks what the weather is later at a location
Given an english speaking user
When the user says "<what is the weather later>"
Then "mycroft-weather" should reply with dialog from "daily.weather.location.dialog"
Then "mycroft-weather" should reply with dialog from "hourly.weather.location.dialog"

Examples: What is the weather later
| what is the weather later |
Expand Down

0 comments on commit 4c62179

Please sign in to comment.