Comprehensive Wunderground using HTTP Binding Example

If I understand your question correctly, I iterate through all of the alerts when there are multiples delivered in the API.

ITEMS:

String      Weather_Alert_Message_Raw      "Severe Weather Alert (Raw) [%s]"	    <text>  (gWeather,gNotification)
String      Weather_Alert_Message          "Severe Weather Alert [%s]"	            <text>  (gWeather,gNotification)    
String      Weather_Alert_NWS_VTEC         "Severe Weather Alert NWS VTEC [%s]"	    <text>  (gWeather,gNotification)
String      Weather_Alert_Type             "Severe Weather Alert Type [%s]"	        <text>  (gWeather,gNotification)
DateTime    Weather_Alert_Expiration       "Severe Weather Alert Expiration [%1$tA, %1$tB %1$te, %1$tY at %1$tl:%1$tM%1$tp]"	<calendar>  (gWeather,gNotification)

RULES:

rule "Alert: Check for weather alert"
when
	Time cron "0 1/5 * * * ?"
    //or
    //Item Virtual_Switch_1 changed
then
    //logDebug("Rules", "Alert: Check for weather alert: Starting")
    val String rawMessage = executeCommandLine("/bin/sh@@-c@@/usr/bin/curl -s -X GET https://api.wunderground.com/api/<api key>/alerts/conditions/q/pws:KOHHINCK2.json",60000)
    //logDebug("Rules", "Alert: Check for weather alert: Testing: rawMessage=[{}]",rawMessage)
    if (rawMessage.length > 0 && !rawMessage.contains("High Load")) {
        val String tempLux = transform("JSONPATH", "$.current_observation.solarradiation", rawMessage)
        //logDebug("Rules", "Alert: Check for weather alert: Testing: tempLux=[{}]",tempLux)
        if (tempLux != null && tempLux != "--") {
            Outside_Bloomsky_Lux_Raw.sendCommand(tempLux)
            //logDebug("Rules", "Alert: Check for weather alert: Testing: Outside_Bloomsky_Lux=[{}]",Outside_Bloomsky_Lux.state)
        }
        if (rawMessage.contains("message")) {
            Weather_Alert_Message_Raw.sendCommand(rawMessage)
            var i = 0
            while (i < Integer::parseInt(transform("JSONPATH", "$.response.features.alerts", rawMessage))) {
                logDebug("Rules", "Alert: Check for weather alert: Testing: starting loop. Alert=[{}]",i)
                val String parsedMessage = transform("JSONPATH", "$.alerts[" + i + "].message", rawMessage)
                //logDebug("Rules", "Alert: Check for weather alert: Testing: parsedMessage=[{}]",parsedMessage)
                if (!parsedMessage.contains("Small Craft")) {
                    val String weatherAlertDescription = transform("JSONPATH", "$.alerts[" + i + "].description", rawMessage)
                    Weather_Alert_Type.sendCommand(weatherAlertDescription)
                    val String weatherAlertType = transform("JSONPATH", "$.alerts[" + i + "].type", rawMessage)
                    Weather_Alert_NWS_VTEC.sendCommand(weatherAlertType)
                    val DateTime expirationTime = new DateTime(Long::parseLong(transform("JSONPATH", "$.alerts[" + i + "].expires_epoch", rawMessage)) * 1000L)
                    //logDebug("Rules", "Alert: Check for weather alert: Testing: rawExpirationTime=[{}]",rawExpirationTime)
                    Weather_Alert_Expiration.sendCommand(expirationTime.toString)
                    val String doubleParsedMessage = parsedMessage.replaceAll("(?s)\nLat...Lon.*","").replaceAll("\n\\.\\.\\.","").replaceAll("\\.\\.\\.",", ").replaceAll("\\*"," ").replaceAll("for,.*[Uu]ntil","until")
                    //logDebug("Rules", "Alert: Check for weather alert: Testing: doubleParsedMessage=[{}]",doubleParsedMessage)
                    Weather_Alert_Message.sendCommand(doubleParsedMessage)
                }
                i = i + 1
            }
        }
        else {
            logDebug("Rules", "Alert: Check for weather alert: No alert found")
        }
    }
    else {
        logInfo("Rules", "Alert: Check for weather alert: Communication with Weather Underground failed.")
    }

    /*
    example alert
    
    {
        "response": {
            "version":"0.1",
            "termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
            "features": {
                "alerts": 1
                }
        },
        "query_zone": "020",
        "alerts": [
                {
                    "type": "FOG",
                    "description": "Dense Fog Advisory",
                    "date": "10:01 PM EDT on October 3, 2016",
                    "date_epoch": "1475546460",
                    "expires": "9:00 AM EDT on October 04, 2016",
                    "expires_epoch": "1475586000",
                    "tz_short":"EDT",
                    "tz_long":"America/New_York",
                    "message": "\u000A...Dense fog advisory in effect from 2 am to 9 am EDT Tuesday...\u000A\u000AThe National Weather Service in Cleveland has issued a dense fog\u000Aadvisory...which is in effect from 2 am to 9 am EDT Tuesday.\u000A\u000A* Visibilities...dropping below a quarter of a mile in low spots\u000A especially near rivers and ponds.\u000A\u000A* Timing...fog will develop and thicken through the night\u000A\u000A* impacts...expect dense fog to form especially in river valleys\u000A and other low lying locations. Visibility will drop below a\u000A quarter mile and remain low through about 830 am\u000A\u000APrecautionary/preparedness actions...\u000A\u000AA dense fog advisory is issued when visibilities will frequently\u000Abe reduced to less than one quarter mile. If driving...slow\u000Adown...use your headlights...and leave plenty of distance ahead\u000Aof you.\u000A\u000A\u000A\u000A\u000A",
                    "phenomena": "FG",
                    "significance": "Y"
                }
                "ZONES": []
        ]
    }
        
    https://espanol.wunderground.com/weather/api/d/docs?d=data/alerts
    typeTranslated

    HUR	Hurricane Local Statement
    TOR	Tornado Warning
    TOW	Tornado Watch
    WRN	Severe Thunderstorm Warning
    SEW	Severe Thunderstorm Watch
    WIN	Winter Weather Advisory
    FLO	Flood Warning
    WAT	Flood Watch / Statement
    WND	High Wind Advisory
    SVR	Severe Weather Statement
    HEA	Heat Advisory
    FOG	Dense Fog Advisory
    SPE	Special Weather Statement
    FIR	Fire Weather Advisory
    VOL	Volcanic Activity Statement
    HWW	Hurricane Wind Warning
    REC	Record Set
    REP	Public Reports
    PUB	Public Information Statement
    */
end

rule "Alert: Severe weather alert"
when
    Item Weather_Alert_Message changed
then		
    logDebug("Rules", "Alert: Weather_Alert_Message=[{}], Weather_Alert_NWS_VTEC=[{}]",Weather_Alert_Message.state.toString,Weather_Alert_NWS_VTEC.state.toString)
    SMS_Notification.sendCommand(Weather_Alert_Message.state.toString)
    if (Presence.state.toString != "Away" && (Mode.state.toString != "Night" || "HUR TOR WRN FLO SVR FIR VOL HWW REP PUB".contains(Weather_Alert_NWS_VTEC.state.toString))) {
        Audio_Notification.sendCommand(Weather_Alert_Message.state.toString)
    }
end