File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed
Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 550.05: Upgrade OWM to One Call API 3.0. Add pressure to weather.json
660.06: Fix One Call API 3.0 not returning city names, which are required by the weather app
770.07: Update weather after reconnecting bluetooth if update is due, refactor code
8- 0.08: Undo change to One Call API 3.0
8+ 0.08: Undo change to One Call API 3.0
9+ 0.09: Fix infinite loop when settings.updated is not defined
Original file line number Diff line number Diff line change 77 ) ;
88
99 let refreshMillis = function ( ) {
10- return settings . refresh * 1000 * 60 + 1 // +1 <- leave some slack
11- }
10+ return settings . refresh * 1000 * 60 + 1 ; // +1 <- leave some slack
11+ } ;
1212
1313 let onCompleted = function ( ) {
1414 loading = false ;
1515 settings . updated = Date . now ( ) ;
1616 require ( 'Storage' ) . writeJSON ( "owmweather.json" , settings ) ;
1717 if ( timeoutRef ) clearTimeout ( timeoutRef ) ;
1818 timeoutRef = setTimeout ( loadIfDueAndReschedule , refreshMillis ( ) ) ;
19- }
19+ } ;
2020
2121 let loadIfDueAndReschedule = function ( ) {
2222 // also check if the weather.json file has been updated (e.g. force refresh)
2727 }
2828
2929 let MillisUntilDue = settings . updated + refreshMillis ( ) - Date . now ( ) ;
30- if ( MillisUntilDue <= 0 ) {
30+ if ( ! MillisUntilDue || MillisUntilDue <= 0 ) {
3131 if ( ! loading ) {
3232 loading = true ;
3333 require ( "owmweather" ) . pull ( onCompleted ) ;
3434 }
3535 } else {
3636 // called to early, reschedule
37- // console.log('Weather data is not due yet, rescheduling in ' + MillisUntilDue|0 + 'ms');
37+ // console.log('Weather data is not due yet, rescheduling in ' + ( MillisUntilDue || 0) + 'ms');
3838 if ( timeoutRef ) clearTimeout ( timeoutRef ) ;
3939 timeoutRef = setTimeout ( loadIfDueAndReschedule , MillisUntilDue + 1 ) ;
4040 }
41- }
41+ } ;
4242
4343 if ( settings . enabled ) {
4444 setTimeout ( loadIfDueAndReschedule , 5000 ) ; // run 5 seconds after boot
Original file line number Diff line number Diff line change 11{ "id" : " owmweather" ,
22 "name" : " OpenWeatherMap weather provider" ,
33 "shortName" :" OWM Weather" ,
4- "version" : " 0.08 " ,
4+ "version" : " 0.09 " ,
55 "description" : " Pulls weather from OpenWeatherMap (OWM) API" ,
66 "icon" : " app.png" ,
77 "type" : " bootloader" ,
You can’t perform that action at this time.
0 commit comments