timeOfDayIsBetween() throws: No signature of method

No signature of method: app1522044152693531009223.timeOfDayIsBetween() is applicable for argument types: (java.util.Date, java.util.Date, java.util.Date, sun.util.calendar.ZoneInfo)

this is the method signature i have coded to:

Boolean timeOfDayIsBetween(Date start, Date stop, Date value, TimeZone timeZone)

is this not correct?

thanks.

I did a quick search and that method appears to be a function written by ST; all hits are on ST documentation or their community. You may need to find an equivalent for Groovy.

most methods used in smartapps are custom ST functions which are also supported on the hubitat platform.

We did not implement that method. I’ll add it to our list of things to add.

2 Likes

is the same true for timeTodayAfter(…) as well?

thanks.

Yep, I’ve added that method to the list as well.

2 Likes

i have issues with these functions:

1. runEvery1Minute (function)

2. timeOfDayIsBetween (timeStart, timeStop, new Date(), location.timeZone)

I’m getting exceptions for both them:

1. No signature of method: dev1522012292492307448138.runEvery1Minute() is applicable for argument types: (java.lang.String) values: [function] on line 131

2. No signature of method: app1522961901291117552557.timeOfDayIsBetween() is applicable for argument types: (java.lang.String, java.lang.String, java.util.Date, sun.util.calendar.ZoneInfo) values: [05:55, 18:15, Thu Apr 05 14:59:07 CST 2018, sun.util.calendar.ZoneInfo[id=ā€œAmerica/Guatemalaā€,offset=-21600000,dstSavings=0,useDaylight=false,transitions=11,lastRule=null]] on line 635

Could you add them on the current code or need to be modify by other similar expression?

Thanks for the help,

add this method to your code for timeOfDayIsBetween. i have kept the method signature the same here so once hubitat adds the method the method itself can be removed but all calls to it will work as is.

private timeOfDayIsBetween(fromDate, toDate, checkDate, timeZone)     {
     return (!checkDate.before(fromDate) && !checkDate.after(toDate))
}

also instead of runEvery1Minute you could use:

schedule("0 * * * * ?", method)

1 Like

Thanks for the quick reply. I tried both methods. With the timeOfDayIsBetween i“m still seeing and error, like values arent in proper format, is there any aditional convertion that i need to add for hubitat? This is what i have:

timeOfDayIsBetween(timeStart, timeStop, new Date(), location.timeZone)

Where timeStart and timeStop come from:

    timeStart = new Date(riseTime).format("HH:mm", location.timeZone)
    timeStop = new Date(setTime).format("HH:mm", location.timeZone)

Where risetime and settime are:
riseTime = getSunriseAndSunset().sunrise.time
setTime = getSunriseAndSunset().sunset.time

I added the method for timeOfDayIsBetween that u suggest, and got this error now:
No signature of method: java.util.Date.before() is applicable for argument types: (java.lang.String) values: [05:52] Possible solutions: before(java.util.Date), clone(), every(), after(java.util.Date), from(java.time.Instant), parse(java.lang.String) on line 145

Any idea what can be wrong?

Also, about he runEvery1Minute method, could you explain a little how to use the function schedule like that? The ā€˜?’ is the value for X in runEveryXMinute in minutes? Or which other options does this function allowed to set and specific time.

Thanks in advance for the help.

the first 3 parameters to timeOfDayIsBetween should all be Date(). so just use new Date(riseTime) and so on.

this says run every minute at 0 second:
schedule("0 * * * * ?", method)

this says run every 5 minutes starting at 0 minute:
schedule("0 0/5 * * * ?", method)

see here for more details on the cron expression format ST uses:
http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html

Thanks for the help. The explanation was very usefull. Just one more question to this issue.

The ā€œtimeOfDayIsBetweenā€ i use them for compare to pre defined times. The options could be sunrise, sunset and selected.

For sunset/sunrise i get the value from ā€œgetSunriseAndSunsetā€ method. But lets said i want another time, like 3 pm. I ask for that value to the user in preferences like this:

input ā€œthisTimeā€ , ā€œtimeā€, title: ā€œSelect Timeā€ , description: ā€œSelectā€¦ā€, required: false

My trouble is that the function timeOfDayIsBetween doesnt work when i select the time. This is because system shows them as different time format. When you select time it prints it like this:

2018-04-10T17:59:00.000-0600

And method that works with sunrise/sunset seems to work only with this format:

Tue Apr 10 05:52:00 CST 2018

This didnt happen with ST, how do i make the last time/date convertion before use the timeOfDayIsBetween method?

Thanks for the help

1 Like

def checkDate = timeToday(thisTime, location.timeZone)

then use checkDate with the timeofDayIsBetween method.

Thanks a lot, that worked very well for me.

1 Like

timeTodayAfter() and timeOfDayIsBetween() will be in release 1.0.8

3 Likes

timeofdayisbetween(...) still doesnt seem to work:

groovy.lang.MissingMethodException: No signature of method: dev152721162040483663351.timeOfDayIsBetween() is applicable for argument types: (java.util.Date, java.util.Date, java.util.Date, sun.util.calendar.ZoneInfo) values: [Fri May 25 12:50:59 UTC 2018, Fri May 25 20:04:54 UTC 2018, ...] on line 662 (poll)

it was added to Apps exclusively, I'll create an issue to add it to Devices as well if that is what is needed? We did not realize people were using it in drivers.

1 Like

please.

timeOfDayIsBetween is available in drivers in the next release.

2 Likes

@chuck.schwer @bravenel @mike.maxwell
As this has been implemented now, is the code the same as ST?

In ST I used this in an app:

def between = timeOfDayIsBetween(fromTime, toTime, new Date(), location.timeZone)
    if (between) { ... do something }

But I get this error:
app:8252018-09-01 11:54:54.195:errorgroovy.lang.MissingMethodException: No signature of method: app15357992884481231495811.timeOfDayIsBetween() is applicable for argument types: (java.lang.String, java.lang.String, java.util.Date, sun.util.calendar.ZoneInfo) values: [2018-09-01T01:00:00.000+0100, 2018-09-01T08:00:00.000+0100, ...]

Where am I going wrong?

Andy

I believe the first 3 parameters in Hubitat must be Date objects. Maybe ST let you use strings as well in an overload method.