Hi again.
I tried to use a variable (Percent) inside the Json expression in the "body". This does not work. Any tips on how to do this?
I tried to use a variable (Percent) inside the Json expression in the "body". This does not work. Any tips on how to do this?
Code:
Percent = event.getvalue ()
http = require('socket.http')
ltn12 = require('ltn12')
--body = '{"lift":100}'
body = '{"lift":Percent}'
res, code = http.request({
url = 'http://192.168.1.80:40850/api/8EBFA5778F/lights/2/state/',
method = 'PUT',
headers = {
['Content-Length'] = #body,
},
source = ltn12.source.string(body)
})
log(res, code)
BR
Kai-Roger
Kai-Roger