Hi All
I have two rules which are failing with these errors. Seems the trigger for system started doesnt work now?
Script execution of rule with UID ‘timeofday-9’ failed: ‘withTimeAtStartOfDay’ is not a member of ‘java.time.ZonedDateTime’; line 110, column 23, length 24 in timeofday
and
Script execution of rule with UID ‘system-7’ failed: The name ‘systemStarted’ cannot be resolved to an item or type; line 71, column 7, length 13 in system
Rule:
rule "Calculate time of day state"
when
System started or
Channel 'astro:sun:darlingpoint:rise#event' triggered START or
Channel 'astro:sun:darlingpoint:set#event' triggered START or
Time cron "0 1 0 * * ? *" or
Time cron "0 0 6 * * ? *" or
Time cron "0 0 23 * * ? *"
then
logInfo("Time Of Day", "Calculating time of day...")
// Calculate the times for the static tods and populate the associated Items
// Update when changing static times
// Jump to tomorrow and subtract to avoid problems at the change over to/from DST
val morning_start = now.withTimeAtStartOfDay.plusDays(1).minusHours(18)
vMorning_Time.postUpdate(morning_start.toString)
val night_start = now.withTimeAtStartOfDay.plusDays(1).minusHours(1)
vNight_Time.postUpdate(night_start.toString)
val bed_start = now.withTimeAtStartOfDay
vBed_Time.postUpdate(bed_start.toString)
// Convert the Astro Items to Joda DateTime
val day_start = new DateTime(vSunrise_Time.state.toString)
val evening_start = new DateTime(vSunset_Time.state.toString)
val afternoon_start = new DateTime(vEvening_Time.state.toString)
// Calculate the current time of day
var curr = "UNKNOWN"
switch now {
case now.isAfter(morning_start) && now.isBefore(day_start): curr = "MORNING"
case now.isAfter(day_start) && now.isBefore(afternoon_start): curr = "DAY"
case now.isAfter(afternoon_start) && now.isBefore(evening_start): curr = "AFTERNOON"
case now.isAfter(evening_start) && now.isBefore(night_start): curr = "EVENING"
case now.isAfter(night_start): curr = "NIGHT"
case now.isAfter(bed_start) && now.isBefore(morning_start): curr = "BED"
}
// Publish the current state
logInfo("Time of Day", "Calculated time of day is " + curr)
vTimeOfDay.sendCommand(curr)
end
Any suggestions as to the fix? I was under the impression now.withTimeAtStartOfDay was still valid, as was system started
Thanks