Rule error for minusMinutes()

You should convert to epoc times and then compare. The article I referred to says

// See if DateTimeType is before Joda DateTime
if(now.isBefore((MyDateTimeItem.state as DateTimeType).calendar.timeInMillis)) ...

So in your case something like

val check = (Sunrise_Time.state as DateTimeType).calendar.timeInMillis + (60*60*1000)
if(now.isBefore(check)...