Thinking like this, dount work for me any more
Posted on
Wed May 23, 2018 10:26 am
berkinet offline
User avatar
Posts: 3043
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France
Re: DoorBird Review
kidney wrote:
ok because, I'm always getting this error message "Basic Authentication Required" when I try the first instruction and the log show this also
Code: Select all
HTTPd Debug AuthHandler: GET from 10.0.1.6:56758 for /setvar?doorbird=pressed
HTTPd Debug AuthHandler: Request has no Authorization header
Check the URL you entered in the doorbird HTTP Calls config. It should be just the address of your Indigo server and a path. Eg.
Code: Select all
http://192.168.1.2:18009/motionsensorI made a couple of minor edits to the script posted by NeilK. You might give this version a try if you are still having problems after verifying the doorbird config.
Code: Select all
# by Karl Wachs
# July 16
# modified for DoorBird by NeilK
# Minor changes and edits by Berkinet
##
import os
import indigo # just to supress lint errors
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
PORT = 18009 # port number to be used by DoorBird on IndigoServer to GET url's defined in the API
actionMotion = xxxxx # ID of Action Group to run when DoorBird motion sensor is triggered
actionOpen = xxxxx # ID of Action Group to run when the open button in the app is pressed
actionBell = xxxxx # ID of Action Group to run on the Doorbell rings.
# See DoorBird API at
www.doorbird.com/api to set the URL to get based on the action for /motion.html , /doorbell.html , /button.html
# For example:
http://192.168.1.10/bha-api/notificatio ... ubscribe=1class S(BaseHTTPRequestHandler):
def _set_headers(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
def do_GET(self):
self._set_headers()
self.wfile.write("<html><body><h1>Indigo DoorBird Forwarding</h1>"+str(self.path)+"</body>")
if self.path == "/motionsensor":
indigo.server.log("DoorBird sent motion command", type="DoorBird")
indigo.actionGroup.execute(actionMotion)
if self.path == "/dooropen":
indigo.server.log("DoorBird sent Button command", type="DoorBird")
indigo.actionGroup.execute(actionOpen)
if self.path == "/doorbell":
indigo.server.log("DoorBird sent doorbell command", type="DoorBird")
indigo.actionGroup.execute(actionBell)
def do_HEAD(self):
self._set_headers()
def do_POST(self):
# Doesn't do anything with posted data
self._set_headers()
self.wfile.write("<html><body><h1>POST!</h1></body></html>")
def run(server_class=HTTPServer, handler_class=S, port=PORT):
server_address = ('', port)
httpd = server_class(server_address, handler_class)
indigo.server.log("Starting DoorBird httpd..."+"Port...."+str(PORT), type="DoorBird")
httpd.serve_forever()
if __name__ == "__main__":
myPID = str(os.getpid())
indigo.server.log("PID of DoorBird server is:" + myPID, type="DoorBird")
run()