05.07.2016, 05:58
There's a similar script which uses HTTP for communication:
http://forum.logicmachine.net/showthread.php?tid=320
Example for your AC system:
http://forum.logicmachine.net/showthread.php?tid=320
Example for your AC system:
Code:
function parse(txt)
local chunks, key, value, result
chunks = txt:split(',')
result = {}
for _, chunk in ipairs(chunks) do
key, value = unpack(chunk:split('='))
result[ key ] = value
end
return result
end
ip = '192.168.1.1'
http = require('socket.http')
url = 'http://' .. ip .. '/aircon/get_sensor_info?'
result, err = http.request(url)
if result then
data = parse(result)
-- log(data)
grp.update('1/1/1', data.otemp)
else
alert('HTTP request failed: ' .. tostring(err))
end