49.0 and Amcrest cameras

After upgrading to .49 I get config errors and my Amcrest cameras aren’t available.

The following components and platforms could not be set up:
camera.amcrest
amcrest

log:

2017-07-20 18:43:38 ERROR (MainThread) [homeassistant.setup] Error during setup of component amcrest
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/setup.py”, line 190, in _async_setup_component
component.setup, hass, processed_config)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/amcrest.py”, line 93, in setup
amcrest_cams = config[DOMAIN]
KeyError: ‘amcrest’
2017-07-20 18:43:38 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of camera.amcrest. Setup failed for dependencies: amcrest
2017-07-20 18:43:38 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform camera.amcrest: Could not setup all dependencies.
2017-07-20 18:43:38 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of camera.amcrest. Setup failed for dependencies: amcrest
2017-07-20 18:43:38 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform camera.amcrest: Could not setup all dependencies.

did you set up the new platform? it needs to be configured differently now.

I am also seeing some problems - even after updating to the new platform and configuring as documented:

2017-07-20 20:49:04 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: <Front_Door_Cam: AMC004T0xxxxxx28> is not JSON serializable

No image showing up at all.

Thanks, that was the deal. Only been using HA for about a week, so I’m learning to deal with change.

This new config doesn’t work in my separate camera.yaml. Is that doable?

I’d have to see your code and how you have it set up, but I would think the camera portion could be moved to camera.yaml. I only have the one camera so I left mine in configuration.yaml

configuration:

amcrest:
  - host: 192.168.1.22
    username: admin
    password: !secret camera
    name: Kitchen
    port: 8022
    sensors:
      - motion_detector

  - host: 192.168.1.24
    username: admin
    password: !secret camera
    name: Bedroom
    port: 8024
    stream_source: snapshot
    sensors:
      - motion_detector

  - host: 192.168.1.27
    username: admin
    password: !secret camera
    name: Gameroom
    port: 8027
    stream_source: snapshot
    sensors:
      - motion_detector

group: !include groups.yaml
automation: !include automations.yaml
envisalink: !include envisalink.yaml
camera: !include camera.yaml

camera.yaml:

- platform: mjpeg
  mjpeg_url: !secret camera_mjpeg_8205
  name: Basement
  username: admin
  password: !secret camera

- platform: generic
  still_image_url: !secret camera_still_image_url
  name: Driveway
  username: admin
  password: !secret camera

- platform: foscam
  ip: 192.168.1.20
  port: 8020
  name: Family Room
  username: admin
  password: !secret camera

- platform: foscam
  ip: 192.168.1.26
  port: 8026
  name: NatureCam
  username: admin2
  password: !secret camera

You need another platform in you camera.yaml

  • platform: amcrest

@tchellomello Are you aware of this issue?

2017-07-21 11:18:45 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: <Front_Door_Cam: AMC004T0503CND5G28> is not JSON serializable

Thanks for any help you can provide!

Sheesh, I forgot to add the non-working part. The first one passes the checker, but errors in the front end.

2017-07-21 12:10:34 ERROR (MainThread) [homeassistant.setup] Error during setup of component amcrest
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/setup.py", line 190, in _async_setup_component
    component.setup, hass, processed_config)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/amcrest.py", line 93, in setup
    amcrest_cams = config[DOMAIN]
KeyError: 'amcrest'
2017-07-21 12:10:34 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of sensor.amcrest. Setup failed for dependencies: amcrest

- platform: amcrest
  host: 192.168.1.22
  username: admin
  password: !secret camera
  name: Kitchen
  port: 8022

- platform: amcrest
  - host: 192.168.1.22
    username: admin
    password: !secret camera
    name: Kitchen
    port: 8022

No I mean you need to add the amcrest camera in camera.yaml as well as the config file.

In config.yaml

In camera.yaml

Can’t be in both:

2017-07-21 12:22:53 ERROR (Thread-1) [homeassistant.util.yaml] duplicate key: “host”
in “/home/homeassistant/.homeassistant/camera.yaml”, line 2, column 0
in “/home/homeassistant/.homeassistant/camera.yaml”, line 4, column 0
2017-07-21 12:22:53 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: duplicate key: “host”

You dont put host in camera.yaml just “- platform: amcrest”

Hello @eBoon

Thanks for copying me on this one. Yes, I’m aware. There is one issue reported at https://github.com/home-assistant/home-assistant/issues/8551

I’ll try to look into this tonight.

1 Like

Guys @eBoon PR submitted today to fix the JSON issue

I’m sorry for not catching that before.

1 Like

amcrest is currently broken.

Broken for me in 0.51.1

2017-08-13 08:13:22 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of camera.amcrest. Setup failed for dependencies: amcrest
2017-08-13 08:13:22 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform camera.amcrest: Could not setup all dependencies.

edit: working now after reboot

Can you post your final config for both configuration.yaml and camera.yaml? I had this working in 48 but i reinstalled everything and have your exact same errors. The duplication between config and camera.yaml is confusing.

In configuration.yaml I have

camera:
  platform: amcrest

amcrest:
  host: 192.168.1.xxx
  name: cam name
  resolution: low
  username: username
  password: password
  port: 80
  stream_source: snapshot
  sensors:
    - motion_detector
    - sdcard

I actually have amcrest.yaml setup up but just copied it into one for simplicity

I use separate files, but it’s effectively the same as above

configuration.yaml:

camera: !include cameras.yaml
amcrest: !include amcrest.yaml

cameras.yaml: (foscams here, too)

- platform: amcrest

amcrest.yaml:

- host: 192.168.1.20
  #‎IP2M-841B
  username: admin
  password: !secret camera
  name: Family Room
  port: 8020
  stream_source: snapshot
  sensors:
    - motion_detector
  # - sdcard
  # - ptz_preset

So is this officially broken? I get no errors and everything seems correct but no picture.