30.10.2019, 14:50
(30.10.2019, 14:40)admin Wrote: There's missing id parameter in my example. Use this helper function to send requests:
Code:function send(data) reqid = (reqid or 0) + 1 data.id = reqid data = json.encode(data) return client:send(data) end send({ command = 'login', user = iUsr, password = iPwd, long_life = false, }) send({ command = 'setDeviceParams', params = { devicestate = { deviceactive = false }, fanlevel = 0, -- 0..7 } }) send({ command = 'logout' })
If you want to keep the connection open then you should send keep-alive every 10 seconds or so:
Code:send({ command = 'keepAlive', param = { extend_session = true } })
Many thanks, it works great..