New House - Existing Lorex DVR system, will it work?

Are you using motion Eye? Is port 8554 a typo?

Is port 8554 a typo?

Probably not. 8554 is an alternate port for RTSP.

http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=554

Hi Folks,

absolute n00b here but Iā€™ve got kinda familiar with the Lorex system and noticed some differences with the setup here and what should be used for some systems. Itā€™s a LHA2108LC and I can use the Lorex Client 13 for viewing my cameras on desktop and the Lorex Cirrus app on iOS.

I log in to those with Device ID/IP, port 9000 (disregard this for HA), user (admin) and pw.

In the Lorex Client 13 on desktop (and I think on the DVR itself - itā€™s in the attic Iā€™m not going up there now) you go to the below path

Settings > Network > RTSP

In there you should have RTSP enabled, Verify is enabled for me, port 554. Below this I have;

Instruction :
Analog Channel: rtsp:////IP:port/chA/B
A:01(ch1),02(ch2)ā€¦
B : 0(main stream, 1(sub stream)

So after a bit of fiddling about with that info and the info in this thread I have put camera: !include camera.yaml in my main config and my camera.yaml looks like this;

- platform: ffmpeg
  input: rtsp://admin:[email protected]:554/ch2/0
  name: driveway

- platform: ffmpeg
  input: rtsp://admin:[email protected]:554/ch4/0
  name: back

- platform: ffmpeg
  input: rtsp://admin:[email protected]:554/ch5/0
  name: nursery

I hope this isnā€™t too n00b for people here, Iā€™m getting to grips with yaml - that took me the longest here in all honesty, but Iā€™m pretty happy I got this sorted!

DC

1 Like

Hi tried setting it up and i see following error in my ha logs:

av.error.HTTPNotFoundError: [Errno 875574520] Server returned 404 Not Found: 'rtsp://admin:[email protected]:554/ch2/0'; last error log: [rtsp] method DESCRIBE failed: 404 Not Found

this is my camera.yaml config

- platform: ffmpeg
  input: rtsp://admin:[email protected]:554/ch2/0
  name: driveway

any ideas how to fix it?

i verified that i have rtsp enabled on port 554. Is there a way to test it without HA, i tried with vlc and no luck

when i changed the input to this it started working, hope this helps someone too

input: rtsp://admin:[email protected]:554/cam/realmonitor?channel=2&subtype=0

My streams are working great but how do I take a still image from the stream ?

Anyone an example for the DVR

Thanks

Martyn

Thank you! This worked on my Lorex cameras.

Hi @mihir2787 how did you figure out the URL for still image? Mine doesnā€™t work at all. I do see live feed when I click on the box for each camera.

Were you ever able to get it connected to MotionEye? I really want to just detect motion from my Lorex cameras and then do other automation.

Also, if you have your configuration on GitHub, please share a link.

Please let me know,

Thanks,

Rohit.

For the folks that are having the issue where only the last camera shows up, here is how you fix it. Turns you for the first camera you have to do ā€œ- platformā€ Basically a - then a space and for the subsequent lines for that camera you just enter in two spaces.
image

  • platformā€¦
    inputā€¦
    nameā€¦

  • platformā€¦
    inputā€¦
    nameā€¦

Hopefully my image uploads but its a formatting issue with the dash and the spaces but you can see that this forum tries to make that a bullet when in fact this forum messes up our formatting hahaā€¦ and i have no idea what im doing either

Start line one for camera one with - dash space and the next line with space space

2 Likes

Could you tell how you got Lorex cameras to work with the Amcrest component? I canā€™t figure out how to even enable one camera stream as the component wonā€™t accept the rtsp://::@:/cam/realmonitor?channel=&subtype= url format required to stream Lorex cameras.

Hereā€™s what I have in my config.yaml file for the Amcrest component:

 amcrest: 
   - host: 192.168.1.xx
     stream_source: rtsp
     port: 554
     name: Test Cam
     username: !secret lorex_user
     password: !secret lorex_pass

And hereā€™s the error from the log:

amcrest: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 466, in async_device_update
    await task
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/amcrest/camera.py", line 379, in update
    self._color_bw = self._get_color_mode()
  File "/usr/src/homeassistant/homeassistant/components/amcrest/camera.py", line 587, in _get_color_mode
    return _CBW[self._api.day_night_color]
  File "/usr/local/lib/python3.8/site-packages/amcrest/video.py", line 168, in day_night_color
    return int(self.video_in_option('DayNightColor'))
  File "/usr/local/lib/python3.8/site-packages/amcrest/video.py", line 145, in video_in_option
    [opt for opt in self.video_in_options.split()
IndexError: list index out of range

For LOREX, yesterday when I set these up I had to make sure the stream I used was using CBR, as VBR didnt. This was pulling from the DVR channels. Clicking on the card launches a stream as well. I havenā€™t fiddled with audio settings for the one camera I have with audio on. Once I figured this out, I set every non LOREX camera (D-Link crap internal cameras like 2630 and the like) to the same quality settings.

Its a little tricky to configure these settings in a LOREX and my cameraā€™s are on my LAN not plugged into the DVR directly. I just went to the webpage for each camera. You can do from the LOREX DVR web page too under the Camera Settings/Recording.

Example:

camera: 
  - platform: ffmpeg
    input: 'rtsp://<user>:<pin at the DVR>@192.168.1.XXX:554/cam/realmonitor?channel=1&subtype=1'
    name: Front Yard

  - platform: ffmpeg
    input: 'rtsp://<user>:<pin at the DVR>@192.168.1.XXX:554/cam/realmonitor?channel=3&subtype=1'
    name: Front Porch

  - platform: ffmpeg
    input: 'rtsp://<user>:<pin at the DVR>@192.168.1.XXX:554/cam/realmonitor?channel=2&subtype=1'
    name: Garage Side Door

Typical card:

entity: camera.garage_side_door
show_name: false
show_state: false
type: picture-entity

Exact settings on a camera:
Main Stream: H.264H, Super OFF, Resoution (Dealers choice), FPS 15, Bit Rate Type CBR, Bit Rate 4MB.
Sub Stream: H.264H, Resolution (D1) 704x480, FPS 15, CBR, 512kbs

I can use subtype 0 if I want, but I just use the lower resolution. Could put both in I guess and have the higher resolution for the tap action.

I was thrilled to be able to integrate my Lorex cameras into HA as a result of this thread, but now am getting greedy and wonder if states can be read - specifically person detection (which my system NVR supports along with automobile detection). Working code for one of my cams with my NVRā€™s static IP:

- platform: ffmpeg
  input: rtsp://admin:[email protected]/cam/realmonitor?channel=2&subtype=1
  name: n driveway

Since these are pretty much the same as the Amcrest/Dahua I tried out the Amcrest integration and its working great. I am using that for the 8 lorex cameras bypassing the DVR. I have motion detection as well with a 1 minute cooldown after adjusting the anti-dither (Event>Video Detection>Anti_Dither) to 60 seconds on each camera. I let the DVR do its thing and the DVR still shoots my internal mail server snapshots on motion that if I find something interesting I still sit down at it and review footage. Most of my activity around here is wildlife. Saw a massive owl on porch other night due to the motion sensor going off while setting up a version of the security dashboard page add-on for dwains dashboard.

So, here is an example in configuration.yaml

amcrest:
  - host: 192.168.1.xxx
    name: "Front Yard"
    username: admin
    password: !What I changed this to, default is admin on these silly things
    resolution: low
    binary_sensors:
      - motion_detected
      - online

I didnt use the DVR this time around, I went straight to the cameras. I have substream 1 (the low above) set to D1, 5 FPS and CBR with 512. I set audio to AAC on those with it using lowest sample. When I open up the stream I hear the audio.

I can keep all 8 streams running since the bps is pretty low. I donā€™t really intend to use the sensor for automation.

I have two varifocal and ptz doesnt work on them, which is mentioned in the add on notes.

Thatā€™s encouraging, but I have all my cams routing through my Lorex NVR and donā€™t have 9 vacant network ports on my switches to move them. I just tried your binary_sensors code onto my configuration.yaml for one of the cams but the config validation returned:

Invalid config for [camera.ffmpeg]: [binary_sensors] is an invalid option for [camera.ffmpeg]. Check: camera.ffmpeg->binary_sensors. (See ?, line ?).

The amcrest integration is supposed to work with the DVR channels in RTSP mode, but I didnt experiment with it to see if it was encoding motion in the stream. Someone else posted they were able to get it working. Iā€™ll play around with it some today and report back if I get success with it working that way with motion. I can get the stream in the dashboard 5 different ways it was the motion sensor I was after that moved me to amcrest integration.

Try what this fella did:

What you do is use the rtps: I linked above as the source for each channel. Heā€™s using ffmpeg_motion platform to create the sensors. Be sure to read the third part where heā€™s using a secrets file for the rtsp streams. I havent gotten around to trying this out just yet.

So, I tried a version of your code in configuration.yaml

binary_sensor:
  - platform: ffmpeg_motion
    input: rtsp://admin:[email protected]/H264/ch9/main/av_stream
    extra_arguments: -q:v 2
    changes: 1
    reset: 5
    repeat: 2
    repeat_time: 3

Then in cameras.yaml

- platform: ffmpeg
  input: rtsp://admin:[email protected]/cam/realmonitor?channel=9&subtype=1
  name: test
  binary_sensors:
    - motion_detected

it still returns an invalid config error in relation to binary_sensor. Remember, I can get the camera views to work, just not the sensors.
Also, with your last code, how to you use motion or people-detection as a trigger?

thanks.

This cracked the code for me. I had the camera.yaml file setup improperly. Thank you!

sorry for the late reply :smiley:

amcrest:
  - host: 192.168.5.193
    username: username
    password: password
    scan_interval: 2
    stream_source: rtsp
    resolution: high
    name: GartenBaum

worked for me

Hi @tmjpugh,

I have a few 4k Lorex cameras and a Lorex NVR also working as a sub-net router for the caemras. I am unable to find out of these camras can support rstp. I know the IP address of each of these cameras, and the port the NVR is using to funnel data to them on the main network. Can you expand on how I can verify this?