openWeatherMap rules issue

Hello. I am trying to use the rule from the openweathermap binding that was posted here: OpenWeatherMap Binding

My rule is as follows:

> rule "Weather Update"
> when
> 	System started or
> 	Item LocalWeatherAndForecast_Current_LastMeasurement changed
> then
> 	if ((LocalWeatherAndForecast_Current_LastMeasurement!=NULL)) {
> 
> 		Thread::sleep(25)  //wait until all weather items are properly updated
> 
> 		var today_min = 50|°F
> 		var today_max = -50|°F
> 		var tomorrow_min = 50|°F
> 		var tomorrow_max = -50|°F
> 		val String todaystr = now.toString.substring(0,10)
> 		val String tomorrowstr = (now.plusHours(24)).toString.substring(0,10)
> 
> //Today's min/max temperature
> 		gWeatherForecastTime.members.filter[f | f.state.toString.substring(0,10)==todaystr].forEach[wtime | {
> 			var wtemp = gWeatherForecastTemp.members.findFirst[j | j.name == wtime.name.toString + "_Temp"]
> 			if (wtemp.state != NULL) {
> 				if ((wtemp.state) < today_min) {
> 					today_min = wtemp.state
> 					}
> 				if ((wtemp.state) > today_max) {
> 					today_max = wtemp.state
> 					}
> 				}
> 			}
> 		]
> 
> //Tomorrow's min/max temperature
> 		gWeatherForecastTime.members.filter[f | f.state.toString.substring(0,10)==tomorrowstr].forEach[wtime | {
> 			var wtemp = gWeatherForecastTemp.members.findFirst[j | j.name == wtime.name.toString + "_Temp"]
> 			if (wtemp.state != NULL) {
> 				if ((wtemp.state) < tomorrow_min) {
> 					tomorrow_min = wtemp.state
> 					}
> 				if ((wtemp.state) > tomorrow_max) {
> 					tomorrow_max = wtemp.state
> 					}
> 				}
> 			}
> 		]
> 
> //Today's "worst" weather condition
> 		var Number wID_num							// loop variable for today's forecast Weather Condition ID 
> 		var Number wIDmax_num = 0					// day's worst weather condition ID
> 
> 		gWeatherForecastTime.members.filter[f | f.state.toString.substring(0,10)==todaystr].forEach[wtime | {
> 			var wID = gWeatherForecastID.members.findFirst[j | j.name == wtime.name.toString + "_ID"]
> 			if (wID.state != NULL) {
> //				logInfo("weahterMinMax", "ID item " + wID.toString)
> 				wID_num = Integer::parseInt(wID.state.toString)
> // check forecast categories in order of worst priority to assign "worst" weather condition ID
> // heavy thunderstorm and thunderstorm
> 				if (wID_num == 212) {				// no matter what current max value is assign worst ID immediately
> 					wIDmax_num = wID_num
> 					}
> 				else if (wID_num == 211) {			// unless ID not 212 then assign 2nd worst immediately
>  					if (wIDmax_num != 212) {
> 						wIDmax_num = wID_num
> 						}
> 					}
> // all other thunderstorms
> 				else if ((wID_num >= 200) && (wID_num < 233)) {
> 					if ((wIDmax_num != 211) && (wIDmax_num != 212)) {
> 						if (wIDmax_num <233) {		// if max ID is a Thunderstorm already (but not severe) assign max of Thunderstorm
> 							wIDmax_num=Math::max(wIDmax_num, wID_num)
> 							}
> 						else {						// else assign Thunderstorm ID
> 							wIDmax_num = wID_num
> 							}
> 						}
> 					}
> // all other weather conditions except clear and cloudy
> 				else if ((wID_num >= 300) && (wID_num < 782)) {
> 					if ((wIDmax_num >=800) || (wIDmax_num ==0)) {	// if max ID is clear/cloudy or not used before assign condition ID
> 						wIDmax_num = wID_num
> 						}
> 					else {											// else assign max of condition ID
> 						wIDmax_num=Math::max(wIDmax_num, wID_num)
> 						}
> 					}
> 				}

and I keep getting errors related to:

2020-04-27 09:26:13.975 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'OpenWeatherMap.rules' has errors, therefore ignoring it: [84,6]: mismatched input '<EOF>' expecting '}'

I tried adding the “}” but then another error is created.

Does anyone see what I’m missing?

EDIT: I added VS code, and there are over 40 errors that I have no clue what to do with. Most refer to a non final variable inside a lamba. I don’t have any clue…

Please don’t respond, I went a different route with the same binding, it now works.