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 request :last value from device


AlexPeret
 Share

Question

Hello everyone,

I'm trying to request the last value from temperatureSensor from the API of My HC3 (firmware 5.061.36 (beta) )

When I send :

Please login or register to see this code.

I got a result like this (I trunck it, because of long answer) :

Please login or register to see this code.

The field I'm looking for is created (1612636394)

As I've understood, the value is a timestamp that can be decode as "6/2/2021 à 18:33:14" (I get it from the web site : 

Please login or register to see this link.

 ). Ok fine, so the value seems to be 20.6 C from the 6/2/2021 at 18:33:14

My problem is that this is not the last value from my sensor ! I've got lots of other values (around 24 by days)  from this timestamp and now (the 8/2/2021).

 

Is the created field value a timestamp ?

How can I get the last value from my sensor ?

 

Every help is welcome.

Alex.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Maybe i did not understood the question very well, but the last value reported to the controller is the value.  Now as it is a battery operated device, it only transmits the value when it wakes up or when there is a change as defined in the parameters. So one way would be to modify the parameters of the device to send the value at a smaller change (default is 0.5 Celsius i think).  Another would be to have the sensor report the value more often.

Both of these options would drain the battery pretty fast. You could however solve that by connecting the sensor to DC power.

 

Link to comment
Share on other sites

  • 0
8 minutes ago, Momos said:

Maybe i did not understood the question very well, but the last value reported to the controller is the value.  Now as it is a battery operated device, it only transmits the value when it wakes up or when there is a change as defined in the parameters. So one way would be to modify the parameters of the device to send the value at a smaller change (default is 0.5 Celsius i think).  Another would be to have the sensor report the value more often.

Both of these options would drain the battery pretty fast. You could however solve that by connecting the sensor to DC power.

 

You have modification stamps per property of the device. .created is when the device was created, and .modified when you updated the configuration of the device.

 

To get the modification of the 'value' property of device 22

curl -X GET "XXXXXXXXX/api/devices/22/properties/value

returns something like:

{modified = 1612848831, value = true}

 

where modified is the last time the HC3 changed the  'value' property for device 22

Link to comment
Share on other sites

  • 0

Intriguing question, and I wonder if we are observing a "bug" here. When I look at my Fibaro Mobile App on Android, the "last modified" also often does not make sense. I don't care enough to investigate but I can say for example a motion sensor says "changed last week" while I'm 100% sure a motion scene was triggered right now. It might be a red herring but this is weird IMHO:

 

Please login or register to see this code.

 

They are identical and as OP said it is "Sat Feb 06 2021 19:33:14 GMT+0100 (CET)"

 

@AlexPeret is that, by any chance, the last time you've rebooted your HomeCenter? Or last time you've made a back-up?

Link to comment
Share on other sites

  • 0
  • Inquirer
  • @petergebruers : Yes you're right, this timestamp is more or less the time I've reboot my HC3 (nothing to do with the last backup date). Strange that it is return with this request... I said more or less, because  I can't remember precisely when I reboot my HC3, but that make sens.

     

    @jgabYou got the point. The request you gave return the last date (and value) from the device ID I want.

    Please login or register to see this code.

    By the way, where did you get this request from ? Because it's not documented in the Swagger interface (or did I miss it ?)

    Link to comment
    Share on other sites

    • 0
    8 hours ago, AlexPeret said:

     

    @jgabYou got the point. The request you gave return the last date (and value) from the device ID I want.

    Please login or register to see this code.

    By the way, where did you get this request from ? Because it's not documented in the Swagger interface (or did I miss it ?)

    You're right, it's not documented. It's been around since HC2 - and I believe it was documented in there -  it's the only way to get the modification date from the API so we have to hope it stays...

    • Thanks 1
    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...