Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/Enhancement: Visibility, Sunrise, Sunset data returned by OpenWeatherMap is not captured in by json frontend #150

Open
poetaman opened this issue Jan 24, 2021 · 2 comments

Comments

@poetaman
Copy link

poetaman commented Jan 24, 2021

As I dig more into data returned by OpenWeatherMap, it looks like multiple fields (visibility,sunset,sunrise) are not output correctly by json frontend of wego.

Here's an example of data returned by OpenWeatherMap:

{
  2   "cod": "200",
  3   "message": 0,
  4   "cnt": 40,
  5   "list": [
  6     {
  7       "dt": 1611468000,
  8       "main": {
  9         "temp": 9.02,
 10         "feels_like": 6.94,
 11         "temp_min": 9.02,
 12         "temp_max": 9.74,                                                                                                                
 13         "pressure": 1014,
 14         "sea_level": 1014,
 15         "grnd_level": 1012,
 16         "humidity": 80,
 17         "temp_kf": -0.72
 18       },
 19       "weather": [
 20         {
 21           "id": 800,
 22           "main": "Clear",
 23           "description": "clear sky",
 24           "icon": "01n"
 25         }
 26       ],
 27       "clouds": {
 28         "all": 1
 29       },
 30       "wind": {
 31         "speed": 1.59,
 32         "deg": 290
 33       },
 34       "visibility": 10000,  // <-- Visibility  Visibility  Visibility  Visibility  Visibility  Visibility 
 35       "pop": 0,
 36       "sys": {
 37         "pod": "n"
 38       },
 39       "dt_txt": "2021-01-24 06:00:00"
 40     },
 41     {
 42       ...
 43     },
 44     .
 45     .
 46     .
 47   ]
 48   "city": {
 49     "id": 5391959,
 50     "name": "San Francisco",
 51     "coord": {
 52       "lat": <hidden>,
 53       "lon": <hidden>
 54     },
 55     "country": "US",
 56     "population": 805235,
 57     "timezone": -28800,
 58     "sunrise": 1611415194, // <-- Sunrise  Sunrise  Sunrise  Sunrise  Sunrise  Sunrise 
 59     "sunset": 1611451383 // <-- Sunset  Sunset  Sunset  Sunset  Sunset  Sunset
 60   }
 61 }

And here is json returned by >> wego -f json

{
	"Current": {
		"Time": "2021-01-24T01:00:00-08:00",
		"Code": 14,
		"Desc": "clear sky",
		"TempC": 8.63,
		"FeelsLikeC": 9.33,
		"ChanceOfRainPercent": null,
		"PrecipM": 0,
		"VisibleDistM": null,
		"WindspeedKmph": 1.7279999,
		"WindGustKmph": null,
		"WinddirDegree": 171,
		"Humidity": 80
	},
	"Forecast": [
		{
			"Date": "2021-01-24T01:00:00-08:00",
			"Slots": [
				{
					"Time": "2021-01-24T01:00:00-08:00",
					"Code": 14,
					"Desc": "clear sky",
					"TempC": 8.63,
					"FeelsLikeC": 9.33,
					"ChanceOfRainPercent": null,
					"PrecipM": 0,
					"VisibleDistM": null, <-- Visibility  Visibility  Visibility  Visibility  Visibility  Visibility 
					"WindspeedKmph": 1.7279999,
					"WindGustKmph": null,
					"WinddirDegree": 171,
					"Humidity": 80
				},
				{
					...
				}
				.
				.
				.
			],
			"Astronomy": {
				"Moonrise": "0001-01-01T00:00:00Z",
				"Moonset": "0001-01-01T00:00:00Z",
				"Sunrise": "0001-01-01T00:00:00Z",  <-- Sunrise  Sunrise  Sunrise  Sunrise  Sunrise  Sunrise 
				"Sunset": "0001-01-01T00:00:00Z" <-- Sunset  Sunset  Sunset  Sunset  Sunset  Sunset 
			}

@poetaman poetaman changed the title Bug/Enhancement: Visibility data returned by OpenWeatherMap is not captured in by json frontend Bug/Enhancement: Visibility, Sunrise, Sunset data returned by OpenWeatherMap is not captured in by json frontend Jan 24, 2021
@peter81git
Copy link
Contributor

For what I can verify in the openweather API (forecast) docs, seems that sunrise/sunset is only available for the city. When you request json as the output the "astronomy" part is included in daily forecast.

@peter81git
Copy link
Contributor

I did more investigation on the topic and found that openweather has another api "One Call API" https://openweathermap.org/api/one-call-3#current, has the need information on daily basis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants