Reolink NVR/cameras API包
项目描述
Reolink NVR/cameras API包
《reolink_aio》Python包允许您将您的Reolink设备(NVR/摄像头)集成到您的应用程序中。
描述
这是一个实现Reolink IP NVR和摄像头API的包。它还提供了一个订阅Reolink ONVIF SWN事件的方式,以便可以通过webhook接收实时事件。
表达您的感激之情
如果您欣赏Reolink集成并希望支持其开发,请考虑赞助上游库或通过此联盟链接购买Reolink产品。
先决条件
- Python 3.10
安装
pip3 install reolink-aio
或手动
git clone https://github.com/StarkillerOG/reolink_aio
cd reolink_aio/
pip3 install .
用法
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()
示例
这是API使用的示例。在这种情况下,我们想要检索并打印NVR的MAC地址。
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())
致谢
这个库是基于以下工作的
- fwestenberg: https://github.com/fwestenberg/reolink_dev
作者
@starkillerOG: https://github.com/starkillerOG
贡献者
- @xannor: https://github.com/xannor
- @mnpg: https://github.com/mnpg
项目详情
下载文件
下载适用于您平台的文件。如果您不确定该选择哪个,请了解更多关于 安装包 的信息。
源代码分发
reolink_aio-0.9.11.tar.gz (60.3 kB 查看哈希值)
构建分发
reolink_aio-0.9.11-py3-none-any.whl (58.5 kB 查看哈希值)
关闭
reolink_aio-0.9.11.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | a665eb7cd53799d8608f7202631a85d667b6aa5d149116687ed3a73b35ccf75b |
|
MD5 | 4abf380bd9d830c09ef0c6ac0d9ebb0c |
|
BLAKE2b-256 | d1540d05d6b0f86842b90877800f7f60df0b21f76dd0c31ae8f96762a5febc90 |
关闭
reolink_aio-0.9.11-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | cb16b69a145fdab33373b926dcd6b9302c9a6b41d65099a5c2caf1ff341e499e |
|
MD5 | 56499073c876af9a3f8e2c3b63babcb7 |
|
BLAKE2b-256 | 095a435057f00b2bc9f9b93817dc08ce04fe653dc2a587ae68f6005a2d5cbee5 |