Giter Site home page Giter Site logo

reolinkapigo's Introduction

Reolink Python Api Client

Reolink Approval GitHub GitHub tag (latest SemVer) PyPI Discord


A Reolink Camera client written in Python. This repository's purpose (with Reolink's full support) is to deliver a complete API for the Reolink Cameras, although they have a basic API document - it does not satisfy the need for extensive camera communication.

Check out our documentation for more information on how to use the software at https://reolink.oleaintueri.com

Other Supported Languages:

Join us on Discord

https://discord.gg/8z3fdAmZJP

Sponsorship

Oleaintueri is sponsoring the development and maintenance of these projects within their organisation.


Get started

Implement a "Camera" object by passing it an IP address, Username and Password. By instantiating the object, it will try retrieve a login token from the Reolink Camera. This token is necessary to interact with the Camera using other commands.

See the examples directory.

Using the library as a Python Module

Install the package via PyPi

pip install reolinkapi

Install from GitHub

pip install git+https://github.com/ReolinkCameraAPI/reolinkapipy.git

If you want to include the video streaming functionality you need to include the streaming "extra" dependencies

pip install 'reolinkapi[streaming]'

Contributors


Styling and Standards

This project intends to stick with PEP8

How can I become a contributor?

Step 1

Get the Restful API calls by looking through the HTTP Requests made in the camera's web UI. I use Google Chrome developer mode (ctr + shift + i) -> Network.

Step 2

  • Fork the repository
  • pip install -r requirements.txt
  • Make your changes

Step 3

Make a pull request.

API Requests Implementation Plan:

Stream:

  • Blocking RTSP stream
  • Non-Blocking RTSP stream

GET:

  • Login
  • Logout
  • Display -> OSD
  • Recording -> Encode (Clear and Fluent Stream)
  • Recording -> Advance (Scheduling)
  • Network -> General
  • Network -> Advanced
  • Network -> DDNS
  • Network -> NTP
  • Network -> E-mail
  • Network -> FTP
  • Network -> Push
  • Network -> WIFI
  • Alarm -> Motion
  • System -> General
  • System -> DST
  • System -> Information
  • System -> Maintenance
  • System -> Performance
  • System -> Reboot
  • User -> Online User
  • User -> Add User
  • User -> Manage User
  • Device -> HDD/SD Card
  • PTZ -> Presets, Calibration Status
  • Zoom
  • Focus
  • Image (Brightness, Contrast, Saturation, Hue, Sharp, Mirror, Rotate)
  • Advanced Image (Anti-flicker, Exposure, White Balance, DayNight, Backlight, LED light, 3D-NR)
  • Image Data -> "Snap" Frame from Video Stream

SET:

  • Display -> OSD
  • Recording -> Encode (Clear and Fluent Stream)
  • Recording -> Advance (Scheduling)
  • Network -> General
  • Network -> Advanced
  • Network -> DDNS
  • Network -> NTP
  • Network -> E-mail
  • Network -> FTP
  • Network -> Push
  • Network -> WIFI
  • Alarm -> Motion
  • System -> General
  • System -> DST
  • System -> Reboot
  • User -> Online User
  • User -> Add User
  • User -> Manage User
  • Device -> HDD/SD Card (Format)
  • PTZ (including calibrate)
  • Zoom
  • Focus
  • Image (Brightness, Contrast, Saturation, Hue, Sharp, Mirror, Rotate)
  • Advanced Image (Anti-flicker, Exposure, White Balance, DayNight, Backlight, LED light, 3D-NR)

Supported Cameras

Any Reolink camera that has a web UI should work. The other's requiring special Reolink clients do not work and is not supported here.

  • RLC-411WS
  • RLC-423
  • RLC-420-5MP
  • RLC-410-5MP
  • RLC-510A
  • RLC-520
  • C1-Pro
  • D400
  • E1 Zoom

reolinkapigo's People

Contributors

benehiko avatar brimstedt avatar dhlin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

reolinkapigo's Issues

Login Bug

Bug was caused by auth = false in Request function within RestHandler.
auth is now completely removed due to Login also requiring query parameters to be set even though token is empty.

RTSP on incorrect stream Crashes application

When the RTSP stream is not of the correct encoding the following error happens:

Fix Format may be raw PCM 97 96

This crashes the whole application instead of just returning the error to be handled correctly.
Gracefully return error instead of crashing application.

ImageSettings (image_mixin) enums do not contain all setting options

The ImageSettings have quite a range of options that could be set, however I could not create all the enums for each setting due to not having the range values.

For example:

ok, err := camera.API.SetAdvanceImageSettings(
	api.ImageAdvancedOptionDayNight(enum.DAY_NIGHT_AUTO),
	api.ImageAdvancedOptionBacklight(enum.DYNAMIC_RANGE_CONTROL),
	api.ImageAdvancedOptionBlc(1),
	)(camera.RestHandler)

The enum.DAY_NIGHT_AUTO is the only option I can set currently on DayNight switching due to not knowing the full range.

There are a couple of other enums that have the same problem. will create separate issues for them as well.

Errors unmarshalling device info

When querying an RLC-820A on the latest firmware the response from the camera is that the wifi is 0 and not a boolean false

I have written a fairly ugly function to manage this here - https://github.com/parkervcp/reolinkapigo/blob/update_deviceinfo/internal/pkg/models/system.go#L53

I am not saying it's "the" fix to use but it is "a" fix that works right now. It handles both the int and bool values and errors on any other value.

example data from my camera

{
            "B485" : 0,
            "IOInputNum" : 0,
            "IOOutputNum" : 0,
            "audioNum" : 1,
            "buildDay" : "build 21073001",
            "cfgVer" : "v3.0.0.0",
            "channelNum" : 1,
            "detail" : "IPC_523128M8MPS18E1W01100000001",
            "diskNum" : 1,
            "firmVer" : "v3.0.0.494_21073001",
            "frameworkVer" : 1,
            "hardVer" : "IPC_523128M8MP",
            "model" : "RLC-820A",
            "name" : "Camera1",
            "pakSuffix" : "pak,paks",
            "serial" : "00000000HEIGSDH",
            "type" : "IPC",
            "wifi" : 0
}

example code:

	cam, err := reolink.NewCamera("admin", "", "192.168.10.106")
	if err != nil {
		log.Errorln(err)
	}

	_, err = cam.Login()(cam.RestHandler)
	if err != nil {
		log.Errorln(err)
	}

	camInfo, err := cam.GetDeviceInformation()(cam.RestHandler)
	if err != nil {
		log.Errorln(err)
	}

	log.Printf("%v", camInfo.Name)

error:

2021/11/06 23:20:33 token data unmarshalled &{60d05f1bfa4516b 3600}
2021/11/06 23:20:34 token data unmarshalled &{b1ab49e8c6d468c 3600}
ERRO[0000] json: cannot unmarshal number into Go struct field DeviceInformation.wifi of type bool 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x90 pc=0x6432f9]

goroutine 1 [running]:
main.main()
        /home/nvr/test/vnCT5zWjiz/test.go:48 +0x179

NetworkMixin response example data missing

Response example data for GetWifi and ScanWifi is missing.

Currently

wifiInfo, err := camera.API.GetWifi()(camera.RestHandler)

scanWifiInfo, err := camera.API.ScanWifi()(camera.RestHandler)

will return nothing due to the struct being empty.

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.