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

Retrieving specific value from device


Rikbast

Question

Hi,

 

I retrieved all data of the devices from my HCL with http://192.168.0.33/api/devices and they are written in one file.

Now I am want to retrieve temperature, lux etc from different devices, but I can't seem to find the right way to do it.

 

If I just retrieve data from one device for instance 172 with call http://192.168.0.33/api/devices/172 it works:

 

json.properties.value will do the trick

 

But I don't want to sent commands for each device to retrieve data. Is there a way to retrieve specific values from the all devices json table?

I tried json.properties[51].value, because this device has the header 51 (see code here below), but that does not work.

Anyone an idea how to get the desired value?

 

Thx!

Rik

Please login or register to see this code.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
4 minutes ago, Rikbast said:

json.properties[51].value

I understand what you are trying to do... That's on a Domoticz? Never mind, json should actually decode to the same Lua structure as a HomeCenter.

 

I would guess:

 

json[51].properties.value

 

Because "devices" is an array of all your IDs, then per device you have got properties...

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Yes! That did the trick, but I should use [52] as the table starts with 0 as first device (the controller).

    thx Peter.

     

    Yes, I am retrieving data from HCL to Domoticz and use these variables in LUA scripts.

    Link to comment
    Share on other sites

    • 0
    16 hours ago, Rikbast said:

    That did the trick, but I should use [52] as the table starts with 0 as first device (the controller).

     

    Just to be on the safe side:

     

    Each device on your HCL has an "device ID", and that id is:

     

    json[... some number here ...].id

     

    In your example: json[52].id is 172 and this matches call http://192.168.0.33/api/devices/172

     

    The number 172 is "stable" as long as you only do "soft reconfigure" on that device. If you do "reconfigure" or exclude and include, the HCL assigns a new "id"

     

    Almost all scripts on this forum refer to that id (172).

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi,

     

    I will keep an eye on this when necessary. Let's see where I get with these API calls, if the HCL can cope with API call of all devices every 2 minutes.

    Next step: sent API Post to HCL to open/close rollershutters when LUA scripts in domoticz says so.

    thx!

     

    just maybe I can use HCL scenes also, but I need for example also sun UV index and sun radiation value for controlling rollershutter. I use weather underground in Domoticz, I don't think it is available for Fibaro?

    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.

    ×
    ×
    • Create New...