- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 51
Description
Just a heads up in case others hit this - I've been getting an exception from the set_curfew API since daylight saving changed for me today (in NZ, so changing out of daylight saving).
I'll look at adding a workaround, but I think this is a once-a-year issue that will go away in a few hours. I think I had a similar issue this time last year.
I think this is because the Sure API is doing some weird adjustment (possibly a bug) to correct for daylight saving changing. Via the website, if I manually set the curfew end time it's subtracting one hour from the requested end time.
e.g. If via the Sure app, I set Unlock time of 7:39, then it succeeds, but shows time on the website (and via the API data) at 6:39.
PUT https://app-api.production.surehub.io/api/device/123/control
request:
{
	"curfew": [
		{
			"enabled": true,
			"lock_time": "18:05",
			"unlock_time": "07:39"
		}
	]
}200 response: (note unlock_time)
{
	"data": {
		"curfew": [
			{
				"enabled": true,
				"lock_time": "18:05",
				"unlock_time": "06:39"
			}
		],
		"locking": 0,
		"fast_polling": true
	}
}I think this is a timezone bug from the backend of the Sure app. Maybe something like it's using midnight of current date (rather than current date-time) to figure out if daylight saving is in effect.
On our side, the issue is that we fail this check, because the response unlock_time doesn't match the request time here:
Lines 375 to 380 in 9806785
| # check if the state is correctly updated | |
| if state == desired_state: | |
| return response | |
| # return None | |
| raise SurePetcareError("ERROR (UN)LOCKING DEVICE - PLEASE CHECK IMMEDIATELY!") | 
Potentially we could change this to a warning.