Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to choose an NVR channel #89

Open
gihad opened this issue Dec 29, 2017 · 16 comments
Open

Is it possible to choose an NVR channel #89

gihad opened this issue Dec 29, 2017 · 16 comments

Comments

@gihad
Copy link

gihad commented Dec 29, 2017

I'm using this library through the latest Home Assistant, I successfully added my Amcrest NVR with this:

# Amcrest NVR
amcrest:
  - host: NVR_IP
    username: <login>
    password: <password>
    sensors:
      - motion_detector
      - sdcard
      - ptz_preset

My Overview page in HA started showing images from the camera set to the first channel in the NVR.
Is it currently possible to specify the channel so that I can get the feed from other cameras in the NVR? Are there other implications of doing this?

In general I'm trying to avoid connecting directly to the Camera's IP, I'm thinking it's more efficient to connect to the NVR.

@gihad gihad changed the title Is it possible to choose NVR channel Is it possible to choose an NVR channel Dec 29, 2017
@dougsland
Copy link
Collaborator

@gihad most of our API calls have channels params. Not sure how we will integrate with HA. Marcelo, probably is aware of it. @tchellomello

@tchellomello
Copy link
Owner

Not sure about that too @gihad and @dougsland.

@gihad do you know if the NVR has a bindable API?

@Klathmon
Copy link

Klathmon commented Jun 5, 2018

As a workaround, you can access each camera directly on an NVR by going to the "remote" tab in the NVR settings, then clicking on the "browser" button for that camera.

It will open in a new tab a full UI for that specific camera, routed THROUGH the NVR on a custom port. So you can then put that port in home assistant as a unique camera, and it will be treated as if it were a standalone camera.

The username/password will be the default admin/admin

@thefarelkid
Copy link

Hi @Klathmon. I too have an Amcrest NVR. I was able to log in directly to the port 10080 through the NVR, but only if I'm logged into the NVR. Otherwise, the page can't be reached. I think that's the reason why when I load my config in Home Assistant, I get the error below. Any help would be appreciated.

Unable to connect to Amcrest camera: HTTPConnectionPool(host='192.168.29.209', port=10080): Max retries exceeded with url: /cgi-bin/magicBox.cgi?action=getMachineName (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x73e36f10>: Failed to establish a new connection: [Errno 111] Connection refused',))

My configuration.yaml

camera:
  - platform: amcrest
amcrest:
  - host: 192.168.29.209
    port: 10080
    username: admin
    password: admin #I also tried my normal password and it didn't work either.
    name: NVR

@Klathmon
Copy link

Klathmon commented Jul 6, 2018

@thefarelkid Well another workaround is to not run the cameras "through" your NVR, but to instead run them through your normal router, but the "add" them to the NVR manually through it's UI.

This is what I ended up doing, so each of my cameras has an IP on my "normal" network, and then the NVR logs into them through the normal network and saves all their recordings, and I have full access to all of them from my "normal" network.

The only downside is that if you are using PoE, then you need to power them with another PoE adapter.

@mohesles
Copy link

mohesles commented Jul 8, 2018

Wouldn't it be just a matter of exposing the channel as a config parameter in home-assistant?
for example... I can see the different streams by using the urls as in:
http:https://user:pass@NVRs_IP/cgi-bin/snapshot.cgi?channel=0&subtype=1
http:https://user:pass@NVRs_IP/cgi-bin/snapshot.cgi?channel=1&subtype=1
http:https://user:pass@NVRs_IP/cgi-bin/snapshot.cgi?channel=2&subtype=1
http:https://user:pass@NVRs_IP/cgi-bin/snapshot.cgi?channel=3&subtype=1

setting them as individual IP cameras is kinda weird and sometimes some work and others dont, plus I have no advanced controls

@thefarelkid
Copy link

@Klathmon The 2 camera's I'm not able to see are both POE and I bought the NVR specifically to be the power for them. I'm not going to be able to rout them to the network directly.

@mohesles can you be more specific about what you mean by "exposing the channel as a config parameter? Thanks.

@mohesles
Copy link

@mohesles can you be more specific about what you mean by "exposing the channel as a config parameter?

In the rest api for snapshots, you can use the channel attribute to see different feeds in an NVR.
http:https://user:pass@NVRs_IP/cgi-bin/snapshot.cgi?channel=0&subtype=1 would get a snapshot of the 1st camera in the NVR while http:https://user:pass@NVRs_IP/cgi-bin/snapshot.cgi?channel=1&subtype=1
would show the second camera, and so on.

So I was wondering if there might be a way to let this attribute to be specified. Or something like that?

amcrest:

  • host: IP_ADDRESS_NVR
    username: YOUR_USERNAME
    password: YOUR_PASSWORD
    channel: 0

  • host: IP_ADDRESS_NVR
    username: YOUR_USERNAME
    password: YOUR_PASSWORD
    channel: 1
    resolution: low [based on the subtype?]

@BenNeumeister
Copy link

BenNeumeister commented Jul 17, 2018

Not sure it's that simple.
Btw, I'm in the same boat.

From snahshot.py

channel:
                Values according with Amcrest API:
                0 - regular snapshot
                1 - motion detection snapshot
                2 - alarm snapshot

Edit, nope, it works.

http:https://user:pass@NVRs_IP/cgi-bin/snapshot.cgi?channel=0
http:https://user:pass@NVRs_IP/cgi-bin/snapshot.cgi?channel=1
http:https://user:pass@NVRs_IP/cgi-bin/snapshot.cgi?channel=2
http:https://user:pass@NVRs_IP/cgi-bin/snapshot.cgi?channel=3

@tchellomello, easy enough to add??

Also possible to add a delay in polling the NVR.
Getting timeouts coming in like crazy.
Box only seem to respond after 10s wait or so when polling for snapshots.

2018-07-17 22:18:11 WARNING (SyncWorker_19) [urllib3.connectionpool] Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPConnectionPool(host='192.168.1.222', port=80): Read timed out. (read timeout=3.0)",)': /cgi-bin/snapshot.cgi?channel=0
2018-07-17 22:18:21 WARNING (SyncWorker_3) [urllib3.connectionpool] Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPConnectionPool(host='192.168.1.222', port=80): Read timed out. (read timeout=3.0)",)': /cgi-bin/snapshot.cgi?channel=0
2018-07-17 22:18:24 WARNING (SyncWorker_3) [urllib3.connectionpool] Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPConnectionPool(host='192.168.1.222', port=80): Read timed out. (read timeout=3.0)",)': /cgi-bin/snapshot.cgi?channel=0
2018-07-17 22:19:21 WARNING (SyncWorker_6) [urllib3.connectionpool] Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPConnectionPool(host='192.168.1.222', port=80): Read timed out. (read timeout=3.0)",)': /cgi-bin/snapshot.cgi?channel=0
2018-07-17 22:19:31 WARNING (SyncWorker_4) [urllib3.connectionpool] Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPConnectionPool(host='192.168.1.222', port=80): Read timed out. (read timeout=3.0)",)': /cgi-bin/snapshot.cgi?channel=0
2018-07-17 22:19:34 WARNING (SyncWorker_4) [urllib3.connectionpool] Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPConnectionPool(host='192.168.1.222', port=80): Read timed out. (read timeout=3.0)",)': /cgi-bin/snapshot.cgi?channel=0

@thefarelkid
Copy link

I'm still hoping to get this working. Has anyone played around with it? We definitely can get snapshots of each channel, but I don't know if that translates to full functionality of the cameras can be utilized by home assistant. ie: motion sensor triggering an automation.

@theclevercrib
Copy link

theclevercrib commented Jan 1, 2019

I noticed this hasn't been updated recently, but I also would like to use various channels of the NVR ... and in addition, I would like to be able to activate/deactivate motion recording per channel so I can use the switch in conjunction with automations in Home Assistant.

I've tried to control motion detection recording from the cameras individually, but because I am using the NVR and not the SD CARD on the camera, it doesn't appear to work in making the NVR start recording.

@mohesles
Copy link

mohesles commented Mar 6, 2019

Any updates anyone?

@thefarelkid
Copy link

This did work for me pretty well until I realized that the Pi I was running my home assistant on was idling around 80% load. Note that this isn't the Amcrest component, so nothing specific to that component works, but I was able to get each camera connected to the NVR to come through by making each channel specific to that camera.

camera:
  - platform: ffmpeg
    name: Camera 1
    input: -rtsp_transport tcp -i rtsp:https://admin:[passowd]@[nvrIPaddress]:554/cam/realmonitor?channel=1&subtype=1
  - platform: ffmpeg
    name: Camera 2
    input: -rtsp_transport tcp -i rtsp:https://admin:[passowd]@[nvrIPaddress]:554/cam/realmonitor?channel=2&subtype=1
  - platform: ffmpeg
    name: Camera 3
    input: -rtsp_transport tcp -i rtsp:https://admin:[passowd]@[nvrIPaddress]:554/cam/realmonitor?channel=3&subtype=1`

@bryeartem
Copy link

bryeartem commented Mar 24, 2019

Try lowering the frame rate for your extra streams in your Amcrest config (you can change right in the mobile app) lowering the frame rate even slightly greatly reduced my usage, I have 4 ffmpeg cameras, and use ffmpeg motion and sit around 15% on a very old NUC. The only camera I keep at a high frame rate is my front porch which is my main entrance.
I am also still trying to get multiple cameras to work through the NVR... would love if I could get the motion sensors. Anyone get anywhere or have an ideas where we can start?

@GaryOkie
Copy link

GaryOkie commented Mar 25, 2019

+1 to the OP for selecting the NVR channel as an option in Home Assistant.

I will also submit a feature request to the Home Assistant Amcrest github asking for this.

@blademckain
Copy link
Collaborator

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests