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

JSON response truncated


Question

Posted

Hello, I would like to poll a device from a scene. I can do it successfully from a VD but from a scene the code must be different because of lack of  Net.FHttp.

I tried the snipped below, which works but the returned JSON is truncated.

What am I missing? any idea?

thanks for your help!

 

Please login or register to see this code.

 

11 answers to this question

Recommended Posts

  • 0
Posted (edited)

Can you try to print the entire Json... fibaro:debug( json.encode(response) ) instead of  fibaro:debug(response.data)

I think this way you'll be able to see what exactly data field includes.

 

Edited by cag014
  • 0
  • Inquirer
  • Posted (edited)
    3 hours ago, cag014 said:

    Can you try to print the entire Json... fibaro:debug( json.encode(response) ) instead of  fibaro:debug(response.data)

    I think this way you'll be able to see what exactly data field includes.

     

     

    I assume you mean decode and not encode...

    In any case, being the JSON response truncated, decoding it throws an error.

    Seems either a short buffer or a timing issue. Anyone?

    Edited by MarcFinns
    • 0
    Posted (edited)

    No, I mean encode..... it should show raw data of the jSon table

    something like that (an example from fibaro device)

    Please login or register to see this code.

    HC2 has an outstanding buffer length....

    Edited by cag014
    • 0
  • Inquirer
  • Posted

    I can see that. And it is truncated

    • 0
    Posted (edited)

    I do not believe that it's HC2 issue.

    Could you please add timeout to HTTP call. Might be there is some interval in data transmission from your device

    local http = net.HTTPClient( {timeout=7000} ) -- 7 seconds timeout

    Edited by cag014
    • 0
  • Inquirer
  • Posted
    40 minutes ago, cag014 said:

    I do not believe that it's HC2 issue.

    Could you please add timeout to HTTP call. Might be there is some interval in data transmission from your device

    local http = net.HTTPClient( {timeout=7000} ) -- 7 seconds timeout

     

    Tried, no difference

    • 0
    Posted

    You mentioned that in VD it works fine.... right?

    could you post VD code?

     

    Another long long shot... try to replace http and url variables to different names. These variables are in use in Fibaro system as well...

    Please login or register to see this code.

    • 0
  • Inquirer
  • Posted

    The VD code uses Net.Fhttp() which is not available from scenes..

    • 0
    Posted

    Yes, I know, but is it works OK? No data truncated?

    • 0
  • Inquirer
  • Posted

    From the VD it works fine indeed

    • 0
    Posted

    Did you ever found a solution? I'm running into the exact same issue.

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