Reolink POE IP Camera Setup

@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!!

Here is the NodeRed Code. Change IP / USER / PASSWORD of course!..

[
  {
    "id": "93c44c49.6ea2a",
    "type": "tab",
    "label": "Camera Motion Sensors",
    "disabled": false,
    "info": ""
  },
  {
    "id": "38d2e9e9.2b96f6",
    "type": "www-request",
    "z": "93c44c49.6ea2a",
    "name": "Get Front Camera Motion Status",
    "method": "GET",
    "ret": "obj",
    "url": "http://X.X.X.X/api.cgi?cmd=GetMdState&user=**USERNAME**s&password=**PASSWORD**",
    "follow-redirects": true,
    "persistent-http": true,
    "tls": "",
    "x": 200,
    "y": 100,
    "wires": [
      [
        "234c37f8.6a09e8"
      ]
    ]
  },
  {
    "id": "5ebccf3d.0cc36",
    "type": "api-call-service",
    "z": "93c44c49.6ea2a",
    "name": "Sensor Off",
    "server": "d1ff6d9f.99f46",
    "version": 1,
    "service_domain": "input_boolean",
    "service": "turn_off",
    "entityId": "input_boolean.front_camera_motion",
    "data": "",
    "dataType": "json",
    "mergecontext": "",
    "output_location": "",
    "output_location_type": "none",
    "mustacheAltTags": false,
    "x": 550,
    "y": 40,
    "wires": [
      []
    ]
  },
  {
    "id": "234c37f8.6a09e8",
    "type": "switch",
    "z": "93c44c49.6ea2a",
    "name": "Check Status",
    "property": "payload.0.value.state",
    "propertyType": "msg",
    "rules": [
      {
        "t": "eq",
        "v": "",
        "vt": "prev"
      },
      {
        "t": "eq",
        "v": "0",
        "vt": "num"
      },
      {
        "t": "eq",
        "v": "1",
        "vt": "num"
      }
    ],
    "checkall": "true",
    "repair": false,
    "outputs": 3,
    "x": 340,
    "y": 40,
    "wires": [
      [],
      [
        "5ebccf3d.0cc36"
      ],
      [
        "b6c51b0c.251b18"
      ]
    ]
  },
  {
    "id": "b6c51b0c.251b18",
    "type": "api-call-service",
    "z": "93c44c49.6ea2a",
    "name": "Sensor On",
    "server": "d1ff6d9f.99f46",
    "version": 1,
    "service_domain": "input_boolean",
    "service": "turn_on",
    "entityId": "input_boolean.front_camera_motion",
    "data": "",
    "dataType": "json",
    "mergecontext": "",
    "output_location": "",
    "output_location_type": "none",
    "mustacheAltTags": false,
    "x": 550,
    "y": 100,
    "wires": [
      []
    ]
  },
  {
    "id": "899ab24d.7aa7f",
    "type": "inject",
    "z": "93c44c49.6ea2a",
    "name": "Repeat",
    "topic": "",
    "payload": "",
    "payloadType": "date",
    "repeat": "1",
    "crontab": "",
    "once": false,
    "onceDelay": 0.1,
    "x": 120,
    "y": 40,
    "wires": [
      [
        "38d2e9e9.2b96f6"
      ]
    ]
  },
  {
    "id": "d1ff6d9f.99f46",
    "type": "server",
    "z": "",
    "name": "Home Assistant"
  }
]

I modified it a bit to only update the sensor when there’s a change, and not poll from HA…

3 Likes

Hi this code is ok for all Reolink Cam? I have a C2 Pro can.
Thanks

I’ve setup the reolink 5MP cam with no problem and added it to HA. The issue that i’m having is that frame rate is literally 1 frame per second when viewing the stream. I thought there was an issue with my cam but when I view the stream via VLC it’s flawless. Am I missing something?

Thanks!

Are you running on a pi?

I had the same, the whole stream was broken and didn’t really work but was fine on VLC. When I moved my HASS instance onto my home server (i3 processor), the camera stream was smooth and worked instantly. Albeit with a 6/7 seconds delay which I’ve yet to iron out.