Reolink POE IP Camera Setup

Hi,

excellent work but I’m motion detection with RLC-410 5MP doesn’t seem to work. It seems HA never picks up the motion from the camera. HA doesn’t return any errors. I can see motion being detected in Reolink software but not by binary sensor in HA.

Any ideas?

1 Like

Hmm. I don’t get the motion alarm. It says it’s mandatory in T, but I used an ONVIF program on my PC and it could see all the motion events. I just can’t work out how to get them.

I don’t see any of those services listed in dev tools.

As for the port, I’ll try reboot the whole system tomorrow and see what happens.

@sloma I’m also running the RLC-410-5MP.

I’ve already done some preparations for stream options, this will be included in a future release. Please be patient. :slight_smile:

2 Likes

@fwestenberg I’ve just had a look through my logs. I get this error when HA starts and tries to load the component.

Error while setting up platform reolink
10:20 AM custom_components/reolink/ReolinkCamera.py (ERROR)

Clicking on that shows the following:

Error while setting up platform reolink
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/asyncio/coroutines.py", line 120, in coro
    res = func(*args, **kw)
  File "/config/custom_components/reolink/camera.py", line 52, in async_setup_platform
    reolinkCameraDevice = ReolinkCamera(hass, config)
  File "/config/custom_components/reolink/camera.py", line 130, in __init__
    self._reolink_session = Camera(self._host, self._username, self._password)
  File "/config/custom_components/reolink/ReolinkCamera.py", line 163, in __init__
    super(Camera, self).login(self.username, self.password)
  File "/config/custom_components/reolink/ReolinkCamera.py", line 27, in login
    data = json.loads(response.text)[0]
  File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@fwestenberg Have you seen this link?


According to this link, there is a GetMdState field you may be able to use for motion detection?

Really glad someone is working on this… Ive been trying to get motioneye to play with my system… but it seems to bog down… and is an either or proposition.

I have three cameras defined and they work fine in an picture entity card… but if motioneye is running things don’t work well in either environment.

Candi… my system is nearly identical as yours… I’m rinningh the RLC-420-5MP’s have you tried motioneye?
Eeeeeediot your on the right track… I got the 8 port version of that switch… it works great and I have a ~15 second delay… so that’s “normal”
Look a few posts down in the other thread you’re in and you’ll see my post on motioneye… Post I got it working…BUT it has problems. Most likely a configuration problem but as in all things HA related… its a work in progress. An I haven t touched anything in the Reolink app with regards to streaming…

So fwestenberg is your code working or is it still in development?

And… with respect to your insttructions

SMTP Server: 192.168.1.100 --> Your Home Assistant IP
SMTP Port: 1026 --> Can be changed to something else
Sender Address: [email protected] --> Just something
Receipient Address 1: [email protected] --> This should match the camera device name in Home Assistant (before the @)
Attachment: No Attachment
Interval: 30 Seconds

Can gmail be used instead as your SMTP provider… I have that already up and working

Hey!

I think it broke with last update of HA.

Yep, it broke, but the component was already broken for me and wouldn’t work. Loaded in HA fine, but had errors. The creator hasn’t responded to my errors posted above, so for now, this will be disabled.

https://github.com/fwestenberg/reolink/issues/4#issuecomment-540820058

If anyone is looking to get motion sensing working on their Reolink POE camera’s, the following worked for me. Add this to you config.yaml

Reolink Motion Detection

binary_sensor:

  • platform: rest
    resource: !secret reolink1
    name: Motion Reolink
    scan_interval: 5
    value_template: “{{ value_json[0].value.state }}”
    device_class: motion

The “resource” field takes the following form:
http://camera's IP/api.cgi?cmd=GetMdState&user=admin&password=your_password

7 Likes

binary_sensor:

  • platform: rest
    resource: !secret reolink1
    name: Motion Reolink
    scan_interval: 5
    value_template: “{{ value_json[0].value.state }}”
    device_class: motion

The “resource” field takes the following form:
http://My camera's IP/api.cgi?cmd=GetMdState&user=admin&password=My_passwor

Tried it… didnt work… do I need anything else… I do NOT have the component loaded…is that required?
The camera is configured to report motion… and it did
Also… the state is reporting 'Clear" vs On or Off

Capture

-A

1 Like

I don’t know if it helps but I tested it only in the browser so far, I had no time to do it in HA.
Mine seems to be working if I replace http with https.

1 Like

Not sure who your responding to…
How / what… did you test in a browser

@BitViper I have typed in the “resource” in my browser and got the result displayed with state 0 when there is no motion. While there was motion detected by the camera I hit refresh in the browser and then state changed to 1, so the “resource” itself is working just make sure your password is correct. That means this solution technically should work in home assistant.

The problem is it only periodically checks if there is motion so while it might work it’s not ideal.

I wonder if there’s a way to make it work that when camera detects motion it also sends its state to HA.

Ahhh I see… I get this… using either of teh users that I have configured…
Capture

Reolink
You should be able to see the above in a no motion state. With motion, “state” will turn to one. You should be able to decrease the scan interval to improve the responsiveness of the sensor in HA. The Reolink returns to 0 pretty quickly when no motion is detected.

User and password of camera is setup in the Reolink app.

State is reporting “clear” because
device_class: motion
is set.

So spent some time today trying to get the motion sensor working, and just couldn’t make it happen with the rest binary sensor. I think maybe the scan_interval is being deprecated?
In the end I have got the same result using Node-Red instead.
First I added some template config to HA…

input_boolean:
  front_camera_motion:
binary_sensor:
  - platform: template
    sensors:
      front_camera_motion:
        friendly_name: "Front Camera Motion"
        device_class: motion
        value_template: >-
          {{ is_state("input_boolean.front_camera_motion", "on") }}

Then I made this flow in NodeRed (using the exact same URL that wouldn’t work for Rest sensor!)

More info on the NodeRed part? :smiley:

When copying this part: value_template: “{{ value_json[0].value.state }}”, delete the " in the and retype them yourself, cuz something is fkd with the ".

This is awesome!!! Thanks, although I had to removed device_class: motion as it wouldn’t validate. Other than that, this works awesome!!