Bug in platform time input


(www.rboyapps.com - Make your home your butler!) #1

I’m trying to write a code for a thermostat smart app.
I take inputs from user for the time he wants to schedule temperature changes:

section("Monday thru Friday Schedule") {
	input ("time1", "time", title: "Wake Time of Day")	
	input ("tempSetpoint1", "number", title: "Wake Heat Temp")
	input ("tempSetpointA", "number", title: "Wake Cool Temp")
	input ("time2", "time", title: "Leave Time of Day")
	input ("tempSetpoint2", "number", title: "Leave Heat Temp")
	input ("tempSetpointB", "number", title: "Leave Cool Temp")
	input ("time3", "time", title: "Return Time of Day")
	input ("tempSetpoint3", "number", title: "Return Heat Temp")
	input ("tempSetpointC", "number", title: "Return Cool Temp")
	input ("time4", "time", title: "Sleep Time of Day")
	input ("tempSetpoint4", "number", title: "Sleep Heat Temp")
	input ("tempSetpointD", "number", title: "Sleep Cool Temp")
}
section("Saturday and Sunday Schedule") {
	input ("time11", "time", title: "Wake Time of Day")	
	input ("tempSetpoint11", "number", title: "Wake Heat Temp")
	input ("tempSetpointAA", "number", title: "Wake Cool Temp")
	input ("time21", "time", title: "Leave Time of Day")
	input ("tempSetpoint21", "number", title: "Leave Heat Temp")
	input ("tempSetpointBB", "number", title: "Leave Cool Temp")
	input ("time31", "time", title: "Return Time of Day")
	input ("tempSetpoint31", "number", title: "Return Heat Temp")
	input ("tempSetpointCC", "number", title: "Return Cool Temp")
	input ("time41", "time", title: "Sleep Time of Day")
	input ("tempSetpoint41", "number", title: "Sleep Heat Temp")
	input ("tempSetpointDD", "number", title: "Sleep Cool Temp")
}

However when I check the values reported back to the smartapp by the platform,

def timeNow = now()
log.debug("Current time is ${new Date(timeNow)}")
log.debug("Scheduled time ${time1}")
log.debug("Scheduled time ${time2}")
log.debug("Scheduled time ${time3}")
log.debug("Scheduled time ${time4}")
log.debug("Scheduled time ${time11}")
log.debug("Scheduled time ${time21}")
log.debug("Scheduled time ${time31}")
log.debug("Scheduled time ${time41}")

I see:

d2f62a07-acfa-448a-a859-94b4af249cd6 11:49:08 AM: debug Scheduled time 2014-10-06T17:00:00.000-0500
d2f62a07-acfa-448a-a859-94b4af249cd6 11:49:08 AM: debug Scheduled time 2014-10-06T11:35:00.000-0500
d2f62a07-acfa-448a-a859-94b4af249cd6 11:49:08 AM: debug Scheduled time 2014-10-06T10:00:00.000-0500
d2f62a07-acfa-448a-a859-94b4af249cd6 11:49:08 AM: debug Scheduled time 2014-10-06T08:00:00.000-0500
d2f62a07-acfa-448a-a859-94b4af249cd6 11:49:08 AM: debug Scheduled time 2014-10-06T13:00:00.000-0500
d2f62a07-acfa-448a-a859-94b4af249cd6 11:49:08 AM: debug Scheduled time 2014-10-06T10:00:00.000-0500
d2f62a07-acfa-448a-a859-94b4af249cd6 11:49:08 AM: debug Scheduled time 2014-10-06T09:00:00.000-0500
d2f62a07-acfa-448a-a859-94b4af249cd6 11:49:08 AM: debug Scheduled time 2014-10-06T08:00:00.000-0500
d2f62a07-acfa-448a-a859-94b4af249cd6 11:49:08 AM: debug Current time is Sat Nov 08 16:49:08 UTC 2014

Notice the current date Nov 8 but the value reported by the user time inputs is Oct 6th.

Anyone have any idea if this is a bug in the platform or bug in the code?


(Convinced ST will never be unbroken…) #2

Dunno… I don’t recall seeing this, but haven’t really looked since the recent “platform upgrade”. Probably should ask support about this one.

One thing to be aware of however, is that you can only have up to four simultaneous schedules within any given SmartApp.


(www.rboyapps.com - Make your home your butler!) #3

Thanks will check with them and apprecaite the tip on the schedule.


(www.rboyapps.com - Make your home your butler!) #4

Also found another issue after using timeToday(time) in the time input by user (e,g I enter 12:00 and I’m in EST) it converts it to 18:00 UTC instead of 17:00 UTC


(Chuckles) #5

If it’s getting the date wrong it will probably also be getting the DST conversion wrong because of the date…


(www.rboyapps.com - Make your home your butler!) #6

you maybe right but when I’m using timeToday it should be taking today’s date with the time specified but still getting it wrong, but like you said it could be linked to the original date being wrong. reported it to ST lets see if they can fix it


(www.rboyapps.com - Make your home your butler!) #7

It’s a bug, see here: