Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

api.get and e (exponential) notation


cashe
 Share

Question

Hi, everybody!

I am trying to read HC3 energy database data of a specific device (power consumption chart in device Advanced tab drawn based on it).

Usual GET-request in Postman (start time 1655244000, end time 1655330400 and device ID 75):

Please login or register to see this code.

answering:

Please login or register to see this code.

A table of times (epoch in millisecons) and a values in W.

 

But the problem is when I'm trying to get the same with an api.get:

Please login or register to see this code.

 

I get:

Please login or register to see this code.

 

Not the same: huge integer presented in exponential notation here and aryphmetic operations results will be different.

 

1.655244e+12 - 1.655244e+12 = 262144.0 (NOT CORRECT)

while:

1655244340000 - 1655244000000 = 340000 (CORRECT)

 

 

Is there any possibility to deny Fibaro to use e notation? WHY HC3 uses milliseconds instead of seconds in epoch time?

Of course, I can use net.HTTPClient() instead and parse recieved string somehow, but this is not a good solution, I think.

 

Thanks!

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

You get that on a homecenter lite? 

They only have 32bit Lua....

Link to comment
Share on other sites

  • 0
  • Inquirer
  • 16 minutes ago, jgab said:

    You get that on a homecenter lite? 

    They only have 32bit Lua...

     

    Yes, I am trying to make my QA universal.

    Link to comment
    Share on other sites

    • 0
    14 hours ago, cashe said:

     

    Yes, I am trying to make my QA universal.

    They choose to compile the Lua environment to use 32bit and it's not sufficient when representing some of their own data... feels like a design error....

    • Like 2
    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

     Share

    ×
    ×
    • Create New...