Amcrest question

tnx for coming back to my issue;

the most recent one ( Home Assistant 0.113.3)

As curl with “Digest” is running without issue maybe it is a good idea to have this configuration possibility in HA (authentication does not take “Digest” as value); this way your component does not need to check “basic” beforehand to then switch to “Digest” and generating “errors” while trying to get a connection under “basic”.

Wondering that nobody else seems to have this issue.

Your errors are not due to basic authentication failing. That is error 401, and would not be logged as a warning or error. You’re getting error 403 which is something different. That could be due to your camera not being compatible with HA’s amcrest integration (or vice versa.)

Does this camera ever work with HA’s amcrest integration? Does it cause errors sometimes, or all the time?

ok, tnx for the clarification.

But the “problems” are just log related.

Apart from this the camras are working nicely within HA and your Amcrest integration.

The (log) issues are since long; would be great to get rid of these as they are floating my logs (I do have 10 cameras and so the problems are multiplying).

The camera itself is a Dahua Starlight.

The status of the camera entities is “idle”.

tnx

according to wikipedia:

HTTP 403 is returned when the client is not permitted access to the resource despite providing authentication such as insufficient permissions of the authenticated account.

Error 403: “The server understood the request, but is refusing to authorise it.”, RFC 7231[1]

Strangely curl is working nicely and not causing any errors while accessing the cameras.

Yes, 403 means what you’re asking is not allowed, not that it doesn’t know who you are. I.e., authentication worked (hence no error 401), but authorization did not. For the camera, that basically means you’re asking it to do something it doesn’t know how to do.

That’s because you asked it to do something (“http://192.168.2.200/cgi-bin/magicBox.cgi\?action\=getVendor”, i.e., return the vendor name) that it knows how to do.

If you look at the error, it’s occurring because it’s asking something else:

Forbidden for url: http://192.168.2.215:80/cgi-bin/configManager.cgi?action=getConfig&name=RecordMode

So try this:

curl --digest --user admin http://192.168.2.215:80/cgi-bin/configManager.cgi?action=getConfig&name=RecordMode

And, BTW, I just noticed you’re using two different IP addresses: 192.168.2.200 & 192.168.2.215???

I’ve also found that these cameras sometimes just refuse to do what they are asked, but when retried the command that just failed, works. I have considered changing some of the messages classified as WARNING to INFO or DEBUG, especially when retrying, (because, unfortunately, there’s no way to filter WARNING messages from the UI log) but I just haven’t gotten around to doing that yet.

good idea trying with the error message causing curl command:

 -» ~curl--digest--useradminhttp://192.168.2.215:80/cgi-bin/configManager.cgi\?action\=getConfig\8name\=RecordMode Enter host password for user 'admin':
table.RecordMode[0].Mode=0
table.RecordMode[0],ModeExtral=0

from my point of view no error with curl.

My fault with the different ip address (I do have the same message from 192.168.2.210); it is the ip address of one of the other nine cameras but they are all having the same issue.

2020-08-06 11:17:00 DEBUG (SyncWorker_6) [homeassistant.components.amcrest] els_wash_210 camera errs: 1
2020-08-06 11:17:00 ERROR (SyncWorker_6) [homeassistant.components.amcrest.camera] Could not get els_wash_210 camera attributes due to error: CommError
2020-08-06 11:17:00 DEBUG (SyncWorker_7) [homeassistant.components.amcrest.camera] Updating els_beik_215 camera
2020-08-06 11:17:00 WARNING (SyncWorker_7) [amcrest.http] <2J0225PZA9A0014:2J0225PZA9A0014> Trying again due to error: HTTPError('403 Client Error: Forbidden for url: http://192.168.2.215:80/cgi-bin/configManager.cgi?action=getConfig&name=RecordMode')

but it seems to be that your component is asking the camera for attributes which might not be there (maybe this RecordMode).

getting rid of the warning messages would be great and ideally getting rid of the connection Error (maybe generating this error only if the connection fails for x times).

tnx

That may be the case, and if it is, then the integration doesn’t support that camera model / firmware version.

Clearly you have debug enabled for homeassistant.components.amcrest. What do you have amcrest set to? If not debug, then could you set it to debug? I.e.:

logger:
  default: info
  logs:
    amcrest: debug
    homeassistant.components.amcrest: debug

Then look at more of the log. See if that command always fails, or eventually works, possibly on a retry.

If it never works, then the integration just doesn’t support that camera. That’s not necessarily to say that it never could, just that it might not as it is.

@pnbruckner Hello good (CET) eveing and happy New Year
I think you are the mantainer of the Amcrest integration.
I had to switch to a HassOS VM setup from core and I cannot get the cameras (Dahua recognized as amcrest under ha core) to work,
Is there anything specific to be done?
I have stream: and ffmpeg: enabled in configuration.yaml and the same configuration I had in ha core for the cameras

also
I noticed in ssh on the VM that ffmpeg package was not installed and I manually installed .
I read it should have been preinstalled…
Thanks in advance

2021-01-07 22:29:48 ERROR (Amcrest TelecameraCucina) [homeassistant.components.amcrest] TelecameraCucina camera offline: Too many errors
2021-01-07 22:29:48 ERROR (Amcrest TelecameraIngresso) [homeassistant.components.amcrest] TelecameraIngresso camera offline: Too many errors
2021-01-07 22:29:48 ERROR (Amcrest TelecameraPortico) [homeassistant.components.amcrest] TelecameraPortico camera offline: Too many errors
2021-01-07 22:29:48 ERROR (Amcrest TelecameraSoggiorno) [homeassistant.components.amcrest] TelecameraSoggiorno camera offline: Too many errors
2021-01-07 22:29:48 ERROR (Amcrest TelecameraLetto) [homeassistant.components.amcrest] TelecameraLetto camera offline: Too many errors

config

  - host:   !secret TelecameraLetto_url
    name:  TelecameraLetto
    stream_source: rtsp
    username: !secret TelecameraLetto_user
    password: !secret TelecameraLetto_password
    binary_sensors: 
     - motion_detected
     - online

Hi and Happy New Year.

I’m really not maintaining the integration anymore. Also I know absolutely nothing about HassOS VM. But my guess would be some sort of networking configuration issue; i.e., HA not able to communicate with the cameras. If I were you, I’d ask for help in a forum category more associated with HassOS. Good luck!

Hi thanks for the feedback.
Never mind. I will find a way.
Icould get the cameras stream through onvif.
Well at least some of them… damn dahua