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

New HTTP POST method on 4.082 ?


Question

Posted

Hello, since 4.082 firmware no longer working "Net.FHttp" method to send HTTP request..((

And lot's of network scripts are not working now too.

 

Here is an example to change Fibaro Wall Plug color (

Please login or register to see this link.

):

 

Please login or register to see this code.

 

 

 

 

so, i have found new solution to send HTTP GET from HC2 scene, could someone also provide http POST method example?

6 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • Posted

    as i said, there was an error in what you did, you have used lua script made for VD (Net) in a scene, that will not work.

     

    yes, it's my false, thanks! here is a working VD code and virtual device in attachement to switch wall plug colors (put wall plug id to TCP port if virtual device)

    Please login or register to see this code.

    is there any documentation for VD NET methods?

    Please login or register to see this link.

    • 0
    Posted

    Please login or register to see this code.

    function postMethod(data)

    payload = "action=create&description="..data

    local http = net.HTTPClient()

    http:request("http://127.0.0.1:11111/api/settings/backups", {

    options = {

    method = 'POST',

    headers = {},

    data = payload,

    timeout = 70000

    },

    success = function(status)

    fibaro:debug(status)

    local result = status.data;

    if result.status ~= 1 then

    print("failed");

    print(status.data);

    end

    end,

    error = function(err)

    print('[ERROR] ' .. err)

    end

    })

    end

    • 0
    Posted

    Hello, since 4.082 firmware no longer working "Net.FHttp" method to send HTTP request

     

    there must me something wrong in your setup, there are no issues with Net.FHttp and v4.082

    • 0
  • Inquirer
  • Posted

    there must me something wrong in your setup, there are no issues with Net.FHttp and v4.082

     

    there is an error 

    [DEBUG] 00:51:12: line 13: attempt to index global 'Net' (a nil value)

    • 0
  • Inquirer
  • Posted

    ...

     

    thanks a lot! here is a working example with PUT method to change Fibaro Wall plug ring color:

     

    Please login or register to see this code.

    • 0
    Posted

    as i said, there was an error in what you did, you have used lua script made for VD (Net) in a scene, that will not work.

    Guest
    This topic is now closed to further replies.
    ×
    ×
    • Create New...