Jump to content
Guides for the Forum Read more... ×
Poradniki na Forum Read more... ×
  • 0
Dman568

Http from Scene

Question

Hi All


I have setup my aircon to be controlled via a virtual device over IP and it is working well, I am now creating scenes to do certain things. One of the things i want to do is set a certain temperature with certain scenes in the right conditions. This is the code for the virtual device to change the temp down, this works well

 

local selfId = fibaro:getSelfId()
local selfIp = fibaro:get(selfId, "IPAddress")
local selfPort = fibaro:get(selfId, "TCPPort")

local TempDec = tonumber(fibaro:getValue(237, "ui.Temp.value")) - 1


local aircon= Net.FHttp(selfIp,selfPort)
response,status,errorCode = aircon:GET('/setAircon?json={"ac1":{"info":{"order":0,"setTemp":'.. TempDec.. '.0},"zones":{}}}')

 

If I type IPAddress:Port//setAircon?json={"ac1":{"info":{"order":0,"setTemp":23.0},"zones":{}}} into a web browser it will set the temp to 23, the question is what code do i use in a LUA scene to send this to the aircon

 

Any help appreciated

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi,

I found this here on the forum and use it for my heating

    --aanroepen http request:


local http = net.HTTPClient()

function call(url)
  http:request(url, {
      options = { method = 'GET' },
      success =function() fibaro:debug(url.." ,done.") end,
      error = function(errorcode) fibaro:debug("error=" .. errorcode) end
    })
end


call("http://192.168.1.101/data.json?heater=0&setpoint=169&thermostat=0") -- fill in your own IP

 

 

succes

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×