Page 1 of 2

Python Plugin: Reolink

Posted: Monday 10 July 2023 22:00
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

Re: Python Plugin: Reolink

Posted: Tuesday 11 July 2023 20:54
by Xenomes
Nice! I had it sorted by using cam2mqtt and mqtt-mapper plugin, I will test you plugin and switch to it!

Re: Python Plugin: Reolink

Posted: Saturday 23 September 2023 10:25
by stack
Is plugin working okay?
i will try it wth my coming reolink doorbell

Re: Python Plugin: Reolink

Posted: Saturday 23 September 2023 16:13
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”.

Re: Python Plugin: Reolink

Posted: Wednesday 27 September 2023 19:11
by marktn
What to fill in here?

Re: Python Plugin: Reolink

Posted: Thursday 28 September 2023 18:06
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).

Re: Python Plugin: Reolink

Posted: Thursday 28 September 2023 19:03
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' 

Re: Python Plugin: Reolink

Posted: Thursday 28 September 2023 19:28
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.

Re: Python Plugin: Reolink

Posted: Thursday 28 September 2023 19:38
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(-)

Re: Python Plugin: Reolink

Posted: Thursday 28 September 2023 19:58
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

Re: Python Plugin: Reolink

Posted: Thursday 28 September 2023 20:25
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'


Re: Python Plugin: Reolink

Posted: Thursday 28 September 2023 21:39
by JBN
I need to see if I can reproduce your error. I'll get back to you.

Re: Python Plugin: Reolink

Posted: Friday 29 September 2023 20:25
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?

Re: Python Plugin: Reolink

Posted: Tuesday 16 January 2024 17:55
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

Re: Python Plugin: Reolink

Posted: Saturday 27 January 2024 16:29
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?

Re: Python Plugin: Reolink

Posted: Saturday 27 January 2024 16:39
by Rik60
Reolink_domoticz_log_2.png
Reolink_domoticz_log_2.png (37.53 KiB) Viewed 3372 times
Reolink_domoticz_log_3.png
Reolink_domoticz_log_3.png (50.32 KiB) Viewed 3372 times

Re: Python Plugin: Reolink

Posted: Saturday 27 January 2024 18:13
by dyter
You need accept new devices in setup of domoticz

Re: Python Plugin: Reolink

Posted: Saturday 27 January 2024 20:34
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....

Re: Python Plugin: Reolink

Posted: Sunday 28 January 2024 15:40
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']

Re: Python Plugin: Reolink

Posted: Monday 29 January 2024 20:57
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