Skip to content

Commit

Permalink
Fix threshold triggers
Browse files Browse the repository at this point in the history
#296  Fix issue with threshold triggers and WeatherUnderground. In 3.3.4, WeatherUnderground API call was modified and incorrectly return values in km, and km/h
  • Loading branch information
dacarson committed Dec 4, 2024
1 parent 2f4e2de commit bcab5aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,3 +298,4 @@

## 3.3.6
* The fix in 3.3.4 for tile naming in Home app was not supported with HomeBridge. Add setting of Name property back for HomeBridge compatibility.
* Fix issue with threshold triggers and WeatherUnderground. In 3.3.4, WeatherUnderground API call was modified and incorrectly return values in km, and km/h.
7 changes: 2 additions & 5 deletions apis/weatherunderground.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ class WundergroundAPI

this.location = location;
this.apiKey = apiKey;

// Get observation values only in si 's' for now.
this.units = 's';
}

update(forecastDays, callback)
Expand All @@ -40,7 +37,7 @@ class WundergroundAPI
let weather = {};
let that = this;

const queryUri = "https://api.weather.com/v2/pws/observations/current?apiKey=" + this.apiKey + "&stationId=" + this.location + "&format=json&units=m" + '&numericPrecision=decimal';
const queryUri = "https://api.weather.com/v2/pws/observations/current?apiKey=" + this.apiKey + "&stationId=" + this.location + "&format=json&units=s" + '&numericPrecision=decimal';
request(encodeURI(queryUri), function (err, response, body)
{
if (!err && body.length > 0)
Expand Down Expand Up @@ -90,7 +87,7 @@ class WundergroundAPI
try
{
let observation = json.observations[0];
let values = observation.metric;
let values = observation.metric_si;

report.ObservationStation = observation.stationID + " : " + observation.neighborhood;
report.ObservationTime = moment(Date.parse(observation.obsTimeUtc)).format('HH:mm:ss');
Expand Down

0 comments on commit bcab5aa

Please sign in to comment.