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

Question

Posted

Healthy everyone. I apologize in advance for the translation I am from Slovakia and I am new to this and I would need help. When I enter the desired address into the browser everything is OK
but in HC2 he will show me this.

 

Please login or register to see this code.

Thank you in advance for everything.

 

Please login or register to see this spoiler.

 

18 answers to this question

Recommended Posts

  • 0
Posted (edited)

try to replace 

fibaro:debug(response)

to

fibaro:debug(json.encode(response))

 

 

Edited by cag014
  • 0
  • Inquirer
  • Posted

    Thank you for the quick response but did not help

    Please login or register to see this image.

    Please login or register to see this image.

    Please login or register to see this image.

    Please login or register to see this image.

    Please login or register to see this image.

    Please login or register to see this attachment.

    • 0
    Posted

    Looks like you have Unicode issue... but let's try something else

    Please use different variable name instead of HTTP. In some cases fibaro system uses same global names and it cause some strange behavior 

    for example:

    myHttp = Net.Fhttp(……..)

     

    • 0
  • Inquirer
  • Posted

    Does not work. But thanks anyways. I will keep trying,

    • 0
    Posted

    Might be function below could help you to convert the string

    function urlencode(str)
       if (str) then
          str = string.gsub (str, "([^%w])",
             function (c) return string.format ("%%%02X", string.byte(c)) end)
       end
       return str
    end 
     

    • 0
  • Inquirer
  • Posted

    It doesn't work or I don't know, but thank you

    • 0
    Posted
    1 hour ago, sato9882 said:

    It doesn't work or I don't know, but thank you

    It seems like your server answers with a binary json encoding - there are some standards on that but not that common.

    Maybe you could try calling from a scene as the http implementation there is different and may be better a telling the server that it wants the result in application/json - if your server can honor that

    • 0
  • Inquirer
  • Posted

    And you could help me because I don't know where to start anymore.

    • 0
    Posted
    41 minutes ago, sato9882 said:

    And you could help me because I don't know where to start anymore.

     

    It's possible that what you get is a gzipped version of a (base64 encoded) json table.

    The simplest solution would be to ask the server not gzip the result but send it as plain json text. What kind of server is it?

    Dragging in code to unzip the result is a bit involved. Here is code from the net (credits due). Try calling zzlib.gunzip(data) and see what you get.

    If it's looks like ascii but not as a table it may be base64 encoded (that's another piece of code)

    Please login or register to see this code.

     

    • 0
  • Inquirer
  • Posted

    I am new to this, just learning to barely master the basics and I do not know where to put the zzlib code I could ask the whole. Web serwer is a tinyCam Monitor PRO application running on ALLWINNER dolphin (Android 4.4.2) to control cameras. Did I find that the TinyCam website doesn't respect the "Accept-Encoding: identity" header and that the response is compressed?

    • 0
    Posted (edited)

    For more information:

    • Start Google Chrome,
    • Open Development Tools (CTRL+SHIFT+I)
    • Click the network tab,
    • Open the JSON file in Chrome.
    • Check in the network section (tab) of the Chrome Development tools:
      • Click in the name column on the json file,
      • Check the content-type and report back to this forum:

    Please login or register to see this image.

    /monthly_2019_08/image.png.96fd6e80ffc1e0a485eb185480f40621.png" />

    Edited by Joep
    typo
    • 0
  • Inquirer
  • Posted
      1. Request URL:
        http://192.168.1.30:8083/status.json
      2. Request Method:
        GET
      3. Status Code:
        200 OK
      4. Remote Address:
        192.168.1.30:8083
      5. Referrer Policy:
        no-referrer-when-downgrade
    1. Response Headersview source
      1. Accept-Ranges:
        bytes
      2. Connection:
        keep-alive
      3. Content-Encoding:
        gzip
      4. Content-Type:
        application/json
      5. Date:
        Wed, 7 Aug 2019 15:18:36 GMT
      6. Transfer-Encoding:
        chunked
    2. Request Headersview source
      1. Accept:
        text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
      2. Accept-Encoding:
        gzip, deflate
      3. Accept-Language:
        sk-SK,sk;q=0.9,cs;q=0.8,en-US;q=0.7,en;q=0.6
      4. Connection:
        keep-alive
      5. Host:
        192.168.1.30:8083
      6. Upgrade-Insecure-Requests:
        1
      7. User-Agent:
        Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Mobile Safari/537.36
    • 0
    Posted

    Now you confirmed what @jgab thought, it's gzipped. You have to implement his code to unzip the json or check if it is possible to ask the server for a plain text version.

    • 0
  • Inquirer
  • Posted

    This is an app from Google Play I can do nothing about it. I will tell you how to go next but I still thank everyone for their willingness and help.

    • 0
    Posted
    50 minutes ago, sato9882 said:

    This is an app from Google Play I can do nothing about it. I will tell you how to go next but I still thank everyone for their willingness and help.

    Please login or register to see this code.

    Try this. The risk is that the result is B64 encoded. Or split up in parts...

     

    • 0
  • Inquirer
  • Posted

    So after some time again health did not help even this code but I found that it is coded in B64.

    • 0
    Posted
    3 hours ago, sato9882 said:

    So after some time again health did not help even this code but I found that it is coded in B64.

     

    Base64 decoder (credit 

    Please login or register to see this link.

    )

    Please login or register to see this code.

     

    • 0
  • Inquirer
  • Posted

    Hi friends so after a long time I say again. After updating the android application everything works as it should and so I want to everyone who tried to help me thank you. Thanks for help.

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