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.

Doorbird API
#4
Try this resident script (sleep time = 0), change USER and PASS to your auth data. It will log all incoming data (log(line)). This is to check if there are any errors during communication. If everything is working then comment/delete this line.

Code:
if not sock then
  host = '192.168.100.211'
  port = 80
  path = '/bha-api/monitor.cgi?ring=doorbell,motionsensor&http-user=USER&http-password=PASS'

  sock = require('socket').tcp()
  sock:settimeout(10)
  res, err = sock:connect(host, port)

  if res then
    sock:send(
      'GET ' .. path .. ' HTTP/1.1\r\n' ..
      'Host: ' .. host .. '\r\n\r\n'
    )
  else
    alert('connect failed: ' .. tostring(err))
    sock:close()
    sock = nil
    os.sleep(5)
  end
end

line, err = sock:receive()

if line then
  log(line)

  if line:find('doorbell:') then
    status = line:split(':')[2]
    log('doorbell', line)
  elseif line:find('motionsensor:') then
    status = line:split(':')[2]
    log('motionsensor', status)
  end
else
  alert('receive failed: ' .. tostring(err))
  sock:close()
  sock = nil
end
Reply


Messages In This Thread
Doorbird API - by MantasJ - 10.03.2020, 15:12
RE: Doorbird API - by admin - 10.03.2020, 15:42
RE: Doorbird API - by MantasJ - 10.03.2020, 20:37
RE: Doorbird API - by admin - 11.03.2020, 06:59
RE: Doorbird API - by MantasJ - 11.03.2020, 08:17
RE: Doorbird API - by felixRo - 10.10.2022, 13:48
RE: Doorbird API - by admin - 11.03.2020, 08:57
RE: Doorbird API - by MantasJ - 11.03.2020, 09:17
RE: Doorbird API - by Firechief - 03.07.2020, 17:45
RE: Doorbird API - by Firechief - 13.07.2020, 12:47
RE: Doorbird API - by admin - 13.07.2020, 12:49
RE: Doorbird API - by Firechief - 13.07.2020, 14:21
RE: Doorbird API - by admin - 13.07.2020, 14:28
RE: Doorbird API - by Firechief - 13.07.2020, 14:34
RE: Doorbird API - by admin - 11.10.2022, 09:25

Forum Jump: