Reolink POE IP Camera Setup

Hey,

I run HASSIO on a Pi4 4GB. I’ll post my package tomorrow for two reasons. 1. If it helps you. 2. More importantly, so others might be able to suggest improvements!

Would be interested to see how you integrate DOODS too.

I will post my design ASAP I’m finished with it.

Since it’s possible to use the onvif integration i swapped my four cams to this.
Super easy to integrate now :slight_smile:

But i guess there are now no more options to use more features? Right?

What benefits or differences have you seen?

haha ok… so i’ve to admit ^^

I started with the generic (two cams) switched over to @fwestenberg 's repo because i had problems and i LOVED THIS way to integrate the cams much more than the generic thing and the supercool options i had

THAN after the last HA update i read this ONVIF thing in the change notes and as well i had two more cams to integrate i decided to try onvif and integrate all cams by onvif

No more

Now i’m not sure if i should change back or not… lets see

Hey,

Here is my DOODS package. I am happy with it but its not perfect so would be interested in peoples thoughts.

#Integration
image_processing:
- platform: doods
  scan_interval: 31536000
  url: "http://192.168.0.200:8080"
  timeout: 60
  detector: inception
  source:
    - entity_id: camera.front_door
      # name: Front Door Snapshot
  file_out:
    - "/config/www/doods/{{ camera_entity.split('.')[1] }}_latestmotion.jpg"
    - "/config/www/doods/snapshot_motion/{{ camera_entity.split('.')[1] }}_{{ state_attr('input_datetime.latestmotion_'~camera_entity.split('.')[1], 'timestamp') | timestamp_custom('%Y%m%d_%H%M') }}.jpg" 
  confidence: 70
  area: 
    covers: 'false'
  labels:
    - name: person
      confidence: 50
      area:
        top: 0.35
        covers: 'false'
    - name: car
      confidence: 70
      area:
        top: 0.35
        left: 0.10
        right: 0.50
        covers: 'false'
    # - name: truck



# triggers DOODS scanning when mtion is detected
automation:
- alias: "Front Door Motion Detected"
  trigger:
    platform: state
    entity_id: camera.front_door
    to: 'motion'
  # condition:
  #   - condition: template
  #     value_template: "{{ as_timestamp(now()) - as_timestamp(states.automation.camera_motion_on_front_door.attributes.last_triggered) | int > 60 }}"

  action:
# set timestamp
    - service: input_datetime.set_datetime
      entity_id: input_datetime.latestmotion_front_door
      data_template:
        datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
# # take snapshot to send to doobs
#     - service: camera.snapshot
#       data:
#         entity_id: camera.front_door
#         filename: '/config/www/doods/front_door_latestmotion.jpg'

# start recording with lookback
    - service: camera.record
      data:
        entity_id: camera.front_door
        filename: "/config/www/doods/front_door_latestmotion.mp4"
        duration: 20
        lookback: 5

#execute doods scanning
    - service: image_processing.scan
      entity_id: image_processing.doods_front_door

# delay untill latestmotiion.mp4 finishes.
    - delay: "00:00:25"

# copy to folder
    - service: shell_command.motion_detected_copy
      data_template:
        action: "cp"
        camera: "front_door"
        time: "{{ state_attr('input_datetime.latestmotion_front_door', 'timestamp') | timestamp_custom('%Y%m%d_%H%M') }}"


# sned notification when object is detected
- alias: "Front Door Object Detected"
  trigger:
    platform: state
    entity_id: image_processing.doods_front_door
  condition:
    condition: template
    value_template: >
      {{ trigger.from_state.state != trigger.to_state.state }}
  action:
# set object detected tyimestamp
    - service: input_datetime.set_datetime
      entity_id: input_datetime.latestobject_front_door
      data_template:
        datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"

# send notification
    - service: script.front_door_latestobject

# create latest object pictures
    - service: shell_command.object_detected
      data_template:
        action: "cp"
        camera: "front_door"
        time: "{{ state_attr('input_datetime.latestobject_front_door', 'timestamp') | timestamp_custom('%Y%m%d_%H%M') }}"

# Alexa announce
    - service: notify.alexa_media
      data_template:
        target: 
          - media_player.office_echo
        data:
          type: announce
        message: "Object Detected - Front Door"

#wait untill vid finishes
    - delay: "00:00:25" #might need to change

#copy vid to latestobject
    - service: shell_command.object_detected_video
      data_template:
        action: "cp"
        camera: "front_door"
        time: "{{ state_attr('input_datetime.latestobject_front_door', 'timestamp') | timestamp_custom('%Y%m%d_%H%M') }}"

#send latestobject vid
    - service: script.front_door_latestobject_video

shell_command: 
  object_detected_video: "/config/automation/object_detected_video.sh {{action}} {{camera}} {{time}}"
  object_detected: "/config/automation/object_detected.sh {{action}} {{camera}} {{time}}"
  motion_detected_copy: "/config/automation/motion_detected_copy.sh {{action}} {{camera}} {{time}}"

Shell commands to move files into correct folders

#!/bin/bash

if [ $1 = 'cp' ]
then
  cp /config/www//doods/$2_latestmotion.mp4 /config/www//doods/recording_motion/$2_$3.mp4
fi
#!/bin/bash

if [ $1 = 'cp' ]
then
  cp /config/www//doods/$2_latestmotion.mp4 /config/www//doods/$2_latestobject.mp4
  cp /config/www//doods/$2_latestmotion.mp4 /config/www//doods/recording_object/$2_$3.mp4
fi
#!/bin/bash

if [ $1 = 'cp' ]
then
  cp /config/www//doods/$2_latestmotion.jpg /config/www//doods/$2_latestobject.jpg
  cp /config/www//doods/$2_latestmotion.jpg /config/www//doods/snapshot_object/$2_$3.jpg
fi

Notification scripts

front_door_latestobject:
  alias: Front Door Object Detected
  sequence:
    - service: notify.mobile_app_stephen_s20
      data:
        title: Object Detected
        message: Front Door
        data:
          image: "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.ui.nabu.casa/local/doods/front_door_latestobject.jpg" 
          tag: Object Detected
          color: red
          # sticky: true
          clickAction: 'https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.ui.nabu.casa/lovelace-cctv/cctv'
          channel: Object Detected
          ttl: 0
          priority: high
          # actions:
          #   - action: "alarm" # The key yo vid u are sending for the event
          #     title: "Title" # The button title
          #   - action: "URI" # Must be set to URI if you plan to use a URI
          #     title: "Open Url"
          #     uri: "https://google.com" # URL to open when action is selected, ca



# this works add to automation

front_door_latestobject_video:
  alias: Front Door Object Detected Video
  sequence:
    - service: notify.pushbullet
      data:
        title: "Home Assistant"
        message: "Object Detected - Front Door"
        target: device/Stephen S20
        data:
          file_url: "https://xxxxxxxxxxxxxxxxx.ui.nabu.casa/local/doods/front_door_latestobject.mp4"

Lovelace

  - cards:
      - cards:
          - card:
              camera_image: camera.front_door_latestmotion
              entities:
                - input_datetime.latestmotion_front_door
              type: picture-glance
            style:
              border-radius: 5px
            type: 'custom:card-modder'
        parameters:
          scrollbar:
            draggable: true
            hide: true
            snapOnRelease: true
          spaceBetween: 8
        type: 'custom:swipe-card'
    type: 'custom:vertical-stack-in-card'
  - card:
      type: iframe
      url: >-
        ${'https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.ui.nabu.casa/local/doods/front_door_latestmotion.mp4?v='+states['input_datetime.latestmotion_front_door'].state}
    entities:
      - input_datetime.latestmotion_front_door
    type: 'custom:config-template-card'
show_header_toggle: false
title: Front Door Latest Motion
type: entities
2 Likes

Did you get the motion sensor data into HA? I added them the ONVIF and the stream works great but no sensor.

no… not yet! I’ll try the next days

1 Like

I have a E1 pro and did add it via ONVIF and it shows two enities
camera.mainstream_xxxx
camera.name

Yesterday when adding the mainstream worked but now nothing.

Anyone having the same problems?

Is anyone else having a difficult time getting the video to stream? When I go to click on the camera to view the live stream, it just gives me the circle showing that it’s loading.

I’ve tried switching the feed type from rtmp to rstp; changing the streams; and tried turning off and on the preload stream and still can’t get the video to stream.

Any suggestions? The still image is coming through as expected, but video seems to be lacking.

Hello

I need some help

I’m using this addon https://github.com/fwestenberg/reolink Image 13

But I have some question, first one is where to insert this code?

platform: template
switches:
camera_frontdoor_email:
value_template: “{{ is_state_attr(‘camera.frontdoor’, ‘email_enabled’, true) }}”
turn_on:
service: camera.enable_email
data:
entity_id: camera.frontdoor
turn_off:
service: camera.disable_email
data:
entity_id: camera.frontdoor
icon_template: >-
{% if is_state_attr(‘camera.frontdoor’, ‘email_enabled’, true) %}
mdi:email
{% else %}
mdi:email-outline
{% endif %}

camera_frontdoor_ftp:
value_template: “{{ is_state_attr(‘camera.frontdoor’, ‘ftp_enabled’, true) }}”
turn_on:
service: camera.enable_ftp
data:
entity_id: camera.frontdoor
turn_off:
service: camera.disable_ftp
data:
entity_id: camera.frontdoor
icon_template: >-
{% if is_state_attr(‘camera.frontdoor’, ‘ftp_enabled’, true) %}
mdi:filmstrip
{% else %}
mdi:filmstrip-off
{% endif %}

camera_frontdoor_ir_lights:
value_template: “{{ is_state_attr(‘camera.frontdoor’, ‘ir_lights_enabled’, true) }}”
turn_on:
service: camera.enable_ir_lights
data:
entity_id: camera.frontdoor
turn_off:
service: camera.disable_ir_lights
data:
entity_id: camera.frontdoor
icon_template: >-
{% if is_state_attr(‘camera.frontdoor’, ‘ir_lights_enabled’, true) %}
mdi:flashlight
{% else %}
mdi:flashlight-off
{% endif %}

I already try to use this in the configuration.yaml where I have the code regarding the other two buttons motion detection and the light without success… I receive the following error:

Configuration invalidCHECK CONFIGURATION

Component error: switches - Integration ‘switches’ not found. Component error: platform - Integration ‘platform’ not found.

and other question is where I can configure the FTP and the email service of this two buttons?

Thank you and best regards

In my case I have no problem. What you are using as a device to running the Home assistant? A raspberry pi ?

Update: So, I figured out that my issue was that the passwords I was using were actually too long and was causing a login error. I reduced the number of characters for the camera and now the integration is working as intended.

I’m running HA as a VM on a Proxmox server with plenty of horsepower allocated for the machine. I’m still trying to figure out why everything works minus the streaming. I’m able to stream all of my other cameras using the generic camera card which are all on the same subnet, but using this custom component doesn’t seem to be working.

Is there a way to debug this in order to get additional information on why it’s not working?

After looking back through the message chain above, it appears that someone was having diffiulty streaming a camera that wasn’t on the same switch (and presumed subnet) as the host. Is anyone else able to get this to work. I’m running the cameras off of a switch with a gateway of 192.168.86.1/24 while my Proxmox HA is running on 192.168.52.1/24. there’s no issues with accessing either subnets as I’m currently able to achieve that with the generic camera integration and I’m also able to stream when logging directly into the camera front-end.

Thoughts?

It’s really nice that you created this! I am using it with my RLC-420-5MP and it works perfectly :slight_smile:

I read that you wanted some help with releasing it in HACS, I am a newbie, but I am willing to learn :slight_smile:

Anyone here using the https://github.com/fwestenberg/reolink addon and having issues with the binary sensors stopping reporting? I am constantly having issues where the sensors do not update on motion detection and requires a reboot of HA to get them working.

Hi Andrew, I’m on v0.100.3 and have exactly this problem. Approximately 1-2 weeks after reboot, my binary sensors (for motion detection) do not work anymore. I wasn’t able to correlate this behavior to any misconfiguration.
-Markus

Thankyou this is a great addition I just switched from generic camera to this Custom Component :+1: :+1:

Hi
I am ready to buy this reolink camera. and this poe switch
Can someone confirm please that it will work with home assistant?

It should work

1 Like