Coder Social home page Coder Social logo

doorbirdpy's Introduction

Moved to https://gitlab.com/klikini/doorbirdpy


doorbirdpy

Python wrapper for the DoorBird LAN API v0.21

Features

DoorBird API Documentation

Note that no image data is handled by this wrapper; it only returns the URLs to access images and streams. It was designed this way so that the fetching of images could be handled by the client application and so that this library would not have so many dependencies.

Supported

  • Live video request
  • Live image request
  • Open door/other relays
  • Light on
  • History image requests
  • Schedule requests
  • Favorites requests
  • Check request
  • Info request
  • RTSP

Not yet supported

  • Monitor request
  • Live audio transmit
  • Live audio receive
  • SIP

doorbirdpy's People

Contributors

alandtse avatar klikini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

alandtse bonze255

doorbirdpy's Issues

History image broken due to new mandatory event param

Requesting a history image is broken, probably due to a DoorBird firmware upgrade.

Although the api manual states that the history.cgi event param is not mandatory, it however seems like it is!

Test without event param:

➜  ~ curl -u user0001:passwd -v http://192.168.1.9/bha-api/history.cgi\?index\=1
*   Trying 192.168.1.9...
* TCP_NODELAY set
* Connected to 192.168.1.9 (192.168.1.9) port 80 (#0)
* Server auth using Basic with user 'user0001'
> GET /bha-api/history.cgi?index=1 HTTP/1.1
> Host: 192.168.1.9
> Authorization: Basic #hash
> User-Agent: curl/7.50.3
> Accept: */*
>
< HTTP/1.1 204 No Content
< Content-Type: text/plain
< Date: Thu, 28 Dec 2017 19:27:31 GMT
< Server: lighttpd/1.4.45
<
* Curl_http_done: called premature == 0
* Connection #0 to host 192.168.1.9 left intact

Test with event param:

➜  ~ curl -u user0001:passwd -v http://192.168.1.9/bha-api/history.cgi\?index\=1\&event\=doorbell
*   Trying 192.168.1.9...
* TCP_NODELAY set
* Connected to 192.168.1.9 (192.168.1.9) port 80 (#0)
* Server auth using Basic with user 'user0001'
> GET /bha-api/history.cgi?index=1&event=doorbell HTTP/1.1
> Host: 192.168.1.9
> Authorization: Basic #hash
> User-Agent: curl/7.50.3
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: image/jpeg
< Content-Length: 30867
< X-Timestamp: 1514398891
< X-Count: 35
< Date: Thu, 28 Dec 2017 19:33:06 GMT
< Server: lighttpd/1.4.45
<
* Curl_http_done: called premature == 0
* Connection #0 to host 192.168.1.9 left intact

TypeError: the JSON object must be str, not 'bytes'

In my homeassistant environment running python 3.4, doorbirdpy returns a TypeError when json.loads:

Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/doorbirdpy/__init__.py", line 35, in ready
    code = json.loads(content)["BHA"]["RETURNCODE"]
  File "/usr/lib/python3.4/json/__init__.py", line 312, in loads
    s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'

This appears to be related to content requiring decoding of UTF-8.

The solution appears to be to replace every instance of:
json.loads(content) with
json.loads(content.decode('utf-8'))

Monitoring relay trigger?

Is there any way to monitor or check wether a relay was triggered through the API, I'm only able to find ways to trigger it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.