naofireblade / homebridge-weather-plus

A comprehensive weather plugin for homebridge.
MIT License
323 stars 64 forks source link

Wind speed threshold error in v3.3.5 #296

Open threeonparfive opened 6 months ago

threeonparfive commented 6 months ago

I'm pretty sure there is a new issue in v3.3.5 relating to the wind speed threshold that triggers the occupancy sensor. I have my threshold set to '6' and my units are set to "imperial". In the past, it was been working as expected where winds exceeding 6mph would set occupancy on. I'm not 100% sure if it was the Wunderground "speed" or "gust" value that triggers but it was close enough for desired function.

Now I've seen the sensor being triggered on several times today and thus far, not a single time since upgrading to 3.3.5 has the wind speed (or gust) hit 6mph.

Here is my config. I've also attached a snip from the Wunderground data table where I've underlined all of the times that correspond with the reading Homebridge would have gotten at the time occupancy was triggered. Screenshot 2024-05-15 at 11 31 27 AM

{ "units": "us", "interval": 1, "stations": [ { "nameNow": "KPTPeppertree", "service": "weatherunderground", "key": "xxxxxxxxxx", "stationId": "KTNKINGS343", "language": "en", "compatibility": "home", "conditionCategory": "simple", "now": true, "extraHumidity": false, "hidden": [ "Air Pressure", "Cloud Cover", "Condition", "Condition Category", "Dew Point", "Forecast Day", "Humidity", "Observation Station", "Observation Time", "Ozone", "Rain", "Rain 1h", "Rain Day", "Rain Chance", "Snow", "Solar Radiation", "Sunrise Time", "Sunset Time", "Temperature Min", "Temperature Apparent", "UV Index", "Visibility", "Wind Direction", "Wind Speed Max" ], "thresholdWindSpeed": 6 } ], "platform": "WeatherPlus", "_bridge": { "username": "xxxxxxxxx", "port": 59142 } }

threeonparfive commented 6 months ago

Something else I noticed, now that I've rolled back to v3.3.3, is that the accessory label has become "messed up" in v3.3.5. In v3.3.3, the last read wind speed is actually part of the accessory label. That wasn't happen on v3.3.5 unless the sensor was triggered (which as stated above, is happening in error).

Here's what I see in 3.3.3: Screenshot 2024-05-15 at 11 49 23 AM

dacarson commented 6 months ago

I'll take a look to see what might be happening.

First, FYI. The code has a default Wind Speed threshold of '5 m/s', which it will use if it can't find a defined threshold. In 3.3.5 I fixed some issues with the Plugin Config UI and thresholds. In version 3.3.3 the value in the config.json needed to called treshold, but it would not appear in the Config UI nor would a value entered there be saved. I see in your message above "thresholdWindSpeed": 6, which is correct for 3.3.5 but won't work with 3.3.3. With that config, 3.3.3 will use the built in default of 5 m/s.

AFACT continuously changing tile titles is not something HomeKit supports. HomeKit system seems to be setup to support sensors and with names, and the sensor has a data independent to the title. The system is optimized for updating the data of a sensor, not its title. HomeKit sensor and hubs all operate in metric units, and when the data is displayed, or used in automation, it is converted to the user's preference. The title was fully controlled by the sensor, though lately that was changed and thus this plugin's usage of it broke (#247). Reading through comments of others, I found that the sensor can set a default name that is reflected in the App and the App can override that default name. I modified the code to make use of this 'default name' for the sensor title. I can see rolling back will mess things up, as 3.3.3 didn't make use of the default name. You may need to remove HomeBridge and re-add it to clear them up.

As the sensor title with value and unit is built by this plugin, this plugin does unit conversion independent of HomeKit. I am guessing that that is the issue here. The WeatherUnderground service was requesting from the WU server the data in the units that you had specified "units": "us",, this was confusing the management of the data, as HomeKit is metric. So temperatures, for example, had to be converted back to C for HomeKit. I did changes this so that the WeatherUnderground service always requested metric data, and let either HomeKit convert it or this plugin convert it.

All that said, it looks like the conversion may not be happening.

threeonparfive commented 6 months ago

Sorry...I may not have been completely clear about the sensor name thing, and perhaps it's not even related to the miscalculations. What I meant was, the accessory sensor name in Homebridge updates with the most recent wind speed with every polling interval under v3.3.3, but this doesn't carry over to HomeKit....never has. And I don't expect it to at this point. I was merely pointing out that in v3.5, the wind speed no longer shows up on the accessory name.

Here are two snapshots, taken 1 minute apart, showing that the name does update in v3.3.3. Even though this may have nothing to do with the mis-calculation issue, it does help to be able to see what wind speed is being picked up on each polling interval for troubleshooting, etc. Screenshot 2024-05-17 at 6 34 35 AM Screenshot 2024-05-17 at 6 30 32 AM

dacarson commented 6 months ago

Ah, I see. It looks like HomeBridge doesn't fully support ConfiguredName for a Characteristic, in that, it doesn't update it when it changes. I will add back setting the Name, for HomeBridge, and setting ConfiguredName for HomeKit apps.

dacarson commented 6 months ago

I have a fix for HomeBridge.

WRT the incorrect conversion, wind has been remarkably low where you station is (KTNKINGS343). It seems that although a new weather observation is reported every minute, and with your configuration you are updating every minute. For me the website only shows historical data for each our, usually around the 53 minute mark. I am not sure where you got your screenshot from. For me, I log into WUnderground, Click 'More' button and select 'Historical Weather'. Then I put in the date and paste in your StationID.

Screenshot 2024-05-17 at 5 30 15 PM

I have only been able to catch two (unhelpful) queries that correspond to entries in the table (take note of the obsTimeLocal):

[5/17/2024, 9:54:31 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-17T16:53:00Z","obsTimeLocal":"2024-05-17 12:53:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1715964780,"lat":36.444,"uv":null,"winddir":282,"humidity":86,"qcStatus":1,"metric":{"temp":19.7,"heatIndex":19.7,"dewpt":17.3,"windChill":19.7,"windSpeed":0,"windGust":0,"pressure":1013.88,"precipRate":0,"precipTotal":2.01,"elev":502.9}}
[5/17/2024, 9:54:31 AM] [WeatherPlus] Name: ObservationStation value:KTNKINGS343 : Kingsport convertedValue:KTNKINGS343 : Kingsport
[5/17/2024, 9:54:31 AM] [WeatherPlus] Name: ObservationTime value:09:53:00 convertedValue:09:53:00
[5/17/2024, 9:54:31 AM] [WeatherPlus] Name: WindDirection value:WNW convertedValue:WNW
[5/17/2024, 9:54:31 AM] [WeatherPlus] Name: Humidity value:86 convertedValue:86
[5/17/2024, 9:54:31 AM] [WeatherPlus] Name: SolarRadiation value:null convertedValue:null
[5/17/2024, 9:54:31 AM] [WeatherPlus] Name: UVIndex value:null convertedValue:null
[5/17/2024, 9:54:31 AM] [WeatherPlus] Name: Temperature value:19.7 convertedValue:19.7
[5/17/2024, 9:54:31 AM] [WeatherPlus] Name: DewPoint value:17.3 convertedValue:17.3
[5/17/2024, 9:54:31 AM] [WeatherPlus] Name: AirPressure value:1013.88 convertedValue:1013.88
[5/17/2024, 9:54:31 AM] [WeatherPlus] Name: WindSpeed value:0 convertedValue:0
[5/17/2024, 9:54:31 AM] [WeatherPlus] Name: WindSpeedMax value:0 convertedValue:0
[5/17/2024, 9:54:31 AM] [WeatherPlus] Name: RainDay value:2.01 convertedValue:0.08
[5/17/2024, 9:54:31 AM] [WeatherPlus] Name: RainBool value:false convertedValue:false

and

[5/17/2024, 1:54:34 PM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-17T20:53:00Z","obsTimeLocal":"2024-05-17 16:53:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1715979180,"lat":36.444,"uv":null,"winddir":307,"humidity":87,"qcStatus":1,"metric":{"temp":20,"heatIndex":20,"dewpt":17.8,"windChill":20,"windSpeed":0.4,"windGust":1.8,"pressure":1012.5,"precipRate":0,"precipTotal":2.01,"elev":502.9}}
[5/17/2024, 1:54:34 PM] [WeatherPlus] Name: ObservationStation value:KTNKINGS343 : Kingsport convertedValue:KTNKINGS343 : Kingsport
[5/17/2024, 1:54:34 PM] [WeatherPlus] Name: ObservationTime value:13:53:00 convertedValue:13:53:00
[5/17/2024, 1:54:34 PM] [WeatherPlus] Name: WindDirection value:NW convertedValue:NW
[5/17/2024, 1:54:34 PM] [WeatherPlus] Name: Humidity value:87 convertedValue:87
[5/17/2024, 1:54:34 PM] [WeatherPlus] Name: SolarRadiation value:null convertedValue:null
[5/17/2024, 1:54:34 PM] [WeatherPlus] Name: UVIndex value:null convertedValue:null
[5/17/2024, 1:54:34 PM] [WeatherPlus] Name: Temperature value:20 convertedValue:20
[5/17/2024, 1:54:34 PM] [WeatherPlus] Name: DewPoint value:17.8 convertedValue:17.8
[5/17/2024, 1:54:34 PM] [WeatherPlus] Name: AirPressure value:1012.5 convertedValue:1012.5
[5/17/2024, 1:54:34 PM] [WeatherPlus] Name: WindSpeed value:0.4 convertedValue:0.89
[5/17/2024, 1:54:34 PM] [WeatherPlus] Name: WindSpeedMax value:1.8 convertedValue:4.03
[5/17/2024, 1:54:34 PM] [WeatherPlus] Name: RainDay value:2.01 convertedValue:0.08
[5/17/2024, 1:54:34 PM] [WeatherPlus] Name: RainBool value:false convertedValue:false

In general, the conversion seems to be happening correctly though. For example:

[5/17/2024, 9:27:30 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-17T16:25:00Z","obsTimeLocal":"2024-05-17 12:25:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1715963100,"lat":36.444,"uv":null,"winddir":283,"humidity":88,"qcStatus":1,"metric":{"temp":19.5,"heatIndex":19.5,"dewpt":17.5,"windChill":19.5,"windSpeed":1.8,"windGust":1.8,"pressure":1014.39,"precipRate":1.19,"precipTotal":2.01,"elev":502.9}}
[5/17/2024, 9:27:30 AM] [WeatherPlus] Name: ObservationStation value:KTNKINGS343 : Kingsport convertedValue:KTNKINGS343 : Kingsport
[5/17/2024, 9:27:30 AM] [WeatherPlus] Name: ObservationTime value:09:25:00 convertedValue:09:25:00
[5/17/2024, 9:27:30 AM] [WeatherPlus] Name: WindDirection value:WNW convertedValue:WNW
[5/17/2024, 9:27:30 AM] [WeatherPlus] Name: Humidity value:88 convertedValue:88
[5/17/2024, 9:27:30 AM] [WeatherPlus] Name: SolarRadiation value:null convertedValue:null
[5/17/2024, 9:27:30 AM] [WeatherPlus] Name: UVIndex value:null convertedValue:null
[5/17/2024, 9:27:30 AM] [WeatherPlus] Name: Temperature value:19.5 convertedValue:19.5
[5/17/2024, 9:27:30 AM] [WeatherPlus] Name: DewPoint value:17.5 convertedValue:17.5
[5/17/2024, 9:27:30 AM] [WeatherPlus] Name: AirPressure value:1014.39 convertedValue:1014.39
[5/17/2024, 9:27:30 AM] [WeatherPlus] Name: WindSpeed value:1.8 convertedValue:4.03
[5/17/2024, 9:27:30 AM] [WeatherPlus] Name: WindSpeedMax value:1.8 convertedValue:4.03
[5/17/2024, 9:27:30 AM] [WeatherPlus] Name: RainDay value:2.01 convertedValue:0.08
[5/17/2024, 9:27:30 AM] [WeatherPlus] Name: RainBool value:true convertedValue:true

The value is meters/sec, and the convertedValue is mph.

I need to monitor it and verify that the numbers shown on Wunderground match the converted values.

threeonparfive commented 6 months ago

I went to this link, scrolled down to the graphs, and clicked the “table” option. https://www.wunderground.com/dashboard/pws/KTNKINGS343

threeonparfive commented 6 months ago

Is it possible something is wrong with the wind speed threshold comparing to the wind reading? Something is definitely not right in the new build but all still well with 3.3.3 (except the threshold not showing in the GUI).

dacarson commented 6 months ago

Is it possible something is wrong with the wind speed threshold comparing to the wind reading? Something is definitely not right in the new build but all still well with 3.3.3 (except the threshold not showing in the GUI).

Agreed that there might be something wrong with the threshold. I'll be examining that next. I haven't used it, I need a deeper understanding of how it is used.

dacarson commented 6 months ago

I went to this link, scrolled down to the graphs, and clicked the “table” option. https://www.wunderground.com/dashboard/pws/KTNKINGS343

Thanks. I do have a couple of hours of data and I want to compare to what WUnderground shows.

dacarson commented 6 months ago

Summary: Research continues. The data I am receiving via the API does not match the website.

When I gathered an hour's of data this morning, the numbers that I am getting from the WeatherUnderground API for windSpeed are not correlating to the numbers on the website.

API Website data for an hour ### Heading Data received from the API, then converted to mph. Below API information is the line from the website. I'm only listing API data for the time that matches the website. ### Log Data ``` 5/20/2024, 8:05:25 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:04:00Z","obsTimeLocal":"2024-05-20 11:04:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716217440,"lat":36.444,"uv":null,"winddir":296,"humidity":73,"qcStatus":1,"metric":{"temp":22.3,"heatIndex":22.5,"dewpt":17.2,"windChill":22.3,"windSpeed":6.1,"windGust":11.2,"pressure":1017.91,"precipRate":0,"precipTotal":0,"elev":502.9}} [5/20/2024, 8:05:25 AM] [WeatherPlus] Name: WindSpeed value:6.1 convertedValue:13.65 [5/20/2024, 8:05:25 AM] [WeatherPlus] thresholdWindSpeed: 5 triggered 11:04 AM 72.2 °F 62.7 °F 72 % WNW 2.0 mph 5.7 mph 30.06 in 0.00 in 0.00 in w/m² [5/20/2024, 8:09:25 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:09:00Z","obsTimeLocal":"2024-05-20 11:09:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716217740,"lat":36.444,"uv":null,"winddir":35,"humidity":70,"qcStatus":1,"metric":{"temp":22.5,"heatIndex":22.6,"dewpt":16.7,"windChill":22.5,"windSpeed":0,"windGust":7.2,"pressure":1017.91,"precipRate":0,"precipTotal":0,"elev":502.9}} [5/20/2024, 8:09:25 AM] [WeatherPlus] Name: WindSpeed value:0 convertedValue:0 [5/20/2024, 8:09:25 AM] [WeatherPlus] thresholdWindSpeed: 5 not triggered 11:09 AM 72.0 °F 62.1 °F 71 % WNW 2.3 mph 5.1 mph 30.06 in 0.00 in 0.00 in w/ [5/20/2024, 8:14:26 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:14:00Z","obsTimeLocal":"2024-05-20 11:14:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716218040,"lat":36.444,"uv":null,"winddir":312,"humidity":66,"qcStatus":1,"metric":{"temp":24,"heatIndex":24.2,"dewpt":17.2,"windChill":24,"windSpeed":2.9,"windGust":7.2,"pressure":1018.02,"precipRate":0,"precipTotal":0,"elev":502.9}} [5/20/2024, 8:14:26 AM] [WeatherPlus] Name: WindSpeed value:2.9 convertedValue:6.49 [5/20/2024, 8:14:26 AM] [WeatherPlus] thresholdWindSpeed: 5 triggered 11:14 AM 74.3 °F 62.2 °F 66 % NNW 0.7 mph 2.2 mph 30.06 in 0.00 in 0.00 in w/m² [5/20/2024, 8:19:26 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:19:00Z","obsTimeLocal":"2024-05-20 11:19:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716218340,"lat":36.444,"uv":null,"winddir":311,"humidity":67,"qcStatus":1,"metric":{"temp":23.4,"heatIndex":23.5,"dewpt":16.9,"windChill":23.4,"windSpeed":9,"windGust":13,"pressure":1017.91,"precipRate":0,"precipTotal":0,"elev":502.9}} [5/20/2024, 8:19:26 AM] [WeatherPlus] Name: WindSpeed value:9 convertedValue:20.13 [5/20/2024, 8:19:26 AM] [WeatherPlus] thresholdWindSpeed: 5 triggered 11:19 AM 74.7 °F 63.3 °F 68 % NW 4.3 mph 6.0 mph 30.06 in 0.00 in 0.00 in w/m² [5/20/2024, 8:23:26 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:23:00Z","obsTimeLocal":"2024-05-20 11:23:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716218580,"lat":36.444,"uv":null,"winddir":66,"humidity":68,"qcStatus":1,"metric":{"temp":23.4,"heatIndex":23.6,"dewpt":17.1,"windChill":23.4,"windSpeed":2.2,"windGust":11.2,"pressure":1017.91,"precipRate":0,"precipTotal":0,"elev":502.9}} [5/20/2024, 8:23:26 AM] [WeatherPlus] Name: WindSpeed value:2.2 convertedValue:4.92 [5/20/2024, 8:23:26 AM] [WeatherPlus] thresholdWindSpeed: 5 not triggered 11:23 AM 73.6 °F 63.1 °F 70 % NW 2.7 mph 6.6 mph 30.06 in 0.00 in 0.00 in w/m² [5/20/2024, 8:30:26 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:29:00Z","obsTimeLocal":"2024-05-20 11:29:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716218940,"lat":36.444,"uv":null,"winddir":246,"humidity":66,"qcStatus":1,"metric":{"temp":23.7,"heatIndex":23.8,"dewpt":17,"windChill":23.7,"windSpeed":2.5,"windGust":5.4,"pressure":1017.91,"precipRate":0,"precipTotal":0,"elev":502.9}} [5/20/2024, 8:30:26 AM] [WeatherPlus] Name: WindSpeed value:2.5 convertedValue:5.59 [5/20/2024, 8:30:26 AM] [WeatherPlus] thresholdWindSpeed: 5 triggered 11:29 AM 74.4 °F 63.4 °F 69 % West 2.1 mph 5.1 mph 30.06 in 0.00 in 0.00 in w/m² [5/20/2024, 8:35:26 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:34:00Z","obsTimeLocal":"2024-05-20 11:34:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716219240,"lat":36.444,"uv":null,"winddir":181,"humidity":72,"qcStatus":1,"metric":{"temp":23.3,"heatIndex":23.6,"dewpt":18,"windChill":23.3,"windSpeed":6.5,"windGust":11.2,"pressure":1017.71,"precipRate":0,"precipTotal":0,"elev":502.9}} [5/20/2024, 8:35:26 AM] [WeatherPlus] Name: WindSpeed value:6.5 convertedValue:14.54 [5/20/2024, 8:35:26 AM] [WeatherPlus] thresholdWindSpeed: 5 triggered 11:34 AM 74.5 °F 63.8 °F 69 % South 3.0 mph 4.9 mph 30.06 in 0.00 in 0.00 in w/m² [5/20/2024, 8:39:26 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:38:00Z","obsTimeLocal":"2024-05-20 11:38:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716219480,"lat":36.444,"uv":null,"winddir":263,"humidity":68,"qcStatus":1,"metric":{"temp":23.7,"heatIndex":23.9,"dewpt":17.4,"windChill":23.7,"windSpeed":4,"windGust":7.2,"pressure":1017.91,"precipRate":0,"precipTotal":0,"elev":502.9}} [5/20/2024, 8:39:26 AM] [WeatherPlus] Name: WindSpeed value:4 convertedValue:8.95 [5/20/2024, 8:39:26 AM] [WeatherPlus] thresholdWindSpeed: 5 triggered 11:38 AM 74.3 °F 62.6 °F 67 % SSE 1.4 mph 4.3 mph 30.06 in 0.00 in 0.00 in w/m² [5/20/2024, 8:45:26 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:44:00Z","obsTimeLocal":"2024-05-20 11:44:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716219840,"lat":36.444,"uv":null,"winddir":197,"humidity":65,"qcStatus":1,"metric":{"temp":23.9,"heatIndex":24,"dewpt":16.9,"windChill":23.9,"windSpeed":3.6,"windGust":9.4,"pressure":1017.91,"precipRate":0,"precipTotal":0,"elev":502.9}} [5/20/2024, 8:45:26 AM] [WeatherPlus] Name: WindSpeed value:3.6 convertedValue:8.05 [5/20/2024, 8:45:26 AM] [WeatherPlus] thresholdWindSpeed: 5 triggered 11:44 AM 74.6 °F 62.9 °F 67 % West 1.5 mph 6.1 mph 30.06 in 0.00 in 0.00 in w/m² [5/20/2024, 8:50:26 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:49:00Z","obsTimeLocal":"2024-05-20 11:49:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716220140,"lat":36.444,"uv":null,"winddir":306,"humidity":70,"qcStatus":1,"metric":{"temp":24.2,"heatIndex":24.5,"dewpt":18.4,"windChill":24.2,"windSpeed":9,"windGust":11.2,"pressure":1017.81,"precipRate":0,"precipTotal":0,"elev":502.9}} [5/20/2024, 8:50:26 AM] [WeatherPlus] Name: WindSpeed value:9 convertedValue:20.13 [5/20/2024, 8:50:26 AM] [WeatherPlus] thresholdWindSpeed: 5 triggered 11:49 AM 75.5 °F 64.1 °F 68 % NW 2.6 mph 4.3 mph 30.06 in 0.00 in 0.00 in w/m² [5/20/2024, 8:55:26 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:54:00Z","obsTimeLocal":"2024-05-20 11:54:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716220440,"lat":36.444,"uv":null,"winddir":35,"humidity":66,"qcStatus":1,"metric":{"temp":24.1,"heatIndex":24.3,"dewpt":17.3,"windChill":24.1,"windSpeed":1.8,"windGust":3.6,"pressure":1018.02,"precipRate":0,"precipTotal":0,"elev":502.9}} [5/20/2024, 8:55:26 AM] [WeatherPlus] Name: WindSpeed value:1.8 convertedValue:4.03 [5/20/2024, 8:55:26 AM] [WeatherPlus] thresholdWindSpeed: 5 not triggered 11:54 AM 75.1 °F 62.8 °F 66 % NNE 1.9 mph 3.0 mph 30.06 in 0.00 in 0.00 in w/m² [5/20/2024, 9:00:26 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:59:00Z","obsTimeLocal":"2024-05-20 11:59:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716220740,"lat":36.444,"uv":null,"winddir":159,"humidity":63,"qcStatus":1,"metric":{"temp":25,"heatIndex":25.2,"dewpt":17.5,"windChill":25,"windSpeed":1.8,"windGust":3.6,"pressure":1018.08,"precipRate":0,"precipTotal":0,"elev":502.9}} [5/20/2024, 9:00:26 AM] [WeatherPlus] Name: WindSpeed value:1.8 convertedValue:4.03 [5/20/2024, 9:00:26 AM] [WeatherPlus] thresholdWindSpeed: 5 not triggered 11:59 AM 76.2 °F 63.4 °F 65 % ENE 0.6 mph 2.0 mph 30.07 in 0.00 in 0.00 in w/m² [5/20/2024, 9:04:26 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T16:03:00Z","obsTimeLocal":"2024-05-20 12:03:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716220980,"lat":36.444,"uv":null,"winddir":312,"humidity":66,"qcStatus":1,"metric":{"temp":24.8,"heatIndex":25.1,"dewpt":18,"windChill":24.8,"windSpeed":4.7,"windGust":7.2,"pressure":1017.91,"precipRate":0,"precipTotal":0,"elev":502.9}} [5/20/2024, 9:04:26 AM] [WeatherPlus] Name: WindSpeed value:4.7 convertedValue:10.51 [5/20/2024, 9:04:26 AM] [WeatherPlus] thresholdWindSpeed: 5 triggered 12:03 PM 76.8 °F 63.9 °F 65 % NW 1.6 mph 4.2 mph 30.06 in 0.00 in 0.00 in w/m² ```

Maybe the timestamps are somehow off. So when I look at a full block of time between website time entries, none of the requests between the last listed value on the website and the current one match what I receive through the API. For example, the website reported values for 11:04 and 11:09. The plugin asks for the data every minute. I have windSpeed values for 11:05 (15.21mph), 11:06 (5.59mph), 11:07 (12.08mph) and 11:09 (0mph), but none are close to the 2.3mph value on the website:

[5/20/2024, 8:05:25 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:04:00Z","obsTimeLocal":"2024-05-20 11:04:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716217440,"lat":36.444,"uv":null,"winddir":296,"humidity":73,"qcStatus":1,"metric":{"temp":22.3,"heatIndex":22.5,"dewpt":17.2,"windChill":22.3,"windSpeed":6.1,"windGust":11.2,"pressure":1017.91,"precipRate":0,"precipTotal":0,"elev":502.9}}
[5/20/2024, 8:05:25 AM] [WeatherPlus] Name: WindSpeed value:6.1 convertedValue:13.65
[5/20/2024, 8:05:25 AM] [WeatherPlus] thresholdWindSpeed: 5 triggered
11:04 AM        72.2 °F        62.7 °F        72 %    WNW     2.0 mph 5.7 mph 30.06 in        0.00 in 0.00 in         w/m²

[5/20/2024, 8:06:25 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:05:00Z","obsTimeLocal":"2024-05-20 11:05:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716217500,"lat":36.444,"uv":null,"winddir":297,"humidity":71,"qcStatus":1,"metric":{"temp":22.1,"heatIndex":22.2,"dewpt":16.6,"windChill":22.1,"windSpeed":6.8,"windGust":9.4,"pressure":1018.02,"precipRate":0,"precipTotal":0,"elev":502.9}}
[5/20/2024, 8:06:25 AM] [WeatherPlus] Name: WindSpeed value:6.8 convertedValue:15.21
[5/20/2024, 8:06:25 AM] [WeatherPlus] thresholdWindSpeed: 5 triggered
[5/20/2024, 8:07:25 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:06:00Z","obsTimeLocal":"2024-05-20 11:06:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716217560,"lat":36.444,"uv":null,"winddir":248,"humidity":72,"qcStatus":1,"metric":{"temp":22.1,"heatIndex":22.2,"dewpt":16.8,"windChill":22.1,"windSpeed":2.5,"windGust":9.4,"pressure":1017.91,"precipRate":0,"precipTotal":0,"elev":502.9}}
[5/20/2024, 8:07:25 AM] [WeatherPlus] Name: WindSpeed value:2.5 convertedValue:5.59
[5/20/2024, 8:07:25 AM] [WeatherPlus] thresholdWindSpeed: 5 triggered
[5/20/2024, 8:08:25 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:07:00Z","obsTimeLocal":"2024-05-20 11:07:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716217620,"lat":36.444,"uv":null,"winddir":309,"humidity":71,"qcStatus":1,"metric":{"temp":22.2,"heatIndex":22.3,"dewpt":16.7,"windChill":22.2,"windSpeed":5.4,"windGust":7.2,"pressure":1017.91,"precipRate":0,"precipTotal":0,"elev":502.9}}
[5/20/2024, 8:08:25 AM] [WeatherPlus] Name: WindSpeed value:5.4 convertedValue:12.08
[5/20/2024, 8:08:25 AM] [WeatherPlus] thresholdWindSpeed: 5 triggered
[5/20/2024, 8:09:25 AM] [WeatherPlus] Observation: {"stationID":"KTNKINGS343","obsTimeUtc":"2024-05-20T15:09:00Z","obsTimeLocal":"2024-05-20 11:09:00","neighborhood":"Kingsport","softwareType":null,"country":"US","solarRadiation":null,"lon":-82.56,"realtimeFrequency":null,"epoch":1716217740,"lat":36.444,"uv":null,"winddir":35,"humidity":70,"qcStatus":1,"metric":{"temp":22.5,"heatIndex":22.6,"dewpt":16.7,"windChill":22.5,"windSpeed":0,"windGust":7.2,"pressure":1017.91,"precipRate":0,"precipTotal":0,"elev":502.9}}
[5/20/2024, 8:09:25 AM] [WeatherPlus] Name: WindSpeed value:0 convertedValue:0
[5/20/2024, 8:09:25 AM] [WeatherPlus] thresholdWindSpeed: 5 not triggered
11:09 AM        72.0 °F        62.1 °F        71 %    WNW     2.3 mph 5.1 mph 30.06 in        0.00 in 0.00 in         w/m²
threeonparfive commented 6 months ago

How about a code comparison, of the code block responsible for this, between 3.3.3 and 3.3.5? It seems there has to be a difference in the code between the versions.

threeonparfive commented 6 months ago

Another thought...perhaps the default wind speed in Weather Underground is already in MPH and the 3.3.5 code is "converting" MPH into MPH again....causing it to read higher than reality? For example, one of the readings above is showing 5.4 converted to 12.08. I'd say 5.4 was a real MPH reading for the day...12.08 is definitely not.

dacarson commented 6 months ago

How about a code comparison, of the code block responsible for this, between 3.3.3 and 3.3.5? It seems there has to be a difference in the code between the versions.

I know the code that I changed. What I changed was the request URL from hard coded units:

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

&units=" + this.units to always requesting metric units=m. The URL changed from: const queryUri = "https://api.weather.com/v2/pws/observations/current?apiKey=" + this.apiKey + "&stationId=" + this.location + "&format=json&units=" + this.units + '&numericPrecision=decimal'; to: const queryUri = "https://api.weather.com/v2/pws/observations/current?apiKey=" + this.apiKey + "&stationId=" + this.location + "&format=json&units=m" + '&numericPrecision=decimal';

I made this change for a couple of reasons. First, internally, the plugin uses metric. It seemed that the units were being converted from mph (believing it is m/s) to mph. Second, the value being sent was always s. However, the API says that it only supports: e = English units | m = Metric units | h = Hybrid units (UK), so I don't know what it replied with.

My next step is to actually go back 3.3.3 and log what it receives and what it presents. I also plan on contacting WeatherUnderground with the data that I have showing how it is different between their API and the Website.

dacarson commented 6 months ago

I believe I found the issue. There is another document that adds one more unit value: s. It says you can specify s for Metric SI units. Specifying m for metric gives you km/hr, whereas s gives you m/s.

threeonparfive commented 5 months ago

I believe I found the issue. There is another document that adds one more unit value: s. It says you can specify s for Metric SI units. Specifying m for metric gives you km/hr, whereas s gives you m/s.

@dacarson Any more progress on this?