When Time cron not firing

I have this rule which was working fine when I used a switch on my site map to fire it. Now I want it to fire based on a cron scheduler. I made this just to try it out and I would expect it to fire every 5 minutes but it is not firing. Can anyone see what I am doing wrong?

import org.joda.time.*

var Timer sunrise_timer = null
var Timer sunset_timer = null


rule "get sunrise and sunset"
when
    Time cron “0 0/5 * * * ?”
then
    var String json = sendHttpGetRequest("http://api.wunderground.com/api//astronomy/q/Bermuda.json")

    var String Hour = transform("JSONPATH", "$.sun_phase.sunrise.hour", json)
    var String Minute = transform("JSONPATH", "$.sun_phase.sunrise.minute", json)
    var String sunrise = Hour + ":" + Minute
    var DateTime sunRise = parse(now.getYear() + "-" + now.getMonthOfYear() + "-" + now.getDayOfMonth() + "T" + sunrise)

    Hour = transform("JSONPATH", "$.sun_phase.sunset.hour", json)
    Minute = transform("JSONPATH", "$.sun_phase.sunset.minute", json)
    var String sunset = Hour + ":" + Minute
    var DateTime sunSet = parse(now.getYear() + "-" + now.getMonthOfYear() + "-" + now.getDayOfMonth() + "T" + sunset)

    Sunrise.sendCommand(sunrise)
    Sunset.sendCommand(sunset)
    logInfo( "FILE", sunrise)
    logInfo( "FILE", sunset)

    sunrise_timer = createTimer(sunRise)[|
            Outlet1_1.sendCommand(ON)
    ]

    sunset_timer = createTimer(sunSet)[|
            Outlet1_1.sendCommand(OFF)
    ]
end

Please ensure, that you used " around the cron expression (the code above contains “ and ” instead of ")

For what it’s worth it is easier to use the Astro binding for this.

Oh wow! My friend YOU are a rock star. I would never in a million years have caught that. The rule is purring away like a kitten now. Thank you!

I’ll check this out. Thank you for the recommendation!

This might be of interest.