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

Grabbing Hue Bridge Information


Question

Posted

Hello Community :)

 

I looking for some good advises or new ideas regarding an issue I'm facing.

I'm trying to collect all information from the hue Bidge (Groups, Scenes, Lights) and store it into a global variable to have an easiest and fastest access to some information from other scenes or QA.

 

For this i've build a targetted json table as:

hueDetails = { fibaroRoomName = { groups = {all groups details}, lights = {all lights details}, scenes = {all scenes details}

 

This works pretty fine at one exception :)

When trying to get lights details from the bridge, i'm using a "for k,v in pairs ()" approach that takes all lights id one by one and http request to the bridge all lights details to be stored.

But i do have 53 lights and the 53 requests looks being sent all at the same time, resulting in a "Connection reset by peer" that potentially means an overflow (i guess).

 

My question is the following, how can i introduce in my "for k,v ...." sequence the idea to iterate to next k value only after a defined timelaps ? 

I've tried fibaro.sleep or setTimeout but does't work. It waits the indicated timelaps and then send all at once...

 

HAs someone any idea of how dealing with this?

all suggestions and ideas welcome... blocked on this for a such a long time :)

 

thanks 

take care

 

 

 

1 answer to this question

Recommended Posts

  • 0
  • Inquirer
  • Posted

    :)

    to complete as i'm searching solutions around, 

    i guess the answer is not far from what @jgab and @10der perfectly explain here (as always): 

    but i can't make articulated for my example :)

     

    always this asynchronous things :(

     

    thanks for any help

    i don't dare sharing my code here, all dirty as it is... but tell me if can help :)

     

    thanks

     

     

    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...