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

QuickApp HTTPClient::request


Question

Posted

Hi,

 

I'm trying to create Kaco solar inverter power meter QuickApp.

I have a problem with HTTPClient::request gets from Kaco "Operation canceled" for .csv files requests.

Any html request to same Kaco will work, but .csv files will fail.

The problem probably is related to Kaco response. it's response data is not between html tags(while Content-type is text/html), i suspect that's the cause of problem.

Below is debug trace of request/response

Quote

GET /realtime.csv HTTP/1.1
Host: 192.168.2.192
Accept: text/html, application/xhtml+xml, */*
User-Agent: avhttp/2.9.9
Connection: close
Content-Length: 0

 

HTTP/1.1 200 OK
Content-Length:     36
Content-type: text/html

 

1639040376;0;0;0;0;0;0;0;0;0;0;0;0;2
 

 

Is there any way i can make HTTPClient to work or TCPSocket is the only option i can use ?

 

Thanks,

5 answers to this question

Recommended Posts

  • 0
Posted

i think TCPSocket is the best solution, after :write you can do :readUntil and sub the csv part from the response. 

  • 0
  • Inquirer
  • Posted (edited)

    -

    Edited by ivx
    • 0
    Posted

    that might be the case (or somethng else, as i tested months ago with wireshark session, i havn't see missing characters), i think you will find here in forum multiple examples showing similar issues. The way how it works is lua->luabind->boost->avhttp i think, so it might that Fibaro messed something up. For now i decided to use TCPSocket to fix "canceled / closed" issue.

    • 0
  • Inquirer
  • Posted (edited)

     

    I will check TCP Client option.

     

     

    Edited by ivx
    • 0
  • Inquirer
  • Posted

    I found actual cause, this is related to HTTP header Connection.

    HTTPClient by default uses value "close", but for some reason HTTP client hangs on some http servers.

    In my case keep-alive fix all errors.

     

    Option will fix this http error.

    options={
                headers = { 
                    Connection = "keep-alive"
                }
            }

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