Amcrest IP Camera Component Enhancements - PTZ control and audio streaming

Using version 92.1

Right now I do not show any errors messages. i am currently invoking the scripts ONLY. Which move camera position. Neither one appear to be working.

'1553648151710':
  alias: CameraWall
  sequence:
  - data:
      preset: '4'
    service: camera.amcrest_goto_preset
'1553648379251':
  alias: CameraView
  sequence:
  - data:
      preset: '1'
    service: camera.amcrest_goto_preset

Here Is one error message …

Updating command_line switch took longer than the scheduled update interval 0:00:30

Also this error mesage.

Update of switch.office_tv_power is taking over 10 seconds

Ok, the new version requires you to either specify the camera entity_id or entity_id’s via the entity_id service parameter, or you need to specify entity_id: all. So to be compatible with the old method of selecting all cameras, you need to do this:

'1553648151710':
  alias: CameraWall
  sequence:
  - data:
      preset: '4'
    entity_id: all
    service: camera.amcrest_goto_preset
'1553648379251':
  alias: CameraView
  sequence:
  - data:
      preset: '1'
    entity_id: all
    service: camera.amcrest_goto_preset

But you said that camera.amcrest_goto_preset wasn’t registered??? If so, there should be an error about the service not existing (I would think.)

Sorry, It gave that error before I upgraded. Now that I am on the newest of amcrest third party software it doesnt do that.

The Fix:
Upgraded Amcrest Custom Component.

Corrected the scripts.

'1553648151710':
  alias: CameraWall
  sequence:
  - data:
      preset: '4'
      entity_id: all
    service: camera.amcrest_goto_preset
'1553648379251':
  alias: CameraView
  sequence:
  - data:
      preset: '1'
      entity_id: all
    service: camera.amcrest_goto_preset
1 Like

@pnbruckner

Is it possible to stream multicast content? It seems multicast would be the best solution for me, since I’ll have this content displayed in multiple places at one time. These cameras do not have the resources to handle 4-5 device streams at once.

I have no idea. :man_shrugging: Even though I’ve been putting in a lot of work on the amcrest integration, it mostly has to do with control – i.e., commands to changes settings, etc. I have very little video/streaming experience. That’s a question for someone else.

Will test this out this weekend and see what happens.

Another update on the status of the PR’s submitting my enhancements to the standard component:

21664 - 0.90.0 - serialize snapshots
21720 - 0.90.0 - async_camera_image
22040 - 0.91.0 - new exceptions
22099 - 0.91.0 - use configured RTSP port for stream
22418 - 0.92.0 - add turn_on/turn_off support
22703 - 0.92.0 - add binary_sensor
22949 - 0.93.0b0 - add services
23446 - 0.93.0b0 - optimize sdcard sensor

Once 0.93.0 is released I will drop support for my custom amcrest component.

1 Like

Rejected. Not sure what the response means, other than I can’t fix this anytime soon.

All previously submitted enhancements are now part of the standard component as of the 0.93.0 release. Support for the custom component has now “officially” ended. At some point I may remove it from my github repo.

1 Like

Is there a way to update the content here: https://www.home-assistant.io/components/amcrest/?

Um, it has been updated. What do you think is missing?

I think I just need to learn how to read, I see the additions on there. Is this still applicable " Amcrest cameras with newer firmware no longer have the ability to stream high definition video with MJPEG encoding."?

No idea. I haven’t worked on that part. As I understand it, if you use the stream component, then it will get the RTSP URL from the amcrest component and then stream directly from the camera. Honestly, I’m not sure what the stream_source setting is for anymore.

Interesting. Have yet to try multicast out, plan to eventually.

Hi all! :slight_smile:

I’ve been working on improving error handling in the amcrest component. Before I start working on a PR, would anyone be willing to test it out? You can find the changes here.

I haven’t worked on the doc side yet, but basically it should just “drop in.” But there are a couple of new, optional config variables:

  • max_errors – The maximum number of errors in a row that can occur while still considering the device available. If the next command results in error all the entities associated with the device will be made unavailable and error recovery will begin. The minimal value is 3 and the default is 5.
  • recheck_interval – When the device is considered unavailable it will be “pinged” periodically and once it responds properly all the entities associated with the device will become available again (and the recovery mode will end.) This variable controls the period of rechecking. The minimum value is 15 seconds, and the default is 15 minutes.

If anyone does try it out :pray: I’d appreciate any and all feedback. THANKS!!

1 Like

Will this update help with errors? My log is filled with errors like:

Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f48dfd8c710>, 'Connection to 10.0.0.184 timed out. (connect timeout=3.0)')': /cgi-bin/storageDevice.cgi?action=getDeviceAllInfo

Trying again due to error HTTPConnectionPool(host='10.0.0.184', port=80): Max retries exceeded with url: /cgi-bin/storageDevice.cgi?action=getDeviceAllInfo (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f48dfc562e8>, 'Connection to 10.0.0.184 timed out. (connect timeout=3.0)'))

Could not get image from Dining_Room_Camera camera due to error: Could not communicate with camera

Query failed due to error 401 Client Error: Unauthorized for url: http://10.0.0.179:80/cgi-bin/snapshot.cgi?channel=0

My username/password is correct and I’m able to stream my Amcrest camera RTSP feeds into Home Assistant, but I’m not getting preview images and a ton of errors.

host: 10.0.0.186
name: Dining_Room_Camera
username: !secret amcrest_username
password: !secret amcrest_password
stream_source: rtsp

and then within the lovelace UI, I have a Picture Entity Card set up like this:

entity: camera.dining_room_camera
type: picture-entity
camera_view: live

If I remove “camera_view: live” I get just a broken image in the UI, but I can click it to start the stream.

Feels like I’ve tried everything to address it, but nothing has worked. Any pointers or will I need to wait for this update?

OK, I’ve got it installed and had noticed a significant reduction in errors, but I forgot I had previously configured the logger to the “ERROR” level for homeassistant.component.amcrest, amcrest.http, and urrlib3.

I just restarted after removing them and using default logger settings now and will report back soon.

Note that before this update, I had captured the errors for the previous hour (using the production Amcrest component) and there were about 70 pairs of these 2 errors for 1 particular camera:

ERROR (SyncWorker_12) [amcrest.http] Query failed due to error 401 Client Error: Unauthorized for url: http://192.168.100.101:80/cgi-bin/snapshot.cgi?channel=1
ERROR (MainThread) [homeassistant.components.amcrest.camera] Could not get image from LakeCam_SD camera due to error: Could not communicate with camera

Can you tell me what HA version you’re using? And can you share your camera configuration? Is the camera controlled only by the HA amcrest (and stream) component, or is there anything else, in or out of HA, that is also communicating with the camera?

It may have some effect. Mainly it’s intended to handle the scenario when the camera is “off line” when HA starts, or goes off line during operation, or if there’s a LOT of errors. If there are intermittent warnings/errors, those probably won’t be minimized. But I’m just getting started. :slight_smile: It’s kind of hard to handle all scenarios because I only have a few, relatively new models, and of course my network isn’t going to be similar to everyone’s. But I’ll do what I can.

One thing that can affect the ability to get a snapshot is the camera’s snapshot quality setting, and of course, the resolution. If it’s too high of a resolution, combined with too high of a quality setting, that can lead to snapshots never working. But I think the error would be different (although I don’t remember the details.)

Anyway, the more info I can get the better I can make the component.

Thanks for giving it a try. I’m definitely interested in hearing how it works for you!

Per my previous comment (and maybe you were involved in some of this discussion before), there are combinations of image resolution and snapshot quality settings that can cause the snapshot command to fail. I’ve even seen where it can be intermittent. I’m thinking about adding a feature to monitor for that and at least add a warning, but maybe even attempt to reduce the quality setting until the errors go away. Haven’t really done anything about that yet, though. It’s just on the list of ideas. Of course, not saying this is why you were seeing those errors.

Anyway, let me know how it goes!