1
- /* global WeatherProvider, WeatherObject */
1
+ /* global WeatherProvider, WeatherObject, SunCalc */
2
2
3
3
/* Magic Mirror
4
4
* Module: Weather
@@ -82,7 +82,7 @@ WeatherProvider.register("ukmetoffice", {
82
82
let timeInMins = nowUtc . diff ( midnightUtc , "minutes" ) ;
83
83
84
84
// loop round each of the (5) periods, look for today (the first period may be yesterday)
85
- for ( i in currentWeatherData . SiteRep . DV . Location . Period ) {
85
+ for ( var i in currentWeatherData . SiteRep . DV . Location . Period ) {
86
86
let periodDate = moment . utc ( currentWeatherData . SiteRep . DV . Location . Period [ i ] . value . substr ( 0 , 10 ) , "YYYY-MM-DD" ) ;
87
87
88
88
// ignore if period is before today
@@ -92,7 +92,7 @@ WeatherProvider.register("ukmetoffice", {
92
92
if ( moment ( ) . diff ( periodDate , "minutes" ) > 0 ) {
93
93
// loop round the reports looking for the one we are in
94
94
// $ value specifies the time in minutes-of-the-day: 0, 180, 360,...1260
95
- for ( j in currentWeatherData . SiteRep . DV . Location . Period [ i ] . Rep ) {
95
+ for ( var j in currentWeatherData . SiteRep . DV . Location . Period [ i ] . Rep ) {
96
96
let p = currentWeatherData . SiteRep . DV . Location . Period [ i ] . Rep [ j ] . $ ;
97
97
if ( timeInMins >= p && timeInMins - 180 < p ) {
98
98
// finally got the one we want, so populate weather object
@@ -126,11 +126,11 @@ WeatherProvider.register("ukmetoffice", {
126
126
127
127
// loop round the (5) periods getting the data
128
128
// for each period array, Day is [0], Night is [1]
129
- for ( j in forecasts . SiteRep . DV . Location . Period ) {
129
+ for ( var j in forecasts . SiteRep . DV . Location . Period ) {
130
130
const weather = new WeatherObject ( this . config . units , this . config . tempUnits , this . config . windUnits ) ;
131
131
132
132
// data times are always UTC
133
- dateStr = forecasts . SiteRep . DV . Location . Period [ j ] . value ;
133
+ const dateStr = forecasts . SiteRep . DV . Location . Period [ j ] . value ;
134
134
let periodDate = moment . utc ( dateStr . substr ( 0 , 10 ) , "YYYY-MM-DD" ) ;
135
135
136
136
// ignore if period is before today
0 commit comments