Reolink+AI Tool+Home Assistant - FREE Edition for AI Motion Detection

Quote from reolink reddit: https://www.reddit.com/r/reolinkcam/comments/k98oss/reolink_ai_tool_home_assistant_free_edition/

So here’s my current system, and I’ll say upfront I take zero credit for any development of any of the tools used with this method. With this I’m using 4 total components. I’m not going to go too deep into Home Assistant because that’d take a LONG time to write up and there are lots of great YouTube tutorials on it already.

  1. Reolink Cameras (2x RLC-520, 1x RLC-810A)
  2. iSpy v7.2.1.0 64-bit (Freeware)
  3. AI-Tool
  4. Deepstack AI

Here’s the workflow:

  • Obviously set your cameras. I’m sure you’ve already done this…
    install Ispy
  • Load your cameras into iSpy
    • I used the “Add IP Cameras with Wizard” option. Currently the 520 and 810A are not part of the Wizard, so you’ll want to use “Not Listed” and add the Make and Model manually.
    • Tick the “Scan RTSP Addresses” box.
    • Click Next
    • Enter your Username/Password for the camera. I didn’t input anything in the Channel option as I don’t use a DVR. I believe if you’re using a DVR, you can use your DVR here and select individual channels all from one source.
    • Click Next
    • If you know your camera’s IP address, you can input it manually here or you can click “Scan Local Network”.
    • Click Next Again
    • This next page will give you tons of options for how to grab the stream. I used the FFMPEG:410:rtsp://user:password@IP Address:554/h264Preview_01_sub for this setup.
    • The reason I’m using sub instead of main is to reduce network traffic. This solution doesn’t require high-resolution, and I found that using the “Fluent”/sub stream provided less frame drops than using the "Clear’/main stream
    • Click Next and you should see your camera added to your Dashboard now and you can name it with “Edit Camera”
  • Set Image capture within iSpy.
  1. On the “Edit Camera” screen there are tons of options. I’m only going to say exactly what is needed to make this work. So I have literally turned off everything else, motion recording, alerts, scheduling… it’s all turned off.
  2. Go to the Motion Detection Tab.
  3. In Detection Zones - draw a square(s) over the area you want motion detection to work. I used the entire area, because the real motion detection happens in the next step anyways. Too many false positives here isn’t a bad thing.
  4. On the Images Tab - enable Local Saving Enabled and set Save When to Motion Detection. Feel free to remove the Overlay Text.
  5. Storage Tab Media Location - Set this to a folder easy to remember. I still am using C:\aiinput\ from the last write-up. I changed my Directory names to match the camera names. I enabled Storage Management so the software would only keep images for 24 hours. - I have an NVR running 24/7, so I don’t personally care about these photos. I could have easily set it for 1 hour and it would still perform fine. Finish.
  • Install Deepstack AI for Windows. The Docker one won’t work with this new workflow.
  • Get the AI-Tool .zip for installation here: github.com/VorlonCD/bi-aidetection/releases
  • Extract the Zip folder. If you previously were using AI-Tool, you can copy this into the same folder and your settings with remain. If you haven’t used AI-Tool before, extract the Zip folder. I personally extracted it to Program Files just so I could easily find it later.
  • Configuring AI Tool. - This new version contains MQTT built-in, which is why we no longer need Blue Iris.
    • DeepStack tab:
      • Select your Deepstack installation Folder
      • Select API: Detection API, Mode: High, Port: ??. I’m using Port 83 still, but this can be anything you want.
      • Select Automatically Start Deepstack <- Another new addition with the updated AI Tool. Save
    • Settings:
      • Default Input Path - This is the folder you used for Media Location in iSpy
      • Deepstack URL - localhost:port# (localhost:83)
      • Start - tick “Start with user login”. Save
    • Cameras:
      • Click Add, give it a camera name. I’ll use FrontDoor for this example.
      • Input Folder: click the Select - then navigate to the folder where iSpy is putting the images. If you renamed the Directory name it’ll look something like C:/aiiinput/video/FrontDoor/Grabs
      • Select the Relevant objects you want detected.
    • MQTT Time - under Actions click “Settings”. Then click “Settings” again next to MQTT. Input your Server:Port for your Home Assistant MQTT broker. Example: [192.168.0.72:1883](add https:// before 192.168.0.72:1883/). Set the Username/Password that MQTT uses on Home Assistant.
      • Topic is what the HA (Home Assistant) Configuration.yaml file will work based off. This new version of Ai Tool also has variables, so be default the Topic will be:
      • ai/[Camera]/motion [Detection] - Which will pass a payload that looks like this:
      • ai/FrontDoor/motion Person - if it’s a person
      • ai/FrontDoor/motion Car - if it’s a Car
      • If you want the Detection Type to be specified in the message, leave it as [Detection]. If you don’t care about the detection type, change it to something line “On”.
    • Cooldown Time: I highly recommend setting this variable unless you want a ton of alerts and an annoyed wife because her phone received 250 notification over the course of an hour. I set this to one minute which seems to we working out pretty well.
  • Configuration.Yaml:
    • Update your HA Configuration.yaml file to look for these new MQTT payloads. If you’re using the Detection variable, you’ll need the payload_on for each detection type you set in AI Tool. Here’s an example of mine where I only care about People and Cars…

binary_sensor:

  • platform: mqtt

name: “Motion - Front Door - Vehicle”

device_class: motion

state_topic: “ai/FrontDoor/motion”

payload_on: “Car”

off_delay: 60

  • platform: mqtt

name: “Motion - Front Door - Person”

device_class: motion

state_topic: “ai/FrontDoor/motion”

payload_on: “Person”

off_delay: 60

  • Automation configuration: Once the MQTT messages has reached HA, we can do a couple things with it. Some people will use NodeRed to really customize their event but I prefer automation because it’s just easier IMO.
    • Name: Motion Detection - Vehicle Front Door
      • Mode: Single (default)
    • Triggers:
      • Type: MQTT
      • Topic: ai/FrontDoor/Motion
      • Payload: Vehicle
    • Conditions - I don’t use anything here
    • Actions:
      • Type: Call service
      • Service: Notify.mobile_app_iphone
      • Service Data - If you have your cameras integrated into HA, you can send a snapshot of their current state along with the notification.

message: Motion Detection - Front Door - Vehicle

data:

attachment:

content-type: jpeg

push:

category: camera

entity_id: camera.front_door

Save!

And that’s it. I know this was pretty lengthy, but I wanted to be pretty verbose in case someone else wanted to do a similar setup. I’d be happy to help anyone with this is you run into issues or have general questions. I believe I’ve done this as close to step by step as possible, if I missed anything please let me know. Also if you have an Android phone that Service Data code will not work, it’s only for iPhones.

2 Likes

An alternative to AI tools is node-deepstackai-trigger you can see info in:


I am testing Node-deepstackai-trigger now…For now it’s working very well.

Hi @Frank, thanks for a nice write up. I’m considering Reolink 810A with AI built in, have you tried utilizing the built in AI to minimize workload on your server? I have a pretty weak server at the moment and not really looking to upgrade it. I would like to detect vehicles, people and animals on my property and save those clips on my server :slight_smile:
If my server only have to handle the FTP/file upload from my cameras (that would have microsd cards in them) I think the needed cpu would be quite low :slight_smile:

1 Like