Reolink POE IP Camera Setup

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

I’m running 4 Reolink streams on a i5 NUC.
Smooth streams, but indeed 6-7 second delay.

1 Like

Glad the delay isn’t just me then! Must be a “feature”

Yep, sounds like PI is the issue here, interestingly the CPU load is not that high when I view the stream.

Background Information

I have shitty internet… and I have my first IP Camera (Reolink RLC-420-5MP).

Question

  1. Any advice on settings/practice when using this camera with my shitty internet?

  2. Does the IP camera only utilise bandwidth if someone/something is watching the stream?

  3. Would a lovelace card (as described in post #1) continually stream the live image and therefore continually utilise almost all of my bandwidth at all times?

Thanks

Your internet connection speed only comes into play if you are viewing them remotely.
If you are checking the cameras on your network from inside, you have nothing to worry about.

Ok - I can understand that. But sometimes when viewing it on my LAN it tells me my connection is poor and need to adjust my stream type?

So I don’t really understand that.

Also, if I did have a Lovelace streaming card on my home page of my Hass then if I opened it up remotely away from home then would it use up bandwidth everytime I opened up the app (Ariela or Chrome tab)

Dear really great work and clever idea

but if you have more than one camera there is a confuse

motion status for any motion from any camera it will be pushed
I am suspended to get specific camera be cause Reolink NVR push motion for any cam detect motion

If this is occurring then you may have something bottle-necking your LAN or you are attempting to view the stream on a device over wifi.

Correct viewing remotely would use your internet connection and cause low quality video streams. In this case you might want to use a 640x480 resolution for use in lovelace for external access.

Very Very Thanks