Compilation Error

Hello, I’m trying to write a groovy rule that calculates the Air Quality Index retrieving data from my assets but I get a complication error. I also want to run this rule every hour. Can you help me, where can I see the error ?
Here is my code :

package demo.rules

import org.openremote.manager.rules.RulesBuilder
import org.openremote.model.rules.AssetState
import org.openremote.model.asset.Asset
import org.openremote.model.asset.impl.*

Logger LOG = binding.LOG
RulesBuilder rules = binding.rules
Assets assets = binding.assets

def calculateAQI(concentration, limits) {
    // Find the corresponding AQI level based on the concentration and thresholds
    for (int i = 0; i < limits.length - 1; i++) {
        if (concentration >= limits[i] && concentration <= limits[i + 1]) {
            return i
        }
    }
    return -1 // Return -1 if no matching AQI level found
}

def no2_limits = [0, 40, 90, 120, 230, 340, 1000]
def ozone_limits = [0, 50, 100, 130, 240, 380, 800]
def pm10_limits = [0, 10, 20, 25, 50, 75, 800]
def pm25_limits = [0, 20, 40, 50, 100, 150, 1200]
def so2_limits = [0, 100, 200, 350, 500, 750, 1250]

// Define the interval in milliseconds (1 hour = 3600000 milliseconds)
def interval = 3600000

// Create a timer to execute the code at the specified interval
def timer = new Timer()

def task = new TimerTask() {
    @Override
    void run() {
        try {
            // Retrieve the pollutant concentrations from the assets
            def co = assets.matchFirstAssetState(new AssetQuery().ids("2zhjdjqTWSONZYMcuLA71o")).getAttributeValue("co_pred")
            def no2 = assets.matchFirstAssetState(new AssetQuery().ids("25r7ZRYU9UBvOsOJAfTfF3")).getAttributeValue("co_pred")
            def ozone = assets.matchFirstAssetState(new AssetQuery().ids("52J2HehnTsXFtJn6fBb55h")).getAttributeValue("co_pred")
            def pm10 = assets.matchFirstAssetState(new AssetQuery().ids("6P25yjasZfCdEiVHFZQbwg")).getAttributeValue("co_pred")
            def pm25 = assets.matchFirstAssetState(new AssetQuery().ids("7FerIInpkJHqTIqeA4sVVa")).getAttributeValue("co_pred")
            def so2 = assets.matchFirstAssetState(new AssetQuery().ids("2EM4NM6mg5Pxa582oTiY9C")).getAttributeValue("co_pred")

            // Calculate AQI for each pollutant
            def aqi_no2 = calculateAQI(no2, no2_limits)
            def aqi_ozone = calculateAQI(ozone, ozone_limits)
            def aqi_pm10 = calculateAQI(pm10, pm10_limits)
            def aqi_pm25 = calculateAQI(pm25, pm25_limits)
            def aqi_so2 = calculateAQI(so2, so2_limits)

            // Find the highest AQI among the pollutants
            def aqi = Math.max(aqi_no2, aqi_ozone, aqi_pm10, aqi_pm25, aqi_so2)

            // Update the "index" attribute of the AQI asset
            assets.dispatch("4UGN9efpeckvB67S7uGDcW", "index", aqi)

            LOG.info("AQI calculation completed successfully.")
        } catch (Exception e) {
            LOG.warning("AQI calculation failed: " + e.getMessage())
        }
    }
}

// Schedule the task to run at the specified interval
timer.schedule(task, 0, interval)

Thank you in advance for your help !

Hi,
You can check log from UI also , left corner upper side → 3 dot → logs