not abuse, let say .. benefit too much from your time
please find the code from the LUA script
Code: Select all
DEVIDX=7180
weburl='http://www.laghi.net/homepage.aspx?tab=3&subtab=2&idlago=3'
domurl='http://192.168.1.102:8080/json.htm?type=command¶m=udevice&idx=' .. DEVIDX .. '&nvalue=0&svalue='
-- retrieve web info
local http = require "socket.http";
-- Get info from website
commandArray={}
domurl='http://192.168.1.102:8080/json.htm?type=command¶m=udevice&idx=7180&nvalue=0&svalue='
response, status = http.request(weburl)
-- Get level from info
response=response:match('Quota invaso.-<td class="col_right">(.-)</td>')
print(response)
-- update text device IDX
-- Trial to insert a predefined value(500) :
response, status = http.request('http://192.168.1.102:8080/json.htm?type=command¶m=udevice&idx=7180&nvalue=0&svalue=500')
print(status,response)
return commandArray
from the log, I have this comment :
LUA: <html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html
but, when I' typing directly into my web browser "
http://192.168.1.102:8080/json.htm?type ... svalue=500", the right value (500) is displayed on the device !
The device to be updated is a custom sensor.
Many thanks for your help
Seb