This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Siegenia AEROPAC
#7
(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..  Big Grin
Reply


Messages In This Thread
Siegenia AEROPAC - by gjniewenhuijse - 04.10.2019, 12:43
RE: Siegenia AEROPAC - by admin - 04.10.2019, 13:18
RE: Siegenia AEROPAC - by gjniewenhuijse - 29.10.2019, 15:17
RE: Siegenia AEROPAC - by gjniewenhuijse - 30.10.2019, 09:47
RE: Siegenia AEROPAC - by admin - 30.10.2019, 12:51
RE: Siegenia AEROPAC - by admin - 30.10.2019, 14:40
RE: Siegenia AEROPAC - by gjniewenhuijse - 30.10.2019, 14:50

Forum Jump: