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

Http from Scene


Dman568

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

Link to comment
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

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