TonyM1958 / FoxESS-Cloud

Access to Fox ESS Cloud Data
MIT License
25 stars 4 forks source link

illegal timestamp #6

Closed ondrej337 closed 9 months ago

ondrej337 commented 9 months ago

Hi, ** get_access(), no result data, errno = 40256: Parameter could not be parsed correctly illegal timestamp

Can you check it please?

ondrej337 commented 9 months ago

function: def signed_header(path, login = 0): t_now = time.time() *timestamp = str(round(t_now 1000))**

ondrej337 commented 9 months ago

Seems foxesscloud company issue https://www.foxesscloud.com/public/i18n/en/OpenApiDocument.html#3 your timestamp is correct: timestamp | Yes |   | Current timestamp milliseconds

TonyM1958 commented 9 months ago

The code works in UTC timezone. What timezone are you in and how did you configure the timezone parameter?

Can you give an example of the code you are running when getting the error?

ondrej337 commented 9 months ago

I am UTC+1 Parameter: f.time_zone = "Europe/Prague" result of the function: ** get_access(), no result data, errno = 40256: Parameter could not be parsed correctly illegal timestamp

I run only: import foxesscloud.openapi as f

add your info here

f.api_key = "xxx" f.device_sn = "xxx" f.time_zone = "Europe/Prague"

f.get_access_count()

TonyM1958 commented 9 months ago

Ok, can you try increasing the debug level and running again. like this so we can see what the header being sent looks like. This is what it looks like for me:

image

TonyM1958 commented 9 months ago

another thing to check is that your system time and time zone are set correctly as time.time() returns a UTC times that relies on the system clock for it's offset.

ondrej337 commented 9 months ago

thank you so much, my time was not correct, so I installed ntp service which synchronize time correctly. You can close the issue.

TonyM1958 commented 9 months ago

OK - glad it's working for you now.