Using http rest api to control my AC

Hello everyone,
Im quite new to Vera, and I just got started with some modules.
Im familiar with scripting and programming but couldnt find much resources about Lua/Luup.
I have a home wifi remoted controled air conditioner, accepting commands over local network like POST http://ip:port/api/temp, with body {room: “living room”, temp: 24}

Im trying to figure out how to integrate it with Vera.
I have vera integrated also with ha-bridge, for Alexa voice commands, so It would be nice to be able to say
“Turn on air condition for room X” → set some temp on that room
“Dim the air condition for room X” → set a higher temp or lower fan
“Turn off…” → …

Although it seems quite easy for ha-bridge, I want to have those sort of virtual buttons also in my Vera, so I can do it from the app and have scenes that can run this as a device operation.
Can someone please guide me about this?

Something like this might get you started. Change the path and payload as needed.[code]local http = require(“socket.http”)
local ltn12 = require(“ltn12”)
local path = “http://192.168.1.203/tstat
local payload = [[ {“t_mode”:1,“t_heat”:61} ]]

local response_body = { }
local res, code, response_headers, status = http.request
{
url = path,
method = “POST”,
headers =
{
[“Content-Type”] = “application/json”,
[“Content-Length”] = payload:len()
},
source = ltn12.source.string(payload),
sink = ltn12.sink.table(response_body)
}[/code]
I think you can add a timeout for this. Might want to search for it. Also, you may want to turn this into a function. I think I have that somewhere, but the above should work and it isn’t that much code.

Thanks!
Took me some time to get it working.
I even hooked it as a global function and use it with Virtual switch.
Is it possible to get a more extended switch, similar to the roller shutter control, that allows also temperature set?