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

scene starts a scene in another HC2 with error message


muc

Question

Hello,

 

a scene starts a scene in another HC2 with parameters.
Data are correctly received, but there is a strange error message.

 

Lua program:

  ip_port= "192.168.xxx.yyy:80"
  idSz= 194

  daten= "Hallo, hier Sender um "..os.date("%H : %M : %S")
  jDaten= json.encode({args={daten}})
  print(jDaten, #jDaten)

  http= net.HTTPClient({timeout= 5000})
  http:request("http://"..ip_port.."/api/scenes/"..idSz.."/action/start",
  { options=
    { headers=
      { ["Content-Type"]= "application/json;charset=UTF-8",
        Accept= "application/json;text/html",
        Authorization= "Basic cm.....",
        Connection= "keep-alive",
      },
      method= 'POST',
      data= jDaten,
    },
    success= function(resp)
      print("Resp.Status:",resp.status, "; data("..#resp.data..")")
      print(json.encode(resp))
    end,
    error= function(err) print("# Err:", err) end
  })

 

Debug window:

[DEBUG] 17:45:27: {"args":["Hallo, hier Sender um 17 : 45 : 27"]} 47
[DEBUG] 17:45:27: 2023-06-14 17:45:27.408903 [ debug] Detected chunk with zero size, terminating connection
[DEBUG] 17:45:27:
[DEBUG] 17:45:27: Resp.Status: 200 ; data(0)
[DEBUG] 17:45:27: {"data":"","status":200,"headers":{"Cache-Control":"no-cache, no-store","Connection":"keep-alive","Date":"Wed, 14 Jun 2023 15:45:27 GMT","Server":"nginx\/1.8.0","Transfer-Encoding":"chunked","Content-Type":"application\/json;charset=UTF-8"}}

 

 

without   Connection= "keep-alive"   data are received correctly.

But now the error function is called and there is another error message:

 

[DEBUG] 17:48:24: {"args":["Hallo, hier Sender um 17 : 48 : 24"]} 47
[DEBUG] 17:48:24: 2023-06-14 17:48:24.959364 [ debug] error reading from socket: End of file
[DEBUG] 17:48:24:
[DEBUG] 17:48:24: # Err: End of file

 

Who knows what to change or an additional option?

Thanks in advance

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
5 hours ago, muc said:

Hello,

 

a scene starts a scene in another HC2 with parameters.
Data are correctly received, but there is a strange error message.

 

Lua program:

  ip_port= "192.168.xxx.yyy:80"
  idSz= 194

  daten= "Hallo, hier Sender um "..os.date("%H : %M : %S")
  jDaten= json.encode({args={daten}})
  print(jDaten, #jDaten)

  http= net.HTTPClient({timeout= 5000})
  http:request("http://"..ip_port.."/api/scenes/"..idSz.."/action/start",
  { options=
    { headers=
      { ["Content-Type"]= "application/json;charset=UTF-8",
        Accept= "application/json;text/html",
        Authorization= "Basic cm.....",
        Connection= "keep-alive",
      },
      method= 'POST',
      data= jDaten,
    },
    success= function(resp)
      print("Resp.Status:",resp.status, "; data("..#resp.data..")")
      print(json.encode(resp))
    end,
    error= function(err) print("# Err:", err) end
  })

 

Debug window:

[DEBUG] 17:45:27: {"args":["Hallo, hier Sender um 17 : 45 : 27"]} 47
[DEBUG] 17:45:27: 2023-06-14 17:45:27.408903 [ debug] Detected chunk with zero size, terminating connection
[DEBUG] 17:45:27:
[DEBUG] 17:45:27: Resp.Status: 200 ; data(0)
[DEBUG] 17:45:27: {"data":"","status":200,"headers":{"Cache-Control":"no-cache, no-store","Connection":"keep-alive","Date":"Wed, 14 Jun 2023 15:45:27 GMT","Server":"nginx\/1.8.0","Transfer-Encoding":"chunked","Content-Type":"application\/json;charset=UTF-8"}}

 

 

without   Connection= "keep-alive"   data are received correctly.

But now the error function is called and there is another error message:

 

[DEBUG] 17:48:24: {"args":["Hallo, hier Sender um 17 : 48 : 24"]} 47
[DEBUG] 17:48:24: 2023-06-14 17:48:24.959364 [ debug] error reading from socket: End of file
[DEBUG] 17:48:24:
[DEBUG] 17:48:24: # Err: End of file

 

Who knows what to change or an additional option?

Thanks in advance

 

looks like timeout issue. You can increase the timeout or just ignore the error.

 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Hello,

     

    thanks for your proposal

     

    hopefully I changed from 5000 to 15000, but even with 500000 no change

     

    so I'll ignore

    Link to comment
    Share on other sites

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