rroller / dahua

Dahua Camera and Doorbell Home Assistant Integration
MIT License
382 stars 73 forks source link

AD410 not recognized #304

Open Phrede opened 11 months ago

Phrede commented 11 months ago

AD410 appears as "Generic RTSP" device.

As such there is no extra select, sensors, or switches. I.e. no button push.

Could Amcrest have changed or ?

starfleetk commented 11 months ago

I am also getting this now with a new fresh install of Home Assistant. It still works on my old HA box but not on the fresh install. Both are running the same version 2023.9.2. The fresh install just has generic RTSP where as the old install has the AD410, firmware, and the button press.

JimGermany commented 11 months ago

Which firmware version are you using? There is a new firmware for the AD410: https://github.com/rroller/dahua/issues/282#issuecomment-1732595571 There were firmware versions from 2022 that caused problems with newer Home Assistant versions.

I've been using an Imou DB61i for a few days now, which is basically identical to the Amcrest AD410.

My active Home Assistant installation is version 2023.8.4 with Dahua Addon 0.9.44 = The Imou DB61i works without any problems. See https://github.com/rroller/dahua/issues/282#issuecomment-1732550022

I just did a new fresh Home Assistant installation (2023.9.2) as a virtual machine as a test (for you) and the Imou DB61i works with that too (Dahua Addon Version 0.9.44) Imou_DB61i_HA_2023 9 2

If you are using the current Amcrest firmware and the Dahua addon version 0.9.44 and it still doesn't work, there are probably differences between the Imou and the Amcrest API.

Addendum: It doesn't work without a problem yet, as there is still a warning in the Home Assistant log

Source: components/camera/img_util.py:50
First occurred: 09:36:40 (2 occurrences)
Last logged: 10:01:35

/usr/local/lib/python3.11/site-packages/turbojpeg.py:901: UserWarning: Corrupt JPEG data: 608 extraneous bytes before marker 0xfe warnings.warn(self.__get_error_string(handle))

But I haven't yet looked into what exactly is causing it. Besides, it's just a "warning" and not an error. :-)

starfleetk commented 11 months ago

My Doorbell is running firmware: 1.000.00AC002.0.R,build:2023-08-10 I am running the latest version on my old HA box and now am running the 0.9.44 on the new box. still will not add with the button press sensor.

Old Box:

image

New Box:

image
JimGermany commented 11 months ago

Yes with my old Amcrest AD110 also have a Sensor with "Button Pressed".

HA_AD110

But now, when the bell button is pressed on my Imou DB61i, it is signaled via "Alarm Local" Sensor. That's ok for me.

My Imou DB61i camera is also not recognized as a Generic RTSP Camera but as a DB61i from Dahua and I can see the full Firmware-Version and not only "Firmware: 1.0" HA_Dahua_DB61i

But there are probably differences in the API and perhaps Amcrest has made changes by/in/with the new firmware.

Phrede commented 11 months ago

I am also getting this now with a new fresh install of Home Assistant. It still works on my old HA box but not on the fresh install. Both are running the same version 2023.9.2. The fresh install just has generic RTSP where as the old install has the AD410, firmware, and the button press.

I'm running HA 2023.9.3 and the 8-10 Amcrest firmware. I'm not sure about the integration version, where are you checking that? I've got the latest off of HACS.

There is much more missing than just the button push, that was just an example in the OP. Things like IR control, White light select, siren, etc.

GaryOkie commented 11 months ago
_"But there are probably differences in the API and perhaps Amcrest has made changes by/in/with the new firmware."_

I have yet to install the newest firmware on my AD410. The main reason for holding off was specifically to be sure no new issues with event handling and Home Assistant were encountered.

Since the AD410 with new firmware is being identified as a generic RTSP camera this could be due a change in the firmware system identifier.

@Phrede &/or @starfleetk - what response do you get from this API command (after authenticating)?

<camera_ip>/cgi-bin/magicBox.cgi?action=getSystemInfo

With the original firmware, here is the expected response:

appAutoStart=true
deviceType=AD410
hardwareVersion=1.00
processor=SSC339
serialNumber=Z17D3xxxxx
updateSerial=DB6I
updateSerialCloudUpgrade=DB6I-xxxxxxxxxxxxxxxxx

I'm not sure what API command the custom Dahua code is using to determine device type, but I do know the python-amcrest library (which the core Amcrest integration uses) relies on getSystemInfo for deviceType.

JimGermany commented 11 months ago

There is much more missing than just the button push, that was just an example in the OP. Things like IR control, White light select, siren, etc.

The fact that some sensors are no longer displayed under Home Assistant could be due to an API change.

Unfortunately, today I have to realize that my Imou DB61i isn't working properly for me. When the Imou DB61i is powered by the bell transformer, it makes “cracking noises” after a while and a whistling noise after another while. :-( So far I had only connected and tested the camera via a USB power supply in the study. There were no problems or noises whatsoever.

Therefore I will send the Imou back to the seller on Aliexpress and continue to use my Amcrest AD110. So I can't say anything more about it now.

GaryOkie commented 11 months ago

The fact that some sensors are no longer displayed under Home Assistant could be due to an API change.

Yep - if the device isn't recognized as a doorbell via the deviceType or other DB identifier, then it should be expected that none of the doorbell-related sensors would be provided.

I've never heard of a crackling/whistling issue before. Since it doesn't happen with USB power, the transformer power is the likely cause even though it apparently works fine with your AD110. But may be too late for your DB6I as it was either damaged out of the box or damaged after connection. Good choice to send it back.

Have you looked into the Reolink doorbell availability in Germany? It appears to be overtaking the AD410 in home automation/RTSP popularity lately.

starfleetk commented 11 months ago

I did try the /cgi-bin/magicBox.cgi?action=getSystemInfo, however it never got past the authentication. I put in the same username and password that I use in the app and keeps asking for me to login.

GaryOkie commented 11 months ago

I put in the same username and password that I use in the app

@starfleetk - if you are referring to the SmartHome app, that ID/pw is the cloud login, which uses your email as the ID. The Amcrest camera/doorbell uses 'admin' as the userid, and whatever p/w you specified during its initial setup.

When you configured the doorbell for this custom Dahua integration, the local camera credentials is what you must use, not the app/cloud login.

Phrede commented 11 months ago

appAutoStart=true deviceType=AD410 hardwareVersion=1.00 processor=SSC339 serialNumber=Z17A6F98D37CE updateSerial=DB6I updateSerialCloudUpgrade=DB6I:01:04:07:7C:41:00:01:10:01:01:04:400:03:03:00:00:08:01:00:00:100:FF

Glad to see you're here @GaryOkie.

I do believe is most likely is a firmware issue. I'm doing a lot of work on things in this area, my front gate, and during one of the mandatory factory resets I accepted the upgrade.

I'm about done with it. Honestly, I've worked more on this than any 10 other cameras combined. Mandatory factory reset, meaning having to open the internet to it, to change the wifi password!!! A constant battle with this thing is just not worth it.

Phrede commented 11 months ago

BTW Using Smart PSS you can change the admin user name, and much more.

GaryOkie commented 11 months ago

@Phrede - per your OP, we first need to understand why this integration is identifying the doorbell as a "generic RTSP" device.

I've taken a quick look at the code and see that vto.py (the low level I/O Dahua device driver) is not using getSystemInfo, but instead: <camera_ip>/cgi-bin/magicBox.cgi?action=getDeviceType which should simply return device=AD410 (In some cases it has to get device type via "updateSerial" )

I also saw this code has done a good job of logging device attributes. So in the logger config, please try enabling INFO (or debug) loglevel and report devicetype/serial results.

custom_components.dahua: info

starfleetk commented 11 months ago

I put in the same username and password that I use in the app

@starfleetk - if you are referring to the SmartHome app, that ID/pw is the cloud login, which uses your email as the ID. The Amcrest camera/doorbell uses 'admin' as the userid, and whatever p/w you specified during its initial setup.

When you configured the doorbell for this custom Dahua integration, the local camera credentials is what you must use, not the app/cloud login.

Thanks for that. It is working as it should for me now. I will have to remember that for next time if I have to add that doorbell again.

Phrede commented 11 months ago
/cgi-bin/magicBox.cgi?action=getDeviceType

type=AD410

When I saw that I removed and reinstalled and things appear normal again. IdK, I was obviously having a brain dead day doing the camera update, maybe I used a wrong password?

It looks like the IR isn't going on, I need to check it further.

I appreciate your help

razulian commented 11 months ago

Just so you know: https://github.com/rroller/dahua/issues/295#issuecomment-1743268397