Skip to content

Commit

Permalink
Release v4.5.3 -- Print counts when executing --test-requester (used …
Browse files Browse the repository at this point in the history
…for testing).
  • Loading branch information
chaunceygardiner committed Jul 27, 2024
1 parent 196c32d commit d2dd2be
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down
14 changes: 11 additions & 3 deletions bin/user/nws.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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'],
Expand All @@ -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:
Expand Down Expand Up @@ -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.')

Expand Down Expand Up @@ -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'])
Expand Down
3 changes: 3 additions & 0 deletions changes.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion skins/nws/skin.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d2dd2be

Please sign in to comment.