Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed weatherforecast to use dt_txt field
- Loading branch information
1 parent
cfb39c6
commit 0e2e8d2
Showing
2 changed files
with
3 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0e2e8d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually broke the weatherforecast for me last night :(
0e2e8d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean that the patch broke the forecast or the original issue broke the forecast?
The date field that is parsed is coming from the weather provider - so the date from your local computer unfortunately does not help in debugging this further.
0e2e8d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. Reverting it gets me a forecast shown again :-/
0e2e8d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, then it might cause it. Can you get a dump of JSON data retrieved from the weather service? Unfortunately, I'm not currently near my mirror (and won't be for a week), so I cannot see the problem or debug this by myself.
0e2e8d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tired using
console.log()
, but for some reason nothing from theweatherforceast
module shows up in the log - not even the Startup message. I'll have to look into this later, but someone else might be faster.I linked to this commit on #1332
0e2e8d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a dump of the retrieved JSON :
{"city":{"id":2998324,"name":"Lille","coord":{"lon":3.0586,"lat":50.633},"country":"FR","population":0},"cod":"200","message":7.9564336,"cnt":7,"list":[{"dt":1530529200,"temp":{"day":26.41,"min":19.95,"max":27.93,"night":19.95,"eve":27.04,"morn":26.41},"pressure":1020.55,"humidity":31,"weather":[{"id":800,"main":"Clear","description":"ciel dégagé","icon":"01d"}],"speed":5.61,"deg":69,"clouds":0},{"dt":1530615600,"temp":{"day":28.38,"min":19.27,"max":29.52,"night":19.37,"eve":28.41,"morn":19.27},"pressure":1022.44,"humidity":32,"weather":[{"id":800,"main":"Clear","description":"ciel dégagé","icon":"02d"}],"speed":4.47,"deg":64,"clouds":8},{"dt":1530702000,"temp":{"day":29.2,"min":17.81,"max":30.37,"night":17.81,"eve":28.98,"morn":18.31},"pressure":1019.16,"humidity":35,"weather":[{"id":800,"main":"Clear","description":"ciel dégagé","icon":"02d"}],"speed":2.01,"deg":16,"clouds":8},{"dt":1530788400,"temp":{"day":26.83,"min":16,"max":27.69,"night":17.6,"eve":26.89,"morn":16},"pressure":1021.67,"humidity":43,"weather":[{"id":802,"main":"Clouds","description":"partiellement nuageux","icon":"03d"}],"speed":2.57,"deg":283,"clouds":36},{"dt":1530874800,"temp":{"day":22.19,"min":16.08,"max":22.19,"night":17.44,"eve":21.67,"morn":16.08},"pressure":1026.86,"humidity":0,"weather":[{"id":500,"main":"Rain","description":"légère pluie","icon":"10d"}],"speed":4.51,"deg":34,"clouds":48,"rain":0.85},{"dt":1530961200,"temp":{"day":23.12,"min":17.4,"max":24.1,"night":18.26,"eve":24.1,"morn":17.4},"pressure":1032.35,"humidity":0,"weather":[{"id":800,"main":"Clear","description":"ciel dégagé","icon":"01d"}],"speed":2.7,"deg":315,"clouds":0},{"dt":1531047600,"temp":{"day":25.85,"min":18.9,"max":25.87,"night":18.9,"eve":25.87,"morn":20.04},"pressure":1033.12,"humidity":0,"weather":[{"id":800,"main":"Clear","description":"ciel dégagé","icon":"01d"}],"speed":3.92,"deg":295,"clouds":0}]}
0e2e8d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. It does not have dt_txt field at all. No wonder that it does not work properly. As I'm away from my system and development environment, could you try the following code?
Replace lines 336 and 337 with this snippet.
0e2e8d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me, thanks.
I think it's related to the whole "old" vs "new" free API keys debate...
see:
https://openweathermap.org/forecast16#JSON => no dt_txt
but
https://openweathermap.org/forecast5#JSON => has a dt_txt since it's a 3h forecast...
0e2e8d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone sends a PR I’ll try to release an intermediate release to solve this issue.
0e2e8d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1341
I made the pull request to the production branch to make sure that no other commits are on the way. Hopefully this is ok.
And sorry for the hassle, should have though of fallback when made the change. Or tested more thoroughly with various weather forecast configs.
0e2e8d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added replaced the snipped of code and date is still stuck.
0e2e8d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@solelo Please try the develop branch.
@jannekalliola No worries. I merged it into develop. Will merge it into master as soon as it's tested.