5 hours ago
Try this. Event script mapped to a binary object. Change url, systemID and zoneID as needed:
Code:
require('json')
http = require('socket.http')
url = 'http://192.168.1.111:3000/api/v1/hvac'
on = event.getvalue() and 1 or 0
data = json.encode({
data = {
systemID = 1,
zoneID = 1,
on = on,
}
})
resp, code = http.request({
url = url,
method = 'PUT',
body = data,
headers = {
['Content-Type'] = 'application/json',
}
})
log(resp, code)