Python Plugin: Reolink

Python and python framework

Moderator: leecollings

JBN
Posts: 33
Joined: Saturday 13 July 2013 8:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sweden
Contact:

Python Plugin: Reolink

Post by JBN »

After searching for a video doorbell for quite some time I finally settled for a Reolink Video Doorbell Wifi. There is a good Python module available to interact with the camera, reolink-aio, created by starkillerOG.

I have created a Domoticz plugin, Domoticz Reolink, to show information from the camera. When creating the plugin I used code and inspiration from Zigbee for Domoticz, mainly to learn more about using asyncio in Domoticz.

Install

Code: Select all

git clone https://github.com/j-b-n/domoticz_reolink
Update

Code: Select all

git pull
sudo python3 -m pip install -r requirements.txt --upgrade
Github

Domoticz Reolink - https://github.com/j-b-n/domoticz_reolink
Last edited by JBN on Sunday 28 January 2024 15:44, edited 1 time in total.
User avatar
Xenomes
Posts: 379
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Reolink

Post by Xenomes »

Nice! I had it sorted by using cam2mqtt and mqtt-mapper plugin, I will test you plugin and switch to it!
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
stack
Posts: 36
Joined: Friday 17 July 2020 15:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11794
Contact:

Re: Python Plugin: Reolink

Post by stack »

Is plugin working okay?
i will try it wth my coming reolink doorbell
JBN
Posts: 33
Joined: Saturday 13 July 2013 8:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sweden
Contact:

Re: Python Plugin: Reolink

Post by JBN »

I just tried it with the latest beta and latest reolink_aio and it seems to work.

But I am thinking about changing one of the behaviors. Currently I get a motion-signal "on" from the doorbell and immediately after an "off". It might be better to have the “on” for 30 seconds or something and then return to “off”.
marktn
Posts: 233
Joined: Tuesday 21 April 2015 21:39
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: Reolink

Post by marktn »

What to fill in here?
Attachments
firefox_2023-09-27_19-30-27.jpg
firefox_2023-09-27_19-30-27.jpg (18.47 KiB) Viewed 4596 times
Domoticz latest stable, Intel NUC, Proxmox, Zigate, RFLink, Kaku switches, Ikea lights, Xiaomi sensors, Honeywell smoke detectors, Yeelight, Shelly, Slave Domoticz PI 3B+, Node-Red, Espeasy.
JBN
Posts: 33
Joined: Saturday 13 July 2013 8:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sweden
Contact:

Re: Python Plugin: Reolink

Post by JBN »

I am sorry, the name is likely confusing. I'll look into that.

The webhook is created in the camera by the plugin. Thus the Webhook host is the (from the camera) reachable ip-address of the Domoticz server.

In my setup I use 10.0.0.* where my door camera is on 10.0.0.9 and my Domoticz server is 10.0.0.2 (the webhook host). Note that you cannot use 127.0.0.1 (since that is not reachable by the camera).
marktn
Posts: 233
Joined: Tuesday 21 April 2015 21:39
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: Reolink

Post by marktn »

Thanks for your support!

Do i need to change a setting in the doorbell? Because i have an error.

Webhook Host, is my domoticz IP, Webhook port is domoticz port.

Code: Select all

 2023-09-28 19:02:36.392 Status: Reolink deurbel: Started.
2023-09-28 19:02:36.392 Status: Reolink deurbel: Entering work loop.
2023-09-28 19:02:36.514 Error: Reolink deurbel: (Reolink) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/domoticz_reolink/:/usr/lib/python39.zip:/usr/lib/python3.9:/usr/lib/python3.9/lib-dynload:/usr/local/lib/python3.9/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.9/dist-packages'.
2023-09-28 19:02:36.514 Error: Reolink deurbel: Traceback (most recent call last):
2023-09-28 19:02:36.514 Error: Reolink deurbel: File "/home/pi/domoticz/plugins/domoticz_reolink/plugin.py", line 64, in <module>
2023-09-28 19:02:36.514 Error: Reolink deurbel: from reolink_aio.api import Host
2023-09-28 19:02:36.514 Error: Reolink deurbel: ModuleNotFoundError: No module named 'reolink_aio' 
Attachments
firefox_2023-09-28_18-57-46.jpg
firefox_2023-09-28_18-57-46.jpg (62.2 KiB) Viewed 4567 times
Domoticz latest stable, Intel NUC, Proxmox, Zigate, RFLink, Kaku switches, Ikea lights, Xiaomi sensors, Honeywell smoke detectors, Yeelight, Shelly, Slave Domoticz PI 3B+, Node-Red, Espeasy.
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: Reolink

Post by waltervl »

Seems that the python module reolink_aio is not installed or not installed correctly. Try to install with sudo.if you already had it installed.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
marktn
Posts: 233
Joined: Tuesday 21 April 2015 21:39
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: Reolink

Post by marktn »

waltervl wrote: Thursday 28 September 2023 19:28 Seems that the python module reolink_aio is not installed or not installed correctly. Try to install with sudo.if you already had it installed.
Did a sudo git pull. Error is still there.

Code: Select all

pi@domoticzVM:~/domoticz/plugins/domoticz_reolink$ sudo git pull
[sudo] wachtwoord voor pi:
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 3 (delta 2), reused 3 (delta 2), pack-reused 0
Unpacking objects: 100% (3/3), 313 bytes | 313.00 KiB/s, done.
From https://github.com/j-b-n/domoticz_reolink
   b7a0bd4..2b89c27  main       -> origin/main
Updating b7a0bd4..2b89c27
Fast-forward
 plugin.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Domoticz latest stable, Intel NUC, Proxmox, Zigate, RFLink, Kaku switches, Ikea lights, Xiaomi sensors, Honeywell smoke detectors, Yeelight, Shelly, Slave Domoticz PI 3B+, Node-Red, Espeasy.
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: Reolink

Post by waltervl »

When I go to the plugin repository there is a prerequisite mentioned for reolink_aio. That means you have to install it first before you can use the plugin.

So use command
pip3 install reolink-aio

If it still gives the same error use
sudo pip3 install reolink-aio
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
marktn
Posts: 233
Joined: Tuesday 21 April 2015 21:39
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: Reolink

Post by marktn »

waltervl wrote: Thursday 28 September 2023 19:58 When I go to the plugin repository there is a prerequisite mentioned for reolink_aio. That means you have to install it first before you can use the plugin.

So use command
pip3 install reolink-aio

If it still gives the same error use
sudo pip3 install reolink-aio
Yes, sudo pip3 install reolink-aio did it.
After install sudo service domoticz stop and start.


Only it is not working. Maybe settings are not okay in domoticz or doorbell?

I have 3 new devices, motion person, motion and doorbell.

Update: Domoticz stopped working. Restored backup, and removed the plugin.

Code: Select all

 2023-09-28 20:08:55.061 Reolink: Acquiring GIL for 'onHeartbeatCallback'
2023-09-28 20:08:55.061 Reolink: Calling message handler 'onHeartbeat' on 'module' type object.
2023-09-28 20:08:55.061 Reolink: camera_thread dead - restart!
2023-09-28 20:08:55.062 Reolink: Acquiring GIL for 'onHeartbeatCallback'
2023-09-28 20:09:25.044 Reolink: Pushing 'onHeartbeatCallback' on to queue
2023-09-28 20:09:25.094 Reolink: Processing 'onHeartbeatCallback' message
2023-09-28 20:09:25.094 Reolink: Acquiring GIL for 'onHeartbeatCallback'
2023-09-28 20:09:25.094 Reolink: Calling message handler 'onHeartbeat' on 'module' type object.
2023-09-28 20:09:25.094 Reolink: camera_thread dead - restart!
2023-09-28 20:09:25.094 Reolink: Acquiring GIL for 'onHeartbeatCallback'

Domoticz latest stable, Intel NUC, Proxmox, Zigate, RFLink, Kaku switches, Ikea lights, Xiaomi sensors, Honeywell smoke detectors, Yeelight, Shelly, Slave Domoticz PI 3B+, Node-Red, Espeasy.
JBN
Posts: 33
Joined: Saturday 13 July 2013 8:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sweden
Contact:

Re: Python Plugin: Reolink

Post by JBN »

I need to see if I can reproduce your error. I'll get back to you.
marktn
Posts: 233
Joined: Tuesday 21 April 2015 21:39
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: Reolink

Post by marktn »

JBN wrote: Thursday 28 September 2023 21:39 I need to see if I can reproduce your error. I'll get back to you.
Thanks! The settings under domoticz are okay? Any settings in the doorbell?
Domoticz latest stable, Intel NUC, Proxmox, Zigate, RFLink, Kaku switches, Ikea lights, Xiaomi sensors, Honeywell smoke detectors, Yeelight, Shelly, Slave Domoticz PI 3B+, Node-Red, Espeasy.
User avatar
dyter
Posts: 40
Joined: Thursday 08 February 2018 15:48
Target OS: NAS (Synology & others)
Domoticz version: 8841
Location: Lyon
Contact:

Re: Python Plugin: Reolink

Post by dyter »

For work on my setup, I need to mod this 3 lines in plugin.py:

Code: Select all

path = os.getcwd()+"/plugins/domoticz_reolink/camera.py"
self.process = subprocess.Popen(["python", path,
self.process = subprocess.Popen(["python", path,
to

Code: Select all

path = "/opt/domoticz/userdata/plugins/reolink/camera.py"
self.process = subprocess.Popen(["python3", path,
self.process = subprocess.Popen(["python3", path,
Work fine, but somes errors appair:
2024-01-07 05:10:45.174 Error: Reolink Parking: Failed to parse message from camera as XML! Length: 1381
2024-01-07 05:10:45.174 Error: Reolink Parking: Failed to parse message from camera as XML! Length: 1759
2024-01-07 11:45:10.557 Error: Reolink Jardin: Failed to parse message from camera as XML! Length: 2801
2024-01-07 11:45:10.558 Error: Reolink Jardin: Failed to parse message from camera as XML! Length: 4714
Domoticz v2024.1 on Synology Docker host, RFLink, ESPEasy wemos D1, Ecodevices, relays x8, dahua doorbell, reolink cameras ....
Rik60
Posts: 82
Joined: Sunday 25 June 2023 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: The Netherlands
Contact:

Re: Python Plugin: Reolink

Post by Rik60 »

Hi all,
I have installed the Reolink plugin, i am using a frontdoor videocamera connected via POE. The problem is dat the plugin is not making new devices.
First i had to modify plugin.py, line 134. I changed 127.0.0.1 in the ip adress of the domoticz pi. I left the port on 8989.
If i restart Domoticz the plugin starts without errors (i think) but it doesn't make new devices. What can be the problem?
Attachments
Reolink_settings_domoticz.jpg
Reolink_settings_domoticz.jpg (25.19 KiB) Viewed 2189 times
Reolink_plugin_py.png
Reolink_plugin_py.png (11.32 KiB) Viewed 2189 times
Reolink_domoticz_log_1.png
Reolink_domoticz_log_1.png (58.11 KiB) Viewed 2189 times
Rik60
Posts: 82
Joined: Sunday 25 June 2023 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: The Netherlands
Contact:

Re: Python Plugin: Reolink

Post by Rik60 »

Reolink_domoticz_log_2.png
Reolink_domoticz_log_2.png (37.53 KiB) Viewed 2186 times
Reolink_domoticz_log_3.png
Reolink_domoticz_log_3.png (50.32 KiB) Viewed 2186 times
User avatar
dyter
Posts: 40
Joined: Thursday 08 February 2018 15:48
Target OS: NAS (Synology & others)
Domoticz version: 8841
Location: Lyon
Contact:

Re: Python Plugin: Reolink

Post by dyter »

You need accept new devices in setup of domoticz
Domoticz v2024.1 on Synology Docker host, RFLink, ESPEasy wemos D1, Ecodevices, relays x8, dahua doorbell, reolink cameras ....
Rik60
Posts: 82
Joined: Sunday 25 June 2023 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: The Netherlands
Contact:

Re: Python Plugin: Reolink

Post by Rik60 »

dyter wrote: Saturday 27 January 2024 18:13 You need accept new devices in setup of domoticz
Thanks.
I tried, accept new devices (was already set green but still pushed the button for 5 minutes) did not help. In this 5 minutes i restarted the plugin also. No succes....
JBN
Posts: 33
Joined: Saturday 13 July 2013 8:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sweden
Contact:

Re: Python Plugin: Reolink

Post by JBN »

In the latest version of the plugin (do an update) I have changed to python3 and changed from 127.0.0.1 to self.webhook_host.

@Rik60 - You should find the devices under the Devices tab. If Domoticz can not create the devices the error message is "Unit creation failed, Domoticz settings prevent accepting new devices."

The logs you have posted is the complete log from the plugin?

You should see something like this:
2024-01-28 15:37:34.254 Reo: Worker thread started.
2024-01-28 15:37:34.254 Status: Reo: Entering work loop.
2024-01-28 15:37:34.255 Status: Reo: Started.
2024-01-28 15:37:34.662 Status: Reo: Initialized version 0.0.2, author 'jbn'
2024-01-28 15:37:41.592 Reo: Camera Name : Doorbell
2024-01-28 15:37:41.593 Reo: Camera Model : Reolink Video Doorbell WiFi
2024-01-28 15:37:41.593 Reo: Camera Hardware version : DB_566128M5MP_W
2024-01-28 15:37:41.593 Reo: Camera Software version : v3.0.0.2555_23080700
2024-01-28 15:37:41.593 Reo: Camera Mac_address : ##############
2024-01-28 15:37:41.593 Reo: Camera Is doorbell : True
2024-01-28 15:37:41.593 Reo: Camera AI supported : True
2024-01-28 15:37:41.593 Reo: Camera AI types : ['people']
Rik60
Posts: 82
Joined: Sunday 25 June 2023 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: The Netherlands
Contact:

Re: Python Plugin: Reolink

Post by Rik60 »

JBN wrote: Sunday 28 January 2024 15:40 In the latest version of the plugin (do an update) I have changed to python3 and changed from 127.0.0.1 to self.webhook_host.

@Rik60 - You should find the devices under the Devices tab. If Domoticz can not create the devices the error message is "Unit creation failed, Domoticz settings prevent accepting new devices."

The logs you have posted is the complete log from the plugin?

You should see something like this:
2024-01-28 15:37:34.254 Reo: Worker thread started.
2024-01-28 15:37:34.254 Status: Reo: Entering work loop.
2024-01-28 15:37:34.255 Status: Reo: Started.
2024-01-28 15:37:34.662 Status: Reo: Initialized version 0.0.2, author 'jbn'
2024-01-28 15:37:41.592 Reo: Camera Name : Doorbell
2024-01-28 15:37:41.593 Reo: Camera Model : Reolink Video Doorbell WiFi
2024-01-28 15:37:41.593 Reo: Camera Hardware version : DB_566128M5MP_W
2024-01-28 15:37:41.593 Reo: Camera Software version : v3.0.0.2555_23080700
2024-01-28 15:37:41.593 Reo: Camera Mac_address : ##############
2024-01-28 15:37:41.593 Reo: Camera Is doorbell : True
2024-01-28 15:37:41.593 Reo: Camera AI supported : True
2024-01-28 15:37:41.593 Reo: Camera AI types : ['people']
Thanks.
I have update the plugin and changed some setting in the camera. It seems to work now, there is one device created, a motion sensor (switch). How many devices should be created, just one or 1 switch motion (motion), 1 switch motion (person) and 1 switch doorbell?
Thanks for your help
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest