Amcrest only lets me use one camera

I have two Amcrest IPM-751w Cameras. If I setup just one in my configs, it works fine. Video/Motion…everything. But If I enable two, I get errors.

Configuration.yaml

amcrest: !include amcrest.yaml

camera:
 - platform: amcrest

amcrest.yaml

- host: 192.168.1.121
  name: Front_Porch
  username: homeassistant
  password: !secret porch_pass
  resolution: low
  stream_source: mjpeg
  sensors:
    - motion_detector

- host: 192.168.1.122
  name: Driveway
  username: homeassistant
  password: !secret driveway_pass
  resolution: low
  stream_source: mjpeg
  sensors:
    - motion_detector

If I change the above amcrest.yaml to:

  host: 192.168.1.122
  name: Driveway
  username: homeassistant
  password: !secret driveway_pass
  resolution: low
  stream_source: mjpeg
  sensors:
    - motion_detector

It Works. If I put both back in, it breaks.

Here’s My error log

Have you tried to put both into the main configuration.yaml file?
It might have to do with the way you’re inserting the two comeras into the armcrest.yaml file…

That’s my entry in configuration.yaml:

# Showing picture from all Cameras
camera: !include cameras.yaml

And this is how I set up the first two cameras in the cameras.yaml file:

# Specific component for the Foscam
- platform: foscam
  ip: 192.168.7.83
  username: !secret cam_user
  password: !secret cam_pass
  name: OutdoorCam
- platform: foscam
  ip: 192.168.7.86
  username: !secret cam_user
  password: !secret cam_pass
  name: YardCam

Just tried this. Same Problems. One works fine. 2 causes errors.

This is my Config…yaml.

camera:
  - platform: amcrest
amcrest:
  - host: 192.168.1.121
    name: Front_Porch
    username: homeassistant
    password: !secret porch_pass
    resolution: low
    stream_source: mjpeg
    sensors:
      - motion_detector

  - host: 192.168.1.122
    name: Driveway
    username: homeassistant
    password: !secret driveway_pass
    resolution: low
    stream_source: mjpeg
    sensors:
      - motion_detector

What happens when you use this?

camera:
  - platform: amcrest
    host: 192.168.1.121
    name: Front_Porch
    username: homeassistant
    password: !secret porch_pass
    resolution: low
    stream_source: mjpeg
    sensors:
      - motion_detector
  - platform: amcrest
    host: 192.168.1.122
    name: Driveway
    username: homeassistant
    password: !secret driveway_pass
    resolution: low
    stream_source: mjpeg
    sensors:
      - motion_detector
Nov 14 15:56:41 homeassistant hass[8517]: #033[31m2017-11-14 15:56:41 ERROR (MainThread) [homeassistant.setup] Error during setup of component amcrest#033[0m
Nov 14 15:56:41 homeassistant hass[8517]: Traceback (most recent call last):
Nov 14 15:56:41 homeassistant hass[8517]:   File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 194, in _async_setup_component
Nov 14 15:56:41 homeassistant hass[8517]:     component.setup, hass, processed_config)
Nov 14 15:56:41 homeassistant hass[8517]:   File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
Nov 14 15:56:41 homeassistant hass[8517]:     yield self  # This tells Task to wait for completion.
Nov 14 15:56:41 homeassistant hass[8517]:   File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
Nov 14 15:56:41 homeassistant hass[8517]:     future.result()
Nov 14 15:56:41 homeassistant hass[8517]:   File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
Nov 14 15:56:41 homeassistant hass[8517]:     raise self._exception
Nov 14 15:56:41 homeassistant hass[8517]:   File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
Nov 14 15:56:41 homeassistant hass[8517]:     result = self.fn(*self.args, **self.kwargs)
Nov 14 15:56:41 homeassistant hass[8517]:   File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/amcrest.py", line 92, in setup
Nov 14 15:56:41 homeassistant hass[8517]:     amcrest_cams = config[DOMAIN]
Nov 14 15:56:41 homeassistant hass[8517]: KeyError: 'amcrest'#033[0m
Nov 14 15:56:41 homeassistant hass[8517]: #033[31m2017-11-14 15:56:41 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of camera.amcrest. Setup failed for dependencies: amcrest#033[0m
Nov 14 15:56:41 homeassistant hass[8517]: #033[31m2017-11-14 15:56:41 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform camera.amcrest: Could not setup all dependencies.#033[0m
Nov 14 15:56:41 homeassistant hass[8517]: #033[31m2017-11-14 15:56:41 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of camera.amcrest. Setup failed for dependencies: amcrest#033[0m
Nov 14 15:56:41 homeassistant hass[8517]: #033[31m2017-11-14 15:56:41 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform camera.amcrest: Could not setup all dependencies.#033[0m

Sorry, @anon91811138 - that’s all the suggestions I had.

As you can see from my example, I’m working with Foscam, not Amcrest, and looking at the component details at https://home-assistant.io/components/amcrest/ my suggestion was wrong in the first place.

I have two possible issues, that have happened to me.

The first one, fits right in with your issue. DO NOT “CUT & PASTE” then changed the unique info. CUTTING & PASTING, seems to introduce “BAD” characters, I did this and it caused me issues. So I typed in, ALL the config info, character by character, and All 4 of my Amcrest Cams now work. I still get WARNINGS, in my HA Log, which leads to my;

Second Issue, POOR Wifi signal, The Camera that is the Furthest from the Router is dropping Frames(snapshots). I can see this, when I ping the IP of the 4th Cam for a long period of time, and get a lot of ridiculous Ping times. I mean ping times of 4523ms(4-5 seconds). When I remove the 4th Cam from the HA Config, the amount of Warnings, drops drastically.
I am still battling the WiFi signal issue, something near my house,(maybe inside) is interfering with my WiFi signal.

Note: I am doing my Cam config, in the Configuration.yaml, and I also commented out the following;

camera:

  • platform: amcrest

And only use the following;

amcrest:

  • host: IP_ADDRESS#1
    name: Cam #1
    username: USERNAME
    password: PASSWORD
    resolution: low
    stream_source: snapshot
    Interval: 1
  • host: IP_ADDRESS#2
    name: Cam #2
    username: USERNAME
    password: PASSWORD
    resolution: low
    stream_source: snapshot
    Interval: 1
  • host: IP_ADDRESS#3
    name: Cam #3
    username: USERNAME
    password: PASSWORD
    resolution: low
    stream_source: snapshot
    Interval: 1
  • host: IP_ADDRESS#4
    name: Cam #4
    username: USERNAME
    password: PASSWORD
    resolution: low
    stream_source: snapshot
    Interval: 1

And even with a Interval of 1 second, the will take 3 seconds or more to update to the next frame(snapshot). And I strongly believe, this is because of the WiFi Signal issue.

I hope this helps…

I originally thought a ping time might be the issue as the cameras in question do reside quite a distance from the Router. However as part of testing, I started by directly connecting with a wired connection to each one. cable length under 6 feet.

Same issue. So it appears in my case its a software issue. As for stray characters, I used Atom to check spacing and text. All lined up, no extra characters.

All my text, lined up properly, too. But, there was a character that did not belong. One of the issues that I do wrong, a lot, is using an “UPPERCASE LETTERS” in the wrong places. Also, don’t forget, there are “Control Characters” that will show as a “Space character”…

I may have actually gotten it to work…sorta. I played around with the bitrate/framrate settings. On the initial page load of the image it only updates every 5-10 seconds. But If I click on it and it loads the popup, it streams the image, but at very low quality.

I’ve started to slowing adjust the settings to see how good an image I can get before it errors out. I’ll let you know my final settings once I get it as good as possible.

does anybody had luck with the amcrest component using multiple cameras?? it seems to be broken on the last 2 updates, i think it was broken on 0.58 or 0.59.

i have 2 cameras and this is my config

  • host: 192.168.10.45
    username: user
    password: pass
    name: cam1
    stream_source: rtsp
    resolution: high
  • host: 192.168.10.55
    username: user
    password: pass
    name: cam2
    stream_source: rtsp
    resolution: high

sometimes both cameras work, sometimes cam1 works and sometimes cam2 works.

my theory is for some reason HASS is opening too many connections to the cameras but it never closes the TCP session, collapsing the camera resourses

check this output ( the output is actually showing more connections i just trimmed )

sudo netstat -taupen | grep 225:
tcp 0 0 192.168.10.10:34464 192.168.10.45:80 CLOSE_WAIT 1001 11675 850/python3
tcp 1 0 192.168.10.10:34552 192.168.10.45:80 CLOSE_WAIT 1001 11263 850/python3
tcp 0 0 192.168.10.10:34550 192.168.10.45:80 CLOSE_WAIT 1001 11262 850/python3
tcp 1 0 192.168.10.10:34810 192.168.10.45:80 CLOSE_WAIT 1001 13148 850/python3
tcp 1 0 192.168.10.10:34546 192.168.10.45:80 CLOSE_WAIT 1001 11260 850/python3
tcp 0 0 192.168.10.10:34584 192.168.10.45:80 CLOSE_WAIT 1001 11712 850/python3
tcp 0 0 192.168.10.10:34090 192.168.10.45:80 CLOSE_WAIT 1001 12811 850/python3
tcp 0 0 192.168.10.10:34080 192.168.10.45:80 CLOSE_WAIT 1001 12806 850/python3
tcp 0 0 192.168.10.10:34820 192.168.10.45:80 CLOSE_WAIT 1001 13153 850/python3
tcp 0 0 192.168.10.10:34070 192.168.10.45:80 CLOSE_WAIT 1001 12805 850/python3
tcp 1 0 192.168.10.10:34072 192.168.10.45:80 CLOSE_WAIT 1001 11177 850/python3
tcp 0 0 192.168.10.10:34544 192.168.10.45:80 CLOSE_WAIT 1001 11259 850/python3
tcp 0 0 192.168.10.10:34814 192.168.10.45:80 CLOSE_WAIT 1001 13150 850/python3
tcp 1 0 192.168.10.10:34082 192.168.10.45:80 CLOSE_WAIT 1001 12807 850/python3
tcp 0 0 192.168.10.10:34834 192.168.10.45:80 TIME_WAIT 0 0 -
tcp 0 0 192.168.10.10:34858 192.168.10.45:80 TIME_WAIT 0 0 -
tcp 1 0 192.168.10.10:34092 192.168.10.45:80 CLOSE_WAIT 1001 11539 850/python3
tcp 1 0 192.168.10.10:34822 192.168.10.45:80 CLOSE_WAIT 1001 13154 850/python3
tcp 1 0 192.168.10.10:34816 192.168.10.45:80 CLOSE_WAIT 1001 13151 850/python3
tcp 0 0 192.168.10.10:34874 192.168.10.45:80 TIME_WAIT 0 0 -
tcp 0 0 192.168.10.10:34844 192.168.10.45:80 TIME_WAIT 0 0 -
tcp 1 0 192.168.10.10:34460 192.168.10.45:80 CLOSE_WAIT 1001 11673 850/python3
tcp 0 0 192.168.10.10:34458 192.168.10.45:80 CLOSE_WAIT 1001 13028 850/python3
tcp 1 0 192.168.10.10:34540 192.168.10.45:80 CLOSE_WAIT 1001 11257 850/python3
tcp 0 0 192.168.10.10:34538 192.168.10.45:80 CLOSE_WAIT 1001 11256 850/python3
tcp 0 0 192.168.10.10:34808 192.168.10.45:80 CLOSE_WAIT 1001 13147 850/python3
tcp 0 0 192.168.10.10:34880 192.168.10.45:80 TIME_WAIT 0 0 -
tcp 1 0 192.168.10.10:34798 192.168.10.45:80 CLOSE_WAIT 1001 14388 850/python3
tcp 0 0 192.168.10.10:34794 192.168.10.45:80 CLOSE_WAIT 1001 14387 850/python3