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

"End of file" when trying to parse api.dryg.net through HTTPS


Question

Posted

Hi,

 

I have been using api.dryg.net to get day info and it has been working great until a couple of days ago.

I get Error 301, which i assume is due to webpage is not HTTP anymore, instead only HTTPS is supported.

 

Before i used a VD and used Net.FHttp :

 

local httpSession = Net.FHttp(ip, port);
local date = os.date("%Y/%m/%d");
response, status, errorCode = httpSession:GET("/dagar/v2.1/"..date)

 

If i have understood it correctly, i need to use a http:request instead and this can only be done from a scene?

 

When i do the following from a scene i get this:

 

local httpSession = net.HTTPClient();
httpSession:request("https://api.dryg.net/dagar/v2.1/" ..date, {
      options = {method = 'GET', timeout = 5000 },
          success = function(status)
          print(status.status)
          if status.status ~= 200 and status.status ~= 201 then print("failed"); end
          print(status.data);
          local results = json.decode(status.data)
          for k,v in pairs(results) do print(k, v) end
        end,
        error = function(err)
          print('[ERROR] ' .. err)
        end
      })

 

Response is :

[ERROR]End of file

 

Any idea what im doing wrong?

 

14 answers to this question

Recommended Posts

  • 0
Posted

some notices/tips

 

 

 

about https

 

1) be careful with declare headers

for example (bad using Content-Length)

Please login or register to see this image.

 

2) in some situation Fibaro can't get right http status response if status response != 200 (confirmed with long emailing with Fibaro support|)

3) https is not working in VD

4) https protocol is not properly implemented (confirmed with long emailing with Fibaro support|)

5) Fibaro use tlsv1 and you can't change this behavior. 

protocol="tlsv1_2",

doesn't work

6) use checkCertificate = false option if you have self-signed certs

7) use a JS console/network monitor in your browser for clear understand what browser send to server... (use private windows mode)

  • 0
  • Inquirer
  • Posted

    Thanks @10der !

     

    I will try out some of your tips and see if it works better.

     

    BR

    • 0
    Posted

    btw, opps. you can't.

     

    Please login or register to see this code.

     

    Please login or register to see this image.

     

    1 hour ago, 10der said:

    5) Fibaro use tlsv1 and you can't change this behavior. 

    alas!

     

    • 0
  • Inquirer
  • Posted

    Ahh.. Then i know the reason.

    Thanks again!

     

    BR

    Strange.. I copied your code to see that i get the same response but i still get "End of file":

     

    Please login or register to see this image.

    /monthly_2018_08/Scene.JPG.fd89bc6a80495e612f532d8d694e99e9.JPG" alt="Scene.JPG.fd89bc6a80495e612f532d8d694e99e9.JPG" />

     

    Response.JPG.299f1a188ff0d71ee697b5620e8cc39c.JPG

    • 0
    Posted

    yay!

    Please login or register to see this image.

     

     

    look like FIBARO return rand() :)

    crazy!

    WSKBSLTPJ9.png

    • Like 1
    • 0
  • Inquirer
  • Posted

    Ok. Thats interesting ;)

    • 0
    Posted (edited)

    I think FIBARO sometimes forgot to make disposing of processes... or something of the sort...

    Edited by 10der
    • 0
    Posted

    Hi,

     

    Any progress on this?

     

    I'm facing the same issue with calls to api.dryg.net. It stopped working from my Fibaro scene after July 29th without any changes being made to the scene code.

     

    Regards,

     

    /Jan

    • 0
    Posted

    Hello,

     

    I too faced this problem and raised a ticket with the support team the reply came back on 20th August

     

    "HTTPS is not supported"

     

     

    • 0
    Posted

    "HTTPS is not supported"

     

    Is that still the case with latest firmware version?

    • 0
    Posted

    idk. I've stopped believing in FIBARO miracles. :) 

    • 0
    Posted

    You can actually overcome this with

    Please login or register to see this code.

    As shown here

    Please login or register to see this link.

     

    Enjoy

    • 0
    Posted

    @ianakapilotlight, thank's for the answer. It looked promising, but I can't see that it makes any difference.

     

    My code:

     

    Please login or register to see this code.

    Can you get this URL to work from a Fibaro scene: 

    Please login or register to see this link.

     ?

     

    I'm running HC2 4.510.

     

    Regards,

     

    /J. 

    • 0
    Posted
    12 minutes ago, CQ1 said:

    Can you get this URL to work from a Fibaro scene: 

    Please login or register to see this link.

     ?

     

    1

    no you can't

     

    [DEBUG] 21:56:31: 2019-02-06 21:56:31.103899 [ error] Handshake error: wrong version number
    [DEBUG] 21:56:31: 2019-02-06 21:56:31.104594 [ error] Handshake error: sslv3 alert handshake failure

     

    HC2 performs SSLv3 (AFAIR died at 2014y) requests but your server rejected it cuz asking not supported by HC2 protocol (TLS)

     

    • Like 1

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