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

Net.FHttp in a scene?


Question

Posted

I want to have an additional logfile witch I can fill from a sceen or vDevice.  I guess the easyest way is to pass the infos with a http request to a php-file on my on webserver. Correct me, if I am totally wrong.

 

In a vDevice the following LUA code works: 

Please login or register to see this code.

1) What do I have to change, that the code works in a sceen too?

I get this error message in a sceen: 

Please login or register to see this code.

2) How can I encode _event or _device so that I can use spaces (eg. _event = "Event happend at 2 am by xyz")?

With spaces my server (not Fibaro HC2) answers with a 400 error. 

6 answers to this question

Recommended Posts

  • 0
Posted

@Nine,

 

You can use Net.* only in virtual device, in scene you must use net.HTTPClient

 

For example:

Please login or register to see this code.

  • 0
Posted

Do you have any documentation how to use this with PUT, POST, JSON and others?

  • 0
Posted

Have a look here, most subjects are covered in this script: 

Please login or register to see this link.

  • 0
Posted

Thanks!

Please login or register to see this code.

I get nil. However I should get a number. Is there something wrong?

 

And why are there two timeouts?

  • 0
Posted

I think you are mixing GET and POST syntax here.. And "result" is not declared.. 

 

have a look at the documentation at: 

Please login or register to see this link.

  • 0
  • Inquirer
  • Posted (edited)

     

    For example:

    Please login or register to see this code.

     

    Ok, thx. Question 1 is answered with that

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

     

    But how can I send an url with spaces (e.g.

    Please login or register to see this link.

    Device No. 1&event=New event)? If I type this url in the browser, it works (and the browser replaces all spaces with %20). 

     

    How can I replace all spaces with %20 in a string in LUA? Found the answer by myself 

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

    Please login or register to see this code.

    Edited by Nine

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