diff --git a/lib/weather/weathergov/nws.py b/lib/weather/weathergov/nws.py index c19b12e..6a0b4f4 100644 --- a/lib/weather/weathergov/nws.py +++ b/lib/weather/weathergov/nws.py @@ -1,5 +1,8 @@ #!/usr/bin/env python3 import asyncio +import sys +import json +import datetime as dt import lib.weather.weatherbase as base from lib.weather.weather_icon import weather_icon_mapping from lib.asynclib import make_async @@ -22,7 +25,7 @@ async def parse_args(self) -> str: return await self.url_builder() - async def get_long_and_lat(self, location: str=None, zipcode: int=None) -> Tuple: + async def get_long_and_lat(self, location: str=None, zipcode: int=None, url=None) -> Tuple: """ Searches for Longitude and latitude for Given City """ @@ -135,10 +138,10 @@ def __repr__(self) -> str: @property def get_icon(self): # Have to get the icon - condition: int = self._weather[0]['shortForecast'].lower() + condition: str = self._weather[0]['shortForecast'].lower() if any(s in condition.lower() for s in ("sunny", "clear", 'sun')): # Sunny - if self._sunset > datetime.now(): + if self._sunset.replace(tzinfo=None) > datetime.now(): owm_icon = weather_icon_mapping[0] else: owm_icon = weather_icon_mapping[48] @@ -147,7 +150,7 @@ def get_icon(self): elif 'snow' in condition: owm_icon = weather_icon_mapping[13] elif any(s in condition.lower() for s in ('cloudy', 'cloud')): - owm_icon = weather_icon_ampping[7] + owm_icon = weather_icon_mapping[7] else: owm_icon = weather_icon_mapping[0] return owm_icon diff --git a/matrix/weathermatrix.py b/matrix/weathermatrix.py index 8f9d17e..2bde2a0 100755 --- a/matrix/weathermatrix.py +++ b/matrix/weathermatrix.py @@ -85,7 +85,7 @@ def render_icon(self, api) -> None: color: Tuple[int] = (192, 192, 192) elif owm_wxcode == 800: # Sunny - if api.get_sunset > datetime.now(): + if api.dayforcast.sunset.replace(tzinfo=None) > datetime.now(): color: Tuple[int] = (220, 149, 3) else: color: Tuple[int] = (255,255,255)