Reolink NVR/cameras API package
Project description
Reolink NVR/cameras API package
The reolink_aio
Python package allows you to integrate your Reolink devices (NVR/cameras) in your application.
Description
This is a package implementing Reolink IP NVR and camera API. Also it’s providing a way to subscribe to Reolink ONVIF SWN events, so that real-time events can be received on a webhook.
Show your appreciation
If you appreciate the reolink integration and want to support its development, please consider sponsering the upstream library or purchase Reolink products through this affiliate link.
Prerequisites
- Python 3.10
Installation
pip3 install reolink-aio
or manually:
git clone https://github.com/StarkillerOG/reolink_aio
cd reolink_aio/
pip3 install .
Usage
from reolink_aio.api import Host
import asyncio
# Create a host-object (representing either a camera, or NVR with several channels)
host = Host('192.168.1.10', 80, 'user', 'mypassword')
# Obtain/cache NVR or camera settings and capabilities, like model name, ports, HDD size, etc:
await host.get_host_data()
# Get the subscribtion port and host-device name:
subscribtion_port = host.onvif_port
name = host.nvr_name
# Obtain/cache states of features:
await host.get_states()
# Print some state value on the channel with index 0:
print(host.ir_enabled(0))
# Enable the infrared lights on the channel with index 1:
await host.set_ir_lights(1, True)
# Enable the spotlight on the channel with index 1:
await host.set_spotlight(1, True)
# Enable the siren on the channel with index 0:
await host.set_siren(0, True)
# Now subscribe to events, suppose our webhook url is http://192.168.1.11/webhook123
await host.subscribe('http://192.168.1.11/webhook123')
# After some minutes check the renew timer (keep the eventing alive):
if (host.renewTimer <= 100):
await host.renew()
# Logout and disconnect
await host.disconnect()
Example
This is an example of the usage of the API. In this case we want to retrive and print the Mac Address of the NVR.
from reolink_aio.api import Host
import asyncio
async def print_mac_address():
# initialize the host
host = Host('192.168.1.109','admin', 'admin1234', port=80)
# connect and obtain/cache device settings and capabilities
await host.get_host_data()
# check if it is a camera or an NVR
print("It is an NVR: %s, number of channels: %s", host.is_nvr, host.num_channels)
# print mac address
print(host.mac_address)
# close the device connection
await host.logout()
if __name__ == "__main__":
asyncio.run(print_mac_address())
Acknowledgment
This library is based on the work of:
- fwestenberg: https://github.com/fwestenberg/reolink_dev
Author
@starkillerOG: https://github.com/starkillerOG
Contributors
- @xannor: https://github.com/xannor
- @mnpg: https://github.com/mnpg
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file reolink_aio-0.9.10.tar.gz
.
File metadata
- Download URL: reolink_aio-0.9.10.tar.gz
- Upload date:
- Size: 60.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4f3453da175793feff51d1e73d8dd4aa8a094549e7c49a17dcc28b61d431701 |
|
MD5 | f9c41c787d1f448a6ed81fb53fa7b69d |
|
BLAKE2b-256 | 1d2e18b951f866b2292987a21d05f7460cbc6ca6ef3c2533a09d0af20526184c |
File details
Details for the file reolink_aio-0.9.10-py3-none-any.whl
.
File metadata
- Download URL: reolink_aio-0.9.10-py3-none-any.whl
- Upload date:
- Size: 58.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 837075feb94e9992539277ce2d4f78e93ce23e56907154c9df843a6be3ae2a8a |
|
MD5 | 067941a9ea99446e82de89ffd386a810 |
|
BLAKE2b-256 | 8be8f2df6f66931aa1c7fbce8005347a52c10ab5dff2e6cad7d17f2bc3254ec0 |