I moved my app from ST to my new Hubitat. I’m having trouble getting timeOfDayIsBetween to work (like it did in ST)
I tried this code:
def initialize() {
state.mytime_start = "1:00" //1am
state.mytime_end = "23:55" //11:55pm
subscribe(TriggerSwitch, "switch.off";, BillsSwitchoffHandlerON)
}
def BillsSwitchoffHandlerON(evt){
def run_time = timeOfDayIsBetween(toDateTime(state.mytime_start), toDateTime(state.mytime_end), new Date(), location.timeZone)
if (run_time) then …..
I get the below error. I didn’t have the “toDateTime” in there originally but saw that suggestion posted by someone. I also tried inputting the start and end times and that didn’t work. What am I doing wrong? Help please.
2019-05-07 09:12:24.755 am error groovy.lang.MissingMethodException: No signature of method: user_app_wrj54_MBR_Lights_Control_Hv1_98.timeOfDayIsBetween() is applicable for argument types: (java.lang.String, java.lang.String, java.util.Date, sun.util.calendar.ZoneInfo) values: [21:00, 23:55, Tue May 07 09:12:24 CDT 2019, sun.util.calendar.ZoneInfo[id="US/Central",offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=US/Central,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]] on line 74 (BillsSwitchoffHandler)