diff --git a/README.md b/README.md index 228f7f8..0cd443c 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,11 @@ Copyright (C)2020-2024 by John A Kline (john@johnkline.com) `pip install requests` 1. Download the release from the [github](https://github.com/chaunceygardiner/weewx-nws). - Click on releases and pick the latest release (Release v4.5.2). + Click on releases and pick the latest release (Release v4.5.3). 1. Install the nws extension. - `weectl extension install weewx-nws-4.5.2.zip` + `weectl extension install weewx-nws-4.5.3.zip` ## WeeWX 4 Installation Instructions @@ -52,11 +52,11 @@ Copyright (C)2020-2024 by John A Kline (john@johnkline.com) ``` 1. Download the release from the [github](https://github.com/chaunceygardiner/weewx-nws). - Click on releases and pick the latest release (Release v4.5.2). + Click on releases and pick the latest release (Release v4.5.3). 1. Run the following command. ``` - sudo /home/weewx/bin/wee_extension --install weewx-nws-4.5.2.zip + sudo /home/weewx/bin/wee_extension --install weewx-nws-4.5.3.zip ``` Note: The above command assumes a WeeWX installation of `/home/weewx`. Adjust the command as necessary. diff --git a/bin/user/nws.py b/bin/user/nws.py index 0290eec..c6c87c8 100755 --- a/bin/user/nws.py +++ b/bin/user/nws.py @@ -50,7 +50,7 @@ log = logging.getLogger(__name__) -WEEWX_NWS_VERSION = "4.5.2" +WEEWX_NWS_VERSION = "4.5.3" if sys.version_info[0] < 3: raise weewx.UnsupportedFeature( @@ -1342,7 +1342,6 @@ def sanity_check_forecast_json(j: Dict[str, Any], forecast_type: ForecastType) - err = NWSPoller.check_for_str_entries(period, [ ['windSpeed'], - ['windDirection'], ['name'], ['temperatureTrend'], ['icon'], @@ -1354,6 +1353,12 @@ def sanity_check_forecast_json(j: Dict[str, Any], forecast_type: ForecastType) - if err: return err + err = NWSPoller.check_for_str_entries(period, [ + ['windDirection'], + ], allow_none = True) + if err: + return err + try: _ = datetime.datetime.fromisoformat(period['startTime']).timestamp() except Exception as e: @@ -1934,9 +1939,12 @@ def test_requester(forecast_type: ForecastType, lat: float, long: float) -> None _, j = NWSPoller.request_forecast(cfg, forecast_type) if j is not None: + count: int = 0 for forecast in NWSPoller.compose_records(j, forecast_type, cfg.latitude, cfg.longitude): + count += 1 pretty_print_forecast(forecast) print('------------------------') + print('%d %s printed.' % (count, forecast_type)) else: print('request_forecast returned None.') @@ -2366,7 +2374,7 @@ def pretty_print_record(record, forecast_type) -> None: print('outHumidity : %s' % (record['outHumidity'] if record['outHumidity'] is not None else 'None')) print('windSpeed : %f' % record['windSpeed']) print('windSpeed2 : %s' % (record['windSpeed2'] if record['windSpeed2'] is not None else 'None')) - print('windDir : %f' % record['windDir']) + print('windDir : %s' % (record['windDir'] if record['windDir'] is not None else 'None')) print('iconUrl : %s' % record['iconUrl']) print('shortForecast : %s' % record['shortForecast']) print('detailedForecast: %s' % record['detailedForecast']) diff --git a/changes.txt b/changes.txt index a642091..b83cdcb 100644 --- a/changes.txt +++ b/changes.txt @@ -1,6 +1,9 @@ nws change history ------------------ +4.5.3 07/27/2024 +- Print counts when executing --test-requester (used for testing). + 4.5.2 07/24/2024 - Another import cleanup. - rename --test-parsing-all-alerts to --test-parse-all-alerts diff --git a/install.py b/install.py index 5d958d9..1715e00 100644 --- a/install.py +++ b/install.py @@ -22,7 +22,7 @@ def loader(): class NWSInstaller(ExtensionInstaller): def __init__(self): super(NWSInstaller, self).__init__( - version="4.5.2", + version="4.5.3", name='nws', description='Fetch NWS Hourly Forecast.', author="John A Kline", diff --git a/skins/nws/skin.conf b/skins/nws/skin.conf index d7c29a7..6123cef 100644 --- a/skins/nws/skin.conf +++ b/skins/nws/skin.conf @@ -2,7 +2,7 @@ ## See LICENSE.txt for your rights [Extras] - version = 4.5.2 + version = 4.5.3 [CheetahGenerator] search_list_extensions = user.nws.NWSForecastVariables