API response - "illegal timestamp"

Post Reply
Hugh
Posts: 6
Joined: Fri Aug 02, 2024 5:57 pm

I've started getting an error back from the FoxESS API as of the last couple of days.

Code: Select all

{'errno': 40256, 'msg': 'Parameter could not be parsed correctly illegal timestamp'}
I've not changed anything in my code, and the headers look something like this:

Code: Select all

{
	'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36',
	'lang': 'en',
	'signature': '<signature>',
	'timestamp': '1742992131498',
	'token': '<uuid>'
}
The timestamp and signature are generated using (in Python):

Code: Select all

    timestamp = round(time.time() * 1000)
    signature = fr'{path}\r\n{token}\r\n{timestamp}'
Any idea what could be causing this?
Last edited by Hugh on Wed Mar 26, 2025 12:40 pm, edited 1 time in total.
Hugh
Posts: 6
Joined: Fri Aug 02, 2024 5:57 pm

One thought I did just have - this stopped working at about midnight on Sunday night.

I was wondering if this was to do with some part of the world changing their DST settings last weekend. I'm in the UK, and ours change this coming weekend.

I'm not so sure with this theory, thought, as I looked through this list, and couldn't find anyone who changed on March 23rd/24th.
https://www.timeanddate.com/time/dst/2025.html

For now, I'm going to see if it works if I temporarily add/subtract an hour from the timestamp and see what happens.
Hugh
Posts: 6
Joined: Fri Aug 02, 2024 5:57 pm

Adjusting the time by +/- 1 hour didn't give me any better results.

For reference, the last valid data I got back was at 2025-03-24 00:30 UTC
Dave Foster
Posts: 1786
Joined: Thu Oct 13, 2022 7:21 pm

There have been a few cloud issues of late but all have now been resolved.

The timestamp must be within 1 minute of UTC time, and the most usual candidate in these cases is that your internal clock has drifted just enough to be outside of the 60 second window.

Check to see if you ntp service and system click is keeping accuracy.
Hugh
Posts: 6
Joined: Fri Aug 02, 2024 5:57 pm

Thanks Dave

According to time.is, it looks like my system clock is about 2 minutes ahead of UTC right now.

And yes, that looks like it worked! Thanks for the advice!
Post Reply