When making a api call for weather data I experienced that I had to make many flows to get the weatherdata for the upcoming 24 hours. 24 flows for a call every hour and 24 flows for processing the json data. And this is only for 1 forecast e.g rain.
Therefore I made a little script to get the weatherdata from openweather and meteoserver. Special thx to @robertklep for his great help. Just make 1 flow running this script with Homeyscript. Run it e.g every hour. Do not exceed your maximum of api calls. When running it every hour you will not exceed your maximum of api calls from Openweather and Meteoserver. Get your api key from www.openweathermap.org or www.meteoserver.nl
The script includes temperature, feels like temperature, humidity, pressure, clouds, visibility, windspeed, rain, wind in Beaufort wind direction, cape. All for the next 24 hours. Uv for today and the next 7 days.
I added also 1 extra variable filled with rainfall for the next 3 hours.
Make your variables in Better Logic. If you want 24 hours forecast make 24 variables. If you only want 1 hour forecast make 1 variable.
As I am a non-programmer. This script is far from professional. So improving this script would be nice.
Enjoy this script @ your own risk and don’t shoot the messager if your forecast didn’t give you great pleasure.
//Api call for weatherforcast by Marcel
//Weatherforcast from openweather and meteoserver
//You can make a flow in Homey and call for an update every hour, because MeteoServer limits your total of api calls
//There will be automatically no update between 23:00 and 06:00.
//Make your variables in Better Logic
//e.g TemperatureOpenWeather = temperature open weather. Make a variable in better logic called
//temp01Hour for the temperature @ 01:00, temp02Hour for the temperature @ 02:00... temp24Hour for the temperature @ 0:00
//FeelsLikeOpenWeather = feels_like01Hour, HumidityOpenWeather = humidity01Hour...
//pressure01Hour, clouds01Hour, visibility01Hour, wind_speed01Hour, rain01Hour(PrecipationOpenWeather),
//windb01Hour(WindInBeaufortMeteoServer), windltr01Hour(WindInLettersMeteoServer), UvToday(UvTodayOpenWeather),
//UvTomorrow and UvDay02, UvDay03...UvDay07(UvTomorrowOpenWeather). There is 1 extra variable called RainUpcoming3Hours.
//This variable is filled with the total rainfall for the next 3 hours.
//All variables are capital sensitive
const Latitude = 51.0469354;// Fill in latitude in decimal degrees e.g 51.0469354 not between ''
const Longitude = 4.6675576;// Fill in longitude in decimal degrees e.g 4.6675576
const ApiOpenWeatherServer = '1a260ce9403561t87232bddvf683a397047c'//Fill in your api for Openweather
const ApiMeteoServer = 'b40a18e322'// Fill in your api for MeteoServer
var TemperatureOpenWeather = false//Fill in true or false if you (don't) want the temperature from openweather for the next 24 hours in variables
var FeelsLikeOpenWeather = false//Fill in true or false if you (don't) want the feels like temperature from openweather for the next 24 hours in variables
var HumidityOpenWeather = false//Fill in true or false if you (don't) want the humidity from openweather for the next 24 hours in variables
var PressureOpenWeather = false//Fill in true or false if you (don't) want the pressure from openweather for the next 24 hours in variables
var CloudsOpenWeather = false//Fill in true or false if you (don't) want the clouds percentage from openweather for the next 24 hours in variables
var VisibilityOpenWeather = false//Fill in true or false if you (don't) want the visibility from openweather for the next 24 hours in variables
var WindSpeedOpenWeather = false//Fill in true or false if you (don't) want the windspeed in kmh from openweather for the next 24 hours in variables
var PrecipationOpenWeather = true////Fill in true or false if you (don't) want the precipation from openweather for the next 24 hours in variables
var WindInBeaufortMeteoServer = false//Fill in true or false if you (don't) want the wind in beauforts from meteoserver for the next 24 hours in variables
var WindInLettersMeteoServer = false//Fill in true or false if you (don't) want the wind direction e.g ZW or NO in beauforts from meteoserver for the next 24 hours in variables
var CapeMeteoServer = false//Fill in true or false if you (don't) want the change of cape from meteoserver for the next 24 hours in variables
var UvTodayOpenWeather = true//Fill in true or false if you (don't) want the UV for today from openweather for the next 24 hours in variables
var UvTomorrowOpenWeather = true//Fill in true or false if you (don't) want the UV forecast from meteoserver for the next 7 days in variables
//Until here you fill in the variables you want
var MeteoServer = 'https://data.meteoserver.nl/api/uurverwachting.php?lat='+Latitude +'&long=' +Longitude +'&key=' + ApiMeteoServer
var OpenWeatherServer = 'https://api.openweathermap.org/data/2.5/onecall?lat=' +Latitude +'&lon=' + Longitude +'&units=metric&lang=nl&exclude=daily,minutely,current&appid='+ ApiOpenWeatherServer
var UvTodayServer = 'http://api.openweathermap.org/data/2.5/uvi?lat=' +Latitude +'&lon=' +Longitude +'&appid=' +ApiOpenWeatherServer
var UvTomorrowServer = 'https://api.openweathermap.org/data/2.5/uvi/forecast?lat=' +Latitude +'&lon=' +Longitude +'&appid=' +ApiOpenWeatherServer
var WeatherServer = OpenWeatherServer
var HourlyOrData = 'hourly'
var StandardProcessing = true
var PrecipationBLApp = false
var MeteoserverApiCallFetched = false
//These variables must not be changed
let BLApp = await Homey.apps.getApp({id:"net.i-dev.betterlogic" });//Activating better logic
function wait(ms){//Declaring function wait
var start = new Date().getTime();
var end = start;
while(end < start + ms) {
end = new Date().getTime();}}
var Today = new Date();//Actual Date
console.log(Today);
var Year = Today.getFullYear();// Actual Year in numbers
var Month = Today.getMonth()+1;//Actual Month in numbers
var Day = Today.getDate();//Actual day in a Month in numbers
console.log('What day is it today: '+Day);//Just logging for control purposes
var Hours = Today.getHours();//Actual hours in numbers
console.log('What hour is it now: '+Hours);
var GetDaysInMonth = function(month,year){//Calculates amount of days in this month
return new Date(year, month, 0).getDate();};
if(24 - Hours == 24){var OneHour = 0}else{var OneHour = 24 - Hours}//json hours updating
if(OneHour + 1 == 24){var TwoHour = 0}else{var TwoHour = OneHour +1}
if(TwoHour + 1 == 24){var ThreeHour = 0}else{var ThreeHour = TwoHour +1}
if(ThreeHour + 1 == 24){var FourHour = 0}else{var FourHour = ThreeHour +1}
if(FourHour + 1 == 24){var FiveHour = 0}else{var FiveHour = FourHour +1}
if(FiveHour + 1 == 24){var SixHour = 0}else{var SixHour = FiveHour +1}
if(SixHour + 1 == 24){var SevenHour = 0}else{var SevenHour = SixHour +1}
if(SevenHour + 1 == 24){var EightHour = 0}else{var EightHour = SevenHour +1}
if(EightHour + 1 == 24){var NineHour = 0}else{var NineHour = EightHour +1}
if(NineHour + 1 == 24){var TenHour = 0}else{var TenHour = NineHour +1}
if(TenHour + 1 == 24){var ElevenHour = 0}else{var ElevenHour = TenHour +1}
if(ElevenHour + 1 == 24){var TwelfHour = 0}else{var TwelfHour = ElevenHour +1}
if(TwelfHour + 1 == 24){var ThirteenHour = 0}else{var ThirteenHour = TwelfHour +1}
if(ThirteenHour + 1 == 24){var FourteenHour = 0}else{var FourteenHour = ThirteenHour +1}
if(FourteenHour + 1 == 24){var FifteenHour = 0}else{var FifteenHour = FourteenHour +1}
if(FifteenHour + 1 == 24){var SixteenHour = 0}else{var SixteenHour = FifteenHour +1}
if(SixteenHour + 1 == 24){var SeventeenHour = 0}else{var SeventeenHour = SixteenHour +1}
if(SeventeenHour + 1 == 24){var EighteenHour = 0}else{var EighteenHour = SeventeenHour +1}
if(EighteenHour + 1 == 24){var NineteenHour = 0}else{var NineteenHour = EighteenHour +1}
if(NineteenHour + 1 == 24){var TwentyHour = 0}else{var TwentyHour = NineteenHour +1}
if(TwentyHour + 1 == 24){var TwentyoneHour = 0}else{var TwentyoneHour = TwentyHour +1}
if(TwentyoneHour + 1 == 24){var TwentytwoHour = 0}else{var TwentytwoHour = TwentyoneHour +1}
if(TwentytwoHour + 1 == 24){var TwentythreeHour = 0}else{var TwentythreeHour = TwentytwoHour +1}
if(TwentythreeHour + 1 == 24){var TwentyfourHour = 0}else{var TwentyfourHour = TwentythreeHour +1}
console.log(OneHour + ' ' + TwoHour + ' ' + ThreeHour + ' ' + FourHour + ' ' + FiveHour + ' ' + SixHour + ' ' + SevenHour + ' ' + EightHour + ' ' + NineHour + ' ' + TenHour + ' ' + ElevenHour + ' ' + TwelfHour + ' ' + ThirteenHour + ' ' + FourteenHour + ' ' + FifteenHour + ' ' + SixteenHour + ' ' + SeventeenHour + ' ' + EighteenHour + ' ' + NineteenHour + ' ' + TwentyHour + ' ' + TwentyoneHour + ' ' + TwentytwoHour + ' ' + TwentythreeHour + ' ' + TwentyfourHour)
WeatherServer = OpenWeatherServer//setting openweather for api call
response = await fetch(WeatherServer);//api call openweather
Server = await response.json();//Read response body and parse as JSON
for (let i = 0; i <= 12; i++){//determing wich api call has to be made
switch(i){
case 0:{
if(TemperatureOpenWeather === true)
{TemperatureOpenWeather = false
Variable = 'temp'
console.log('temp')
console.log('i is: ' +i)
break;}
else continue;}
case 1:{
if (FeelsLikeOpenWeather === true)
{FeelsLikeOpenWeather = false
Variable = 'feels_like'
console.log('feels_like')
console.log('i is: ' +i)
break;}
else continue;}
case 2:{
if (HumidityOpenWeather === true)
{HumidityOpenWeather = false
Variable = 'humidity'
console.log('humidity')
console.log('i is: ' +i)
break;}
else continue;}
case 3:{
if (PressureOpenWeather === true)
{PressureOpenWeather = false
Variable = 'pressure'
console.log('pressure')
console.log('i is: ' +i)
break;}
else continue;}
case 4:{
if (CloudsOpenWeather === true)
{CloudsOpenWeather = false
Variable = 'clouds'
console.log('clouds')
console.log('i is: ' +i)
break;}
else continue;}
case 5:{
if (VisibilityOpenWeather === true)
{VisibilityOpenWeather = false
Variable = 'visibility'
console.log('visibility')
console.log('i is: ' +i)
break;}
else continue;}
case 6:{
if (WindSpeedOpenWeather === true)
{WindSpeedOpenWeather = false
Variable = 'wind_speed'
console.log('wind_speed')
console.log('i is: ' +i)
break;}
else continue;}
case 7:{
if (PrecipationOpenWeather === true)
{PrecipationOpenWeather = false
PrecipationBLApp = true
Variable = 'rain'
console.log('rain')
console.log('i is: ' +i)
break;}
else continue;}
case 8:{
if (WindInBeaufortMeteoServer === true && Hours !== 23 && Hours !== 0 && Hours !== 1 && Hours !== 2 && Hours !== 3 && Hours !== 4 && Hours !== 5 && Hours !== 6)
{WeatherServer = MeteoServer//setting meteoserver for api call
response = await fetch(WeatherServer);//api call meteoserver
Server = await response.json();//Read response body and parse as JSON
WindInBeaufortMeteoServer = false
MeteoserverApiCallFetched = true
HourlyOrData = 'data'
Variable = 'windb'
console.log('windb')
console.log('i is: ' +i)
break;}
else continue;}
case 9:{
if (WindInLettersMeteoServer === true && Hours !== 23 && Hours !== 0 && Hours !== 1 && Hours !== 2 && Hours !== 3 && Hours !== 4 && Hours !== 5 && Hours !== 6)
{if(MeteoserverApiCallFetched = false)
{WeatherServer = MeteoServer//setting meteoserver for api call
response = await fetch(WeatherServer);//api call meteo server
Server = await response.json();}//Read response body and parse as JSON
MeteoserverApiCallFetched = true
WindInLettersMeteoServer = false
HourlyOrData = 'data'
Variable = 'windrltr'
console.log('windrltr')
console.log('i is: ' +i)
break;}
else continue;}
case 10:{
if (CapeMeteoServer === true && Hours !== 23 && Hours !== 0 && Hours !== 1 && Hours !== 2 && Hours !== 3 && Hours !== 4 && Hours !== 5 && Hours !== 6)
{if(MeteoserverApiCallFetched = false){
WeatherServer = MeteoServer//setting meteoserver for api call
response = await fetch(WeatherServer);//api call meteoserver
Server = await response.json();}//Read response body and parse as JSON
CapeMeteoServer = false
MeteoserverApiCallFetched = true
HourlyOrData = 'data'
Variable = 'cape'
console.log('cape')
console.log('i is: ' +i)
break;
}
else continue;}
case 11:{
if (UvTodayOpenWeather === true)
{
UvTodayOpenWeather = false
WeatherServer = UvTodayServer//setting openweather for api call
response = await fetch(WeatherServer);//api call openweather
Server = await response.json();//Read response body and parse as JSON
StandardProcessing = false
var UvToday = Server.value;//Processing UVToday
BLApp.apiPut('UvToday/'+UvToday);//Updating better logic variable UVToday
console.log('UvToday is: '+UvToday);
console.log('i is: ' +i)
break;
}
else continue;}
case 12:{
if (UvTomorrowOpenWeather === true)
{
UvTomorrowOpenWeather = false
Variable = 'value'
WeatherServer = UvTomorrowServer//setting openweather for api call
response = await fetch(WeatherServer);//api call openweather
Server = await response.json();//Read response body and parse as JSON
StandardProcessing = false;
var UvTomorrow = Server[0][Variable];//Processing UvTomorrow
var UvDay02 = Server[1][Variable];//Processing UvDay02
var UvDay03 = Server[2][Variable];//Processing UvDay03
var UvDay04 = Server[3][Variable];//Processing UvDay04
var UvDay05 = Server[4][Variable];//Processing UvDay05
var UvDay06 = Server[5][Variable];//Processing UvDay06
var UvDay07 = Server[6][Variable];//Processing UvDay07
console.log('UvTomorrow is: '+UvTomorrow);
console.log('UvDay02 is: '+UvDay02);
console.log('UvDay03 is: '+UvDay03);
console.log('UvDay04 is: '+UvDay04);
console.log('UvDay05 is: '+UvDay05);
console.log('UvDay06 is: '+UvDay06);
console.log('UvDay07 is: '+UvDay07);
console.log('i is: ' +i);
BLApp.apiPut('UvTomorrow/'+UvTomorrow);//Updating better logic variable UvTomorrow
BLApp.apiPut('UvDay02/'+UvDay02);//Updating better logic variable UvDay02
BLApp.apiPut('UvDay03/'+UvDay03);//Updating better logic variable UvDay03
BLApp.apiPut('UvDay04/'+UvDay04);//Updating better logic variable UvDay04
BLApp.apiPut('UvDay05/'+UvDay05);//Updating better logic variable UvDay05
BLApp.apiPut('UvDay06/'+UvDay06);//Updating better logic variable UvDay06
BLApp.apiPut('UvDay07/'+UvDay07);//Updating better logic variable UvDay07
break;
}
else continue;}
}
if(StandardProcessing === true){//processing api call, but not for precipation
if(PrecipationBLApp === false){
var Weather01Hour = Server[HourlyOrData][OneHour][Variable] ? Server[HourlyOrData][OneHour][Variable] : 0;//Processing Weather 01:00 Hour
var Weather02Hour = Server[HourlyOrData][TwoHour][Variable] ? Server[HourlyOrData][TwoHour][Variable] : 0;//Processing Weather 02:00 Hour
var Weather03Hour = Server[HourlyOrData][ThreeHour][Variable] ? Server[HourlyOrData][ThreeHour][Variable] :0;//Processing Weather 03:00 Hour
var Weather04Hour = Server[HourlyOrData][FourHour][Variable] ? Server[HourlyOrData][FourHour][Variable] : 0;//Processing Weather 04:00 Hour
var Weather05Hour = Server[HourlyOrData][FiveHour][Variable] ? Server[HourlyOrData][FiveHour][Variable] : 0;//Processing Weather 05:00 Hour
var Weather06Hour = Server[HourlyOrData][SixHour][Variable] ? Server[HourlyOrData][SixHour][Variable] : 0;//Processing Weather 06:00 Hour
var Weather07Hour = Server[HourlyOrData][SevenHour][Variable] ? Server[HourlyOrData][SevenHour][Variable] : 0;//Processing Weather 07:00 Hour
var Weather08Hour = Server[HourlyOrData][EightHour][Variable] ? Server[HourlyOrData][EightHour][Variable] : 0;//Processing Weather 08:00 Hour
var Weather09Hour = Server[HourlyOrData][NineHour][Variable] ? Server[HourlyOrData][NineHour][Variable] : 0;//Processing Weather 09:00 Hour
var Weather10Hour = Server[HourlyOrData][TenHour][Variable] ? Server[HourlyOrData][TenHour][Variable] : 0;//Processing Weather 10:00 Hour
var Weather11Hour = Server[HourlyOrData][ElevenHour][Variable] ? Server[HourlyOrData][ElevenHour][Variable] : 0;//Processing Weather 11:00 Hour
var Weather12Hour = Server[HourlyOrData][TwelfHour][Variable] ? Server[HourlyOrData][TwelfHour][Variable] : 0;//Processing Weather 12:00 Hour
var Weather13Hour = Server[HourlyOrData][ThirteenHour][Variable] ? Server[HourlyOrData][ThirteenHour][Variable] : 0;//Processing Weather 13:00 Hour
var Weather14Hour = Server[HourlyOrData][FourteenHour][Variable] ? Server[HourlyOrData][FourteenHour][Variable] : 0;//Processing Weather 14:00 Hour
var Weather15Hour = Server[HourlyOrData][FifteenHour][Variable] ? Server[HourlyOrData][FifteenHour][Variable] : 0;//Processing Weather 15:00 Hour
var Weather16Hour = Server[HourlyOrData][SixteenHour][Variable] ? Server[HourlyOrData][SixteenHour][Variable] : 0;//Processing Weather 16:00 Hour
var Weather17Hour = Server[HourlyOrData][SeventeenHour][Variable] ? Server[HourlyOrData][SeventeenHour][Variable] : 0;//Processing Weather 17:00 Hour
var Weather18Hour = Server[HourlyOrData][EighteenHour][Variable] ? Server[HourlyOrData][EighteenHour][Variable] : 0;//Processing Weather 18:00 Hour
var Weather19Hour = Server[HourlyOrData][NineteenHour][Variable] ? Server[HourlyOrData][NineteenHour][Variable] : 0;//Processing Weather 19:00 Hour
var Weather20Hour = Server[HourlyOrData][TwentyHour][Variable] ? Server[HourlyOrData][TwentyHour][Variable] : 0;//Processing Weather 20:00 Hour
var Weather21Hour = Server[HourlyOrData][TwentyoneHour][Variable] ? Server[HourlyOrData][TwentyoneHour][Variable] : 0;//Processing Weather 21:00 Hour
var Weather22Hour = Server[HourlyOrData][TwentytwoHour][Variable] ? Server[HourlyOrData][TwentytwoHour][Variable] : 0;//Processing Weather 22:00 Hour
var Weather23Hour = Server[HourlyOrData][TwentythreeHour][Variable] ? Server[HourlyOrData][TwentythreeHour][Variable] : 0;//Processing Weather 23:00 Hour
var Weather24Hour = Server[HourlyOrData][TwentyfourHour][Variable] ? Server[HourlyOrData][TwentyfourHour][Variable] : 0;//Processing Weather 24:00 Hour
wait(2000);}
if (PrecipationBLApp === true){//processing api call for precipation
var Weather01Hour = Server[HourlyOrData][OneHour][Variable] ? Server[HourlyOrData][OneHour].rain['1h'] : 0;//Processing rain 01:00 Hour
var Weather02Hour = Server[HourlyOrData][TwoHour][Variable] ? Server[HourlyOrData][TwoHour].rain['1h'] : 0;//Processing rain 02:00 Hour
var Weather03Hour = Server[HourlyOrData][ThreeHour][Variable] ? Server[HourlyOrData][ThreeHour].rain['1h'] : 0;//Processing rain 03:00 Hour
var Weather04Hour = Server[HourlyOrData][FourHour][Variable] ? Server[HourlyOrData][FourHour].rain['1h'] : 0;//Processing rain 04:00 Hour
var Weather05Hour = Server[HourlyOrData][FiveHour][Variable] ? Server[HourlyOrData][FiveHour].rain['1h'] : 0;//Processing rain 05:00 Hour
var Weather06Hour = Server[HourlyOrData][SixHour][Variable] ? Server[HourlyOrData][SixHour].rain['1h'] : 0;//Processing rain 06:00 Hour
var Weather07Hour = Server[HourlyOrData][SevenHour][Variable] ? Server[HourlyOrData][SevenHour].rain['1h'] : 0;//Processing rain 07:00 Hour
var Weather08Hour = Server[HourlyOrData][EightHour][Variable] ? Server[HourlyOrData][EightHour].rain['1h'] : 0;//Processing rain 08:00 Hour
var Weather09Hour = Server[HourlyOrData][NineHour][Variable] ? Server[HourlyOrData][NineHour].rain['1h'] : 0;//Processing rain 09:00 Hour
var Weather10Hour = Server[HourlyOrData][TenHour][Variable] ? Server[HourlyOrData][TenHour].rain['1h'] : 0;//Processing rain 10:00 Hour
var Weather11Hour = Server[HourlyOrData][ElevenHour][Variable] ? Server[HourlyOrData][ElevenHour].rain['1h'] : 0;//Processing rain 11:00 Hour
var Weather12Hour = Server[HourlyOrData][TwelfHour][Variable] ? Server[HourlyOrData][TwelfHour].rain['1h'] : 0;//Processing rain 12:00 Hour
var Weather13Hour = Server[HourlyOrData][ThirteenHour][Variable] ? Server[HourlyOrData][ThirteenHour].rain['1h'] : 0;//Processing rain 13:00 Hour
var Weather14Hour = Server[HourlyOrData][FourteenHour][Variable] ? Server[HourlyOrData][FourteenHour].rain['1h'] : 0;//Processing rain 14:00 Hour
var Weather15Hour = Server[HourlyOrData][FifteenHour][Variable] ? Server[HourlyOrData][FifteenHour].rain['1h'] : 0;//Processing rain 15:00 Hour
var Weather16Hour = Server[HourlyOrData][SixteenHour][Variable] ? Server[HourlyOrData][SixteenHour].rain['1h'] : 0;//Processing rain 16:00 Hour
var Weather17Hour = Server[HourlyOrData][SeventeenHour][Variable] ? Server[HourlyOrData][SeventeenHour].rain['1h'] : 0;//Processing rain 17:00 Hour
var Weather18Hour = Server[HourlyOrData][EighteenHour][Variable] ? Server[HourlyOrData][EighteenHour].rain['1h'] : 0;//Processing rain 18:00 Hour
var Weather19Hour = Server[HourlyOrData][NineteenHour][Variable] ? Server[HourlyOrData][NineteenHour].rain['1h'] : 0;//Processing rain 19:00 Hour
var Weather20Hour = Server[HourlyOrData][TwentyHour][Variable] ? Server[HourlyOrData][TwentyHour].rain['1h'] : 0;//Processing rain 20:00 Hour
var Weather21Hour = Server[HourlyOrData][TwentyoneHour][Variable] ? Server[HourlyOrData][TwentyoneHour].rain['1h'] : 0;//Processing rain 21:00 Hour
var Weather22Hour = Server[HourlyOrData][TwentytwoHour][Variable] ? Server[HourlyOrData][TwentytwoHour].rain['1h'] : 0;//Processing rain 22:00 Hour
var Weather23Hour = Server[HourlyOrData][TwentythreeHour][Variable] ? Server[HourlyOrData][TwentythreeHour].rain['1h'] : 0;//Processing rain 23:00 Hour
var Weather24Hour = Server[HourlyOrData][TwentyfourHour][Variable] ? Server[HourlyOrData][TwentyfourHour].rain['1h'] : 0;//Processing rain 24:00 Hour
switch(Hours){//determing precipation for the upcoming 3 hours
case 0: {
var RainUpcoming3Hours = Weather01Hour + Weather02Hour + Weather03Hour;
break;}
case 1:{
var RainUpcoming3Hours = Weather02Hour + Weather03Hour + Weather04Hour
break;}
case 2:{
var RainUpcoming3Hours = Weather03Hour + Weather04Hour + Weather05Hour
break;}
case 3:{
var RainUpcoming3Hours = Weather04Hour + Weather05Hour + Weather06Hour
break;}
case 4:{
var RainUpcoming3Hours = Weather05Hour + Weather06Hour + Weather07Hour
break;}
case 5:{
var RainUpcoming3Hours = Weather06Hour + Weather07Hour + Weather08Hour
break;}
case 6:{
var RainUpcoming3Hours = Weather07Hour + Weather08Hour + Weather09Hour
break;}
case 7:{
var RainUpcoming3Hours = Weather08Hour + Weather09Hour + Weather10Hour
break;}
case 8:{
var RainUpcoming3Hours = Weather09Hour + Weather10Hour + Weather11Hour
break;}
case 9:{
var RainUpcoming3Hours = Weather10Hour + Weather11Hour + Weather12Hour
break;}
case 10:{
var RainUpcoming3Hours = Weather11Hour + Weather12Hour + Weather13Hour
break;}
case 11:{
var RainUpcoming3Hours = Weather12Hour + Weather13Hour + Weather14Hour
break;}
case 12:{
var RainUpcoming3Hours = Weather13Hour + Weather14Hour + Weather15Hour
break;}
case 13:{
var RainUpcoming3Hours = Weather14Hour + Weather15Hour + Weather16Hour
break;}
case 14:{
var RainUpcoming3Hours = Weather15Hour + Weather16Hour + Weather17Hour
break;}
case 15:{
var RainUpcoming3Hours = Weather16Hour + Weather17Hour + Weather18Hour
break;}
case 16:{
var RainUpcoming3Hours = Weather17Hour + Weather18Hour + Weather19Hour
break;}
case 17:{
var RainUpcoming3Hours = Weather18Hour + Weather19Hour + Weather20Hour
break;}
case 18:{
var RainUpcoming3Hours = Weather19Hour + Weather20Hour + Weather21Hour
break;}
case 19:{
var RainUpcoming3Hours = Weather20Hour + Weather21Hour + Weather22Hour
break;}
case 20:{
var RainUpcoming3Hours = Weather21Hour + Weather22Hour + Weather23Hour
break;}
case 21:{
var RainUpcoming3Hours = Weather22Hour + Weather23Hour + Weather24Hour
break;}
case 22:{
var RainUpcoming3Hours = Weather23Hour + Weather24Hour + Weather01Hour
break;}
case 23:{
var RainUpcoming3Hours = Weather24Hour + Weather01Hour + Weather02Hour
break;}
}
BLApp.apiPut('RainUpcoming3Hours/'+RainUpcoming3Hours);//Updating better logic variable RainUpcoming3Hours
console.log('RainUpcoming3Hours is : '+RainUpcoming3Hours);
PrecipationBLApp = false;}
console.log('Weather01Hour is : '+Weather01Hour);//logging only for control purposes
console.log('Weather02Hour is : '+Weather02Hour);
console.log('Weather03Hour is : '+Weather03Hour);
console.log('Weather04Hour is : '+Weather04Hour);
console.log('Weather05Hour is : '+Weather05Hour);
console.log('Weather06Hour is : '+Weather06Hour);
console.log('Weather07Hour is : '+Weather07Hour);
console.log('Weather08Hour is : '+Weather08Hour);
console.log('Weather09Hour is : '+Weather09Hour);
console.log('Weather10Hour is : '+Weather10Hour);
console.log('Weather11Hour is : '+Weather11Hour);
console.log('Weather12Hour is : '+Weather12Hour);
console.log('Weather13Hour is : '+Weather13Hour);
console.log('Weather14Hour is : '+Weather14Hour);
console.log('Weather15Hour is : '+Weather15Hour);
console.log('Weather16Hour is : '+Weather16Hour);
console.log('Weather17Hour is : '+Weather17Hour);
console.log('Weather18Hour is : '+Weather18Hour);
console.log('Weather19Hour is : '+Weather19Hour);
console.log('Weather20Hour is : '+Weather20Hour);
console.log('Weather21Hour is : '+Weather21Hour);
console.log('Weather22Hour is : '+Weather22Hour);
console.log('Weather23Hour is : '+Weather23Hour);
console.log('Weather24Hour is : '+Weather24Hour);
BLApp.apiPut(Variable +'01Hour/'+Weather01Hour);//Updating better logic variable Weather01Hour
BLApp.apiPut(Variable +'02Hour/'+Weather02Hour);//Updating better logic variable Weather02Hour
BLApp.apiPut(Variable +'03Hour/'+Weather03Hour);//Updating better logic variable Weather03Hour
BLApp.apiPut(Variable +'04Hour/'+Weather04Hour);//Updating better logic variable Weather04Hour
BLApp.apiPut(Variable +'05Hour/'+Weather05Hour);//Updating better logic variable Weather05Hour
BLApp.apiPut(Variable +'06Hour/'+Weather06Hour);//Updating better logic variable Weather06Hour
BLApp.apiPut(Variable +'07Hour/'+Weather07Hour);//Updating better logic variable Weather07Hour
BLApp.apiPut(Variable +'08Hour/'+Weather08Hour);//Updating better logic variable Weather08Hour
BLApp.apiPut(Variable +'09Hour/'+Weather09Hour);//Updating better logic variable Weather09Hour
BLApp.apiPut(Variable +'10Hour/'+Weather10Hour);//Updating better logic variable Weather10Hour
BLApp.apiPut(Variable +'11Hour/'+Weather11Hour);//Updating better logic variable Weather11Hour
BLApp.apiPut(Variable +'12Hour/'+Weather12Hour);//Updating better logic variable Weather12Hour
BLApp.apiPut(Variable +'13Hour/'+Weather13Hour);//Updating better logic variable Weather13Hour
BLApp.apiPut(Variable +'14Hour/'+Weather14Hour);//Updating better logic variable Weather14Hour
BLApp.apiPut(Variable +'15Hour/'+Weather15Hour);//Updating better logic variable Weather15Hour
BLApp.apiPut(Variable +'16Hour/'+Weather16Hour);//Updating better logic variable Weather16Hour
BLApp.apiPut(Variable +'17Hour/'+Weather17Hour);//Updating better logic variable Weather17Hour
BLApp.apiPut(Variable +'18Hour/'+Weather18Hour);//Updating better logic variable Weather18Hour
BLApp.apiPut(Variable +'19Hour/'+Weather19Hour);//Updating better logic variable Weather19Hour
BLApp.apiPut(Variable +'20Hour/'+Weather20Hour);//Updating better logic variable Weather20Hour
BLApp.apiPut(Variable +'21Hour/'+Weather21Hour);//Updating better logic variable Weather21Hour
BLApp.apiPut(Variable +'22Hour/'+Weather22Hour);//Updating better logic variable Weather22Hour
BLApp.apiPut(Variable +'23Hour/'+Weather23Hour);//Updating better logic variable Weather23Hour
BLApp.apiPut(Variable +'24Hour/'+Weather24Hour);//Updating better logic variable Weather24Hour
wait(2000);}}