Query API - Time Specifier Problem

I am trying to retrieve data from noon yesterday until noon today but it appears that the &end specifier is incorrect. I say this because I know that &begin works. Here is the query that keeps return an (unspecified) error

select=[time.iso,AC,Dishwasher,Dryer,FamilyRoom,Furnace,HotTub,HRV_HotWater,Stove,SunRmFlr_Under,WashOutlet,Main]&begin=d-12h&end=d+12h&group=20m&format=csv&header=no

1 Like

Amazing that this has not come up before. The problem appears to be that + anything just doesn’t work. I will try to get it fixed in the next release. I can’t think of a workaround, except that you can get it a day later with begin=d-36h&end=d-12h.

Looking further into this it seems the problem is that the ‘+’ sign is not making it through as it’s a URL Special Character. If you replace the d+12 with d%2b12 it should work. Not sure what I can do about that on the receiving end except note it in the documentation.

1 Like

I do all my queries in python so the workaround is pretty painless

now = datetime.now()
min_since_noon = int((now - now.replace(hour=12, minute=0, second=0, microsecond=0)).total_seconds() / 60) 	
# Alternative: end_before_noon = int((now - now.replace(hour=11, minute=59, second=0, microsecond=0)).total_seconds() / 60) 
getIotaWattData("d-12h", "s-" + str(min_since_noon + 1) + "m", "20m") # Calling getIotaWattData(start,end,grp):

Given this issue hasn’t come up till now, seems like a perfectly fine solution.