diff --git a/plugin.py b/plugin.py index c4a2bb0..57f6244 100644 --- a/plugin.py +++ b/plugin.py @@ -85,17 +85,26 @@ class OpenWeather(callbacks.Plugin): exclude='minutely,hourly,daily', units='imperial') self.log.info(str(one_call)) curr = one_call.current - report_time = time.ctime(curr.reference_time()) + report_time = curr.reference_time('iso') self.log.info(str(curr)) temp = curr.temperature() measured_temp = temp['temp'] feels_like = temp['feels_like'] + wind_data = curr.wind('miles_hour') + wind_speed = round(wind_data.get('speed', 0), 2) + wind_gust = round(wind_data.get('gust', -1), 2) + wind_dir = wind_data['deg'] + wind_str = str() + if('gust' in wind_data): + wind_str = f'Wind {wind_dir} @ {wind_speed} mph, gusts to {wind_gust} mph.' + else: + wind_str = f'Wind {wind_dir} @ {wind_speed} mph.' + cond = curr.detailed_status - irc.reply(f'Conditions at {loc.name} as of {report_time}: ' - + f'{cond} and {measured_temp} F, feels like {feels_like} F') - + + f'{cond} and {measured_temp} F, feels like {feels_like} F. ' + + wind_str) Class = OpenWeather