Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for iMou devices (DAHUA based) #6

Open
marcinbauer85 opened this issue Jun 14, 2021 · 128 comments
Open

Support for iMou devices (DAHUA based) #6

marcinbauer85 opened this issue Jun 14, 2021 · 128 comments

Comments

@marcinbauer85
Copy link

marcinbauer85 commented Jun 14, 2021

Is there chance of this working with imou Ranger 2 cameras, which are based on DAHUA IPC-A22EP?

@rroller
Copy link
Owner

rroller commented Jun 14, 2021

My guess is I need to implement this #4 and it'll work.

I don't have the hardware to test with so it makes implementing it a little difficult. I'll try to buy one of these cameras soon to test with.

@marcinbauer85
Copy link
Author

Greatly appreciate it!

@gelokatil
Copy link
Contributor

Hi,

I have cameras model IPC-A22E (Imou Ranger2) and another IPC-C22EP-IMOU (Imou Cue2). I have tried adding them and neither of the two models works but I want to try to do more tests and activate the debug mode that you mention in the readme.md. If you need me to try something to test the cameras, do not hesitate to let me know.

@rroller
Copy link
Owner

rroller commented Jun 17, 2021

@gelokatil that would be the same issue as #4

I'm buying one of those cameras this week so I can build in support for it. Not sure how long shipping will take, but hopefully not to long.

@rogodra
Copy link
Contributor

rogodra commented Jun 19, 2021

I'm buying one of those cameras this week so I can build in support for it. Not sure how long shipping will take, but hopefully not to long.

I also have two iMou Ranger 2 IPC-A22E cameras. With the windows app Smart PSS can be controlled locally, even the PTZ. When configuring, the program uses port 37777.

If you need us to do any testing, here we are.

Thanks for everything!

@rroller
Copy link
Owner

rroller commented Jun 20, 2021

I just ordered this. It’ll arrive Monday and I’ll try to get it working ASAP.

https://www.amazon.com/dp/B08RD2C67R

@paalj69
Copy link

paalj69 commented Jun 20, 2021

I'am not able to connect to a IPC-HFW2100P. Is it the same issue?

br,
PJ

@rroller
Copy link
Owner

rroller commented Jun 20, 2021

@paalj69 I'm not sure.

@rroller
Copy link
Owner

rroller commented Jun 22, 2021

The hardware arrived today. I hope to test it out soon. Will report back as soon as I know more.

@mabusdogma
Copy link

mabusdogma commented Jun 22, 2021

I have an Imou Ranger 2 (IPC-A22E) too!
Let me know if there's a fix/hack/trick to let it work, specially if we can use PTZ controls (so we can control the camera from Home Assistant).

Thanks!

@inevity
Copy link

inevity commented Jun 23, 2021

Just have a imou Ranger Pro which is a new version having 2K, is it similar with the imou ranger 2? Look like it is IPC-A26HP.
note: late confirmation is PC-A46L-LC.

@rroller
Copy link
Owner

rroller commented Jun 24, 2021

@inevity probably the same API.

Just a heads up, I finally got this device hooked up so now I can start hacking away :)

I'll continue to keep you posted. Sorry for the delays!

@rroller
Copy link
Owner

rroller commented Jun 25, 2021

OK this is going to take some work. This camera uses the RPC2 API (which is better because it's json based). The other cameras support the same RPC2 API but the way I coded this integration up was with the REST API. I'll have to either build a translation layer or switch to the RPC2 API (it'll just take some time). I'll see what I can do.

@gelokatil
Copy link
Contributor

OK this is going to take some work. This camera uses the RPC2 API (which is better because it's json based). The other cameras support the same RPC2 API but the way I coded this integration up was with the REST API. I'll have to either build a translation layer or switch to the RPC2 API (it'll just take some time). I'll see what I can do.

Ok rroller, thanks in advance for all your work

@rogodra
Copy link
Contributor

rogodra commented Jun 26, 2021

OK this is going to take some work. This camera uses the RPC2 API (which is better because it's json based). The other cameras support the same RPC2 API but the way I coded this integration up was with the REST API. I'll have to either build a translation layer or switch to the RPC2 API (it'll just take some time). I'll see what I can do.

Thank you for the work you are doing.

I don't think it's very useful, but with the ConfigTool app, which is inside the ToolBox app, you can change the image settings, like switching the compression of the main video to H264, making it compatible with HA, the bitrate, resolution etc ...

https://www.imoulife.com/support/downloadCenter/tools

@rroller
Copy link
Owner

rroller commented Jul 3, 2021

Just to keep everyone posted, I've started to write the first bit of code for this. Nowhere near done, but at least it's a start 😆

@rroller
Copy link
Owner

rroller commented Jul 3, 2021

I have the basic commands working with the RPC2 API (login, logout, get device details). This works great for all my Dahua cameras but it still doesn't work for the iMou camera. It will require more digging to understand what's going on.

@rroller
Copy link
Owner

rroller commented Jul 3, 2021

As far as I can tell, these cameras do not have an HTTP API. Unfortunately you have to connect over a socket and send the commands according to their protocol as seen here https://github.com/mcw0/PoC/blob/master/Dahua-3DES-IMOU-PoC.py
That's going to be very painful to implement and to get right.

@rroller
Copy link
Owner

rroller commented Jul 4, 2021

I doubt this will help at all... but I just released 0.8.13 which uses the rpc2 API during the config flow. Can some of you try with the latest 0.8.13 release to see if you get further along when trying to add an iMou camera? I really doubt it will help, but I'd like to rule it out.

@gelokatil
Copy link
Contributor

gelokatil commented Jul 4, 2021

Hi, I've tested with IPC-A22E and IPC-C22EP-IMOU and gives on both this error message.

DEBUG (MainThread) [custom_components.dahua] Attempting login with URL http://192.168.20.34:80/RPC2_Login
INFO (MainThread) [custom_components.dahua] Authenticated with the RPC2 API
WARNING (MainThread) [custom_components.dahua] Could not connect to Dahua device via the RPC2 API, falling back to cgi
WARNING (MainThread) [custom_components.dahua] Could not connect to Dahua device

Traceback (most recent call last):
File "/config/custom_components/dahua/config_flow.py", line 194, in _test_credentials
data = await client2.get_machine_name()
File "/config/custom_components/dahua/client.py", line 93, in get_machine_name
return await self.get(url)
File "/config/custom_components/dahua/client.py", line 528, in get
raise exception
File "/config/custom_components/dahua/client.py", line 516, in get
response = await auth.request("GET", url)
File "/config/custom_components/dahua/digest.py", line 46, in request
response = await self.session.request(method, url, headers=headers, **kwargs)
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 544, in _request
await resp.start(conn)
File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 890, in start
message, payload = await self._protocol.read() # type: ignore
File "/usr/local/lib/python3.8/site-packages/aiohttp/streams.py", line 604, in read
await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected

@mabusdogma
Copy link

Imou Ranger 2
(IPC-A22E)

Logger: custom_components.dahua
Source: custom_components/dahua/client.py:524
Integration: Dahua (documentation, issues)
First occurred: 10:46:42 (1 occurrences)
Last logged: 10:46:42

TimeoutError fetching information from http://192.168.1.134:80/cgi-bin/magicBox.cgi?action=getMachineName -

:(

I already use this camera in HA with a standard onvif config, but I have a lot of lag and no PTZ (so I can't control the camera), just image.
Should I log out from the ONVIF config before I try this Dahua integration? Not sure

@mabusdogma
Copy link

Nevermind, i've got the same result with or without the ONVIF integration

@gelokatil
Copy link
Contributor

As far as I can tell, these cameras do not have an HTTP API. Unfortunately you have to connect over a socket and send the commands according to their protocol as seen here https://github.com/mcw0/PoC/blob/master/Dahua-3DES-IMOU-PoC.py
That's going to be very painful to implement and to get right.

Hello rroller,

Maybe this is wasting time but I have been playing with the code you have named and I have successfully managed to connect to my camera through the IMOU cloud, passing it as the camera serial parameter. I'm not a programmer at all, but maybe the part of the code that authenticates to the cloud could be redirected to the local IP of the camera instead of going through their cloud.

I have achieved it with this command passing the camera serial as a parameter.

python3 dahua_3des.py --dhp2p XXXXXXXXXXXX -dd

@rroller
Copy link
Owner

rroller commented Jul 4, 2021

@gelokatil thanks. We don't want to use the cloud here and would like to stay completely local. I should have mentioned this before... the local username is admin and the local password is the "safety code" on the bottom on the camera. You'll also need to figure out the local IP address.

With the mcw0 tools I was able to restart the device which means everything we want to do is doable, but it's doing all of this over socket communication. Writing a client for that is very tedious

@rroller
Copy link
Owner

rroller commented Jul 4, 2021

@mabusdogma that's the same that I'm getting. It's because the Dahua integration is trying to speak HTTP to an API that doesn't understand HTTP so the iMou device just hangs waiting for the right header bytes. If I send the right bytes over a socket I can make progress but it's going to take me awhile to really write something that works and to fully understand the protocol based on @mcw0's work (and hope that the API isn't different from Dahua's HTTP api). Right now this is going to be low on my list of things to do as I want to build in more support for native Dahua cams.

@mcw0
Copy link

mcw0 commented Jul 4, 2021

Guys, thanks for "alerting" in the post, please let me know how I could help you out.

FYI, I mostly use Dahua undocumented API, not the same as their official CGI API.

@mcw0
Copy link

mcw0 commented Jul 4, 2021

Guys, thanks for "alerting" in the post, please let me know how I could help you out.

FYI, I mostly use Dahua undocumented API, not the same as their official CGI API.

By the way, the undocumented API I am mostly using working 99.9% with both HTTP/HTTPS and DHIP (DHIP, what I guess you refer as socket), and 2nd, I do have few IMOU devices that I testing/playing with )

@rogodra
Copy link
Contributor

rogodra commented Oct 17, 2022

Hi @rroller. I fixed RPC2 class for authentification and updating session. I needed to use coaxial control that wasn't working through cgi on my iMou IPC-T26EP. Maybe you want to change cgi client to RPC2 in the future. https://github.com/VaLeXaR/dahua/tree/coaxial_control

With this 'coaxial control' variant, I can enter the Imou IPC-A22E. Also the camera view works, the other entities don't seem to work.
Thanks for the work!

@mabusdogma
Copy link

Hi @rroller. I fixed RPC2 class for authentification and updating session. I needed to use coaxial control that wasn't working through cgi on my iMou IPC-T26EP. Maybe you want to change cgi client to RPC2 in the future. https://github.com/VaLeXaR/dahua/tree/coaxial_control

With this 'coaxial control' variant, I can enter the Imou IPC-A22E. Also the camera view works, the other entities don't seem to work. Thanks for the work!

Hey, I have the same Imou camera, how did you make it work? I Installed the coaxial_control, set the username/password and so on, but I just get this message: Dahua device at 192.168.1.xxx isn't fully initialized yet
Reload the integration or even restart HA don't help.

Did you select some specific features? (at the beginning, there was a lot of checkboxes and I set them all on 'check', did you?) something else I'm missing, maybe?

@mabusdogma
Copy link

mabusdogma commented Oct 17, 2022

this is the error log:

Logger: custom_components.dahua
Source: custom_components/dahua/__init__.py:291
Integration: Dahua (documentation, issues)
First occurred: 3:18:19 p. m. (4 occurrences)
Last logged: 3:18:57 p. m.

Unexpected error fetching dahua data: Dahua device at 192.168.1.xxx isn't fully initialized yet
Traceback (most recent call last):
  File "/config/custom_components/dahua/__init__.py", line 201, in _async_update_data
    self._max_streams = await self.client.get_max_extra_streams() + 1
  File "/config/custom_components/dahua/client.py", line 141, in get_max_extra_streams
    result = await self.get("/cgi-bin/magicBox.cgi?action=getProductDefinition&name=MaxExtraStream")
  File "/config/custom_components/dahua/client.py", line 755, in get
    raise exception
  File "/config/custom_components/dahua/client.py", line 737, in get
    response = await auth.request("GET", url)
  File "/config/custom_components/dahua/digest.py", line 46, in request
    response = await self.session.request(method, url, headers=headers, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 559, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 898, in start
    message, payload = await protocol.read()  # type: ignore[union-attr]
  File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 616, in read
    await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/dahua/__init__.py", line 291, in _async_update_data
    raise PlatformNotReady("Dahua device at " + self._address + " isn't fully initialized yet")
homeassistant.exceptions.PlatformNotReady: Dahua device at 192.168.1.xxx isn't fully initialized yet

@rogodra
Copy link
Contributor

rogodra commented Oct 17, 2022

Hi @rroller. I fixed RPC2 class for authentification and updating session. I needed to use coaxial control that wasn't working through cgi on my iMou IPC-T26EP. Maybe you want to change cgi client to RPC2 in the future. https://github.com/VaLeXaR/dahua/tree/coaxial_control

With this 'coaxial control' variant, I can enter the Imou IPC-A22E. Also the camera view works, the other entities don't seem to work. Thanks for the work!

Hey, I have the same Imou camera, how did you make it work? I Installed the coaxial_control, set the username/password and so on, but I just get this message: Dahua device at 192.168.1.xxx isn't fully initialized yet Reload the integration or even restart HA don't help.

Did you select some specific features? (at the beginning, there was a lot of checkboxes and I set them all on 'check', did you?) something else I'm missing, maybe?

Well, installing the coaxial control version, restart HA, and log in.

If I reload the integration, it gives me the same error as you, but if I disable it and reactivate it, it logs in without problems.

But little else can be done, since no sensor gives correct information, no switch works because from what I understand the cgi commands don't work.

@mabusdogma
Copy link

Hi @rroller. I fixed RPC2 class for authentification and updating session. I needed to use coaxial control that wasn't working through cgi on my iMou IPC-T26EP. Maybe you want to change cgi client to RPC2 in the future. https://github.com/VaLeXaR/dahua/tree/coaxial_control

With this 'coaxial control' variant, I can enter the Imou IPC-A22E. Also the camera view works, the other entities don't seem to work. Thanks for the work!

Hey, I have the same Imou camera, how did you make it work? I Installed the coaxial_control, set the username/password and so on, but I just get this message: Dahua device at 192.168.1.xxx isn't fully initialized yet Reload the integration or even restart HA don't help.
Did you select some specific features? (at the beginning, there was a lot of checkboxes and I set them all on 'check', did you?) something else I'm missing, maybe?

Well, installing the coaxial control version, restart HA, and log in.

If I reload the integration, it gives me the same error as you, but if I disable it and reactivate it, it logs in without problems.

But little else can be done, since no sensor gives correct information, no switch works because from what I understand the cgi commands don't work.

Now it works! but... is there a chance to use PTZ to control from HA? To be honest I started to follow this thread more than a year ago because I want to control on HA what the camera sees, and to open/close the camera, so I could inactivate video when I'm home for privacy.

@rogodra
Copy link
Contributor

rogodra commented Oct 18, 2022

Now it works! but... is there a chance to use PTZ to control from HA? To be honest I started to follow this thread more than a year ago because I want to control on HA what the camera sees, and to open/close the camera, so I could inactivate video when I'm home for privacy.

In fact, I'm the same as you, right now they are in a drawer precisely because there is no option to move or disable the video.
I was trying Onvif and Amcrest (which are similar) and nothing, neither worked the PTZ.

I commented to report that the coaxial control version was logging into the Imou Ranger 2 IPC-A22E, the current main version never gets around to logging in.

@eadmaster
Copy link

I've installed ispyagentdvr as docker container:

hub.docker.com/r/doitandbedone/ispyagentdvr

The IMOU Cruiser isn't listed, but works as 'Cue 2' without any problem.

I can confirm this is working with the Cruiser SE+ (IPC-S21FE), including pan+tilt controls, but no mic support.

@mabusdogma
Copy link

mabusdogma commented Nov 15, 2022

Good news for people with Imou cameras:
A new HACS integration lets you control a lot of things inside Home Assistant.
https://github.com/user2684/imou_life

imou

Just look at this! Now I can automate when to open and close the transmission (from HA) or detect people, or to set the alarm...
I hope you like it too :)

@sophof
Copy link

sophof commented Dec 7, 2022

Sadly that is a non-local solution, which is a deal-breaker for me.

@mabusdogma
Copy link

I hope there's a local solution soon, I like the idea too

@DzzD
Copy link

DzzD commented Dec 23, 2022

Hello, I bought the Ranger 2C... this is the fourth camera I bought, as you I am upset by manufacturers applications and clouds, I was thinking after few reading that this one was able to work locally without any requirment of creating an account or using a mobile app... I am also trying to hack this thing but dont want to loose a huge amount of time, I wonder if I am not going to re-sent this device... I got a ten years old camera from TPLink in my garage that I was able to make running in a cupple of minutes using its web gui... nowadays all mannufacturers try to force theirs applications this is really discouraging

@DzzD
Copy link

DzzD commented Dec 23, 2022

For now I have just connected to it using its Wifi AP and password written on the camera, doing a port scan give me 80 & 554 TCP open but no HTTP layer, any HTTP request fall in timeout, no response, at TCP layer just an ACK no payload.

I'll try to use my computer as a wifi AP and make the first official steps, see what I can grab but I have few hopes to get anything usable.

@DzzD
Copy link

DzzD commented Dec 23, 2022

I knew, it was not going to be that simple...

After a bit more than one hour here is what I was able to make :

1 - make my computer appear as to be the camera for the mobile application.
The QRCode just contain serial number, wifi AP password and model of the camera as a json string, those data are also written on the camera underneath of the QRCode.
It use those datas to connect to the wifi AP of the camera.
I have created with my computer an access point with the same SSID & Password as the camera and was able to get to step 2 of configuration on the mobile application. it is not great but a starting point...

2 - make my computer appear as to be the mobile application for the camera
For this I just connect to its Wifi and set my IP to 192.168.0.1 (based on prévious packets I captured)

So finally, the start of the scenario is :
1 - Mobile App use Serial Number+Wifi password to determine SSID and connect to the Webcam AP
2 - Once mobile app connect to the AP, it then send an UDP broadcast packet with a cupple of bytes "a301000100000000000000000000000002000000000000000000000000000000"
3 - WebCam ask by ARP who is 192.168.0.1
4 - once the WebCam get an asnwer for it ARP request, it try to request at different Google DNS with hardcoded IPs (it try 8.8.8.8, 8.8.4.4,...) to resolve devaccess.easy4ipcloud.com

So next step, is to respond to the webcam for its DNS request for devaccess.easy4ipcloud.com an try to proxy all requests.

Not sure I will do this.

@DzzD
Copy link

DzzD commented Dec 23, 2022

In short when I spoof the mobile APP I got this :
image

And as it got no response from 8.8.8.8 it ask to another 8.8.4.4 and so on :
image

Once 8.8.8.8 is translated :
image

This is incredible that this thing rely on a hard coded domain name, a harcoded DNS, a mobile application, and an internet connexion to be configured !

@kkwestt
Copy link

kkwestt commented Mar 23, 2023

Imou DB60 RTSP ?
Снимок экрана 2023-03-23 в 00 28 59
Снимок экрана 2023-03-23 в 00 26 40

@jrb80
Copy link
Contributor

jrb80 commented May 11, 2023

This is incredible that this thing rely on a hard coded domain name, a harcoded DNS, a mobile application, and an internet connexion to be configured !

Use the SmartPSS application to change the DNS and hostname. You need to connect over TCP port 37777. The username is "admin" and the password is your safety code printed on the camera label or found in the Imou app.

@jrb80
Copy link
Contributor

jrb80 commented May 11, 2023

Imou DB60 RTSP ?

The correct RTSP format looks like this

rtsp://<username>:<password>@<IP>:554/cam/realmonitor?channel=1&subtype=0

@DzzD
Copy link

DzzD commented May 11, 2023

Use the SmartPSS application to change the DNS and hostname. You need to connect over TCP port 37777. The username is "admin" and the password is your safety code printed on the camera label or found in the Imou app.

Yes in the mean time I bought an Amcrest camera (because it works with it own integrated web interface) and was nicely surprise to see that the mobile Amcrest application detect it aswell as other camera configuration application like Dahua conifg tool.

Anyway, thanks for your tips.

EDIT: SmartPSS is very nice

@spotlesscoder
Copy link

spotlesscoder commented Jul 22, 2023

like

Does your RTSP stream still work? Bought a brandnew IPC A22EP-0 (Ranger 2C), updated to firmware version 2.800.0000000.13.R.230708 and did not manage to make RTSP work

Update: The problem was my VLC media player.
After upgrading from 3.0.16 to 3.0.18 it worked using
rtsp://<username>:<password>@<IP>:554/cam/realmonitor?channel=1&subtype=1

@doreks
Copy link

doreks commented Jul 28, 2023

HI eadmaster
how did you configure your cam? i have version IPC-S21FE and no way to run it

@JimGermany
Copy link

This is incredible that this thing rely on a hard coded domain name, a harcoded DNS, a mobile application, and an internet connexion to be configured !

Use the SmartPSS application to change the DNS and hostname. You need to connect over TCP port 37777. The username is "admin" and the password is your safety code printed on the camera label or found in the Imou app.

I have to ask again about this old post. :-) I just got an Imou Cruiser Dual (IPC-S7X-8M0WED) and can configure it individually using the Config Tool or Smart PSS. The integration with HA via HA Onvif integration also works. The same goes for the integration with my Dahua NVR via port 37777. But if I understand this correctly, it still doesn't work with the Dahua integration. Right?
Or can I now change certain settings using the Config Tool or Smart PSS so that when you try to integrate it via Dahua integration, the error message regarding an incorrect username/password doesn't appear, thus making integration possible?

@jrb80
Copy link
Contributor

jrb80 commented Mar 14, 2025

Most of the Imou consumer grade cameras do not have local HTTP API support. Most Imou cameras have ONVIF support and port 37777 is the default port for all cameras.

A few exceptions do exist, mainly the older/first generation Imou cameras like the DH-IPC-K42 which is rebranded as an Imou Cube 4MP.

The Imou product range is targeted for plug-n-play end users, baby cameras, etc. If you want to integrate with HA, stick with Dahua branded cameras.

@woody4165
Copy link

Most of the Imou consumer grade cameras do not have API support. Most Imou cameras have ONVIF support and port 37777 is the default port for all cameras.

Are you sure?
Now in HA there is the official integration for Imou camere and before that there was (there is) unofficial Imou cam support with API that you can find here

@jrb80
Copy link
Contributor

jrb80 commented Mar 14, 2025

I am referring to the local Dahua HTTP API which is what this integration is built on. The Imou cloud API is entirely different.

@JimGermany
Copy link

JimGermany commented Mar 14, 2025

The Imou product range is targeted for plug-n-play end users, baby cameras, etc. If you want to integrate with HA, stick with Dahua branded cameras.

Hi,

I've been using Dahua cameras and NVRs for many years, so I'm quite familiar with the differences between Dahua and Imou. ;-) I also know that not every Imou camera uses the Dahua API or is compatible with it. For example, I also use an Imou DB61i video doorbell/doorbell, which is 100% identical to the Dahua DH-DB6i and can also be used with Dahua integration via the Dahua API.

The Imou Cruiser Dual (IPC-S7X-8M0WED) appears to me to also use the Dahua API, precisely because my Dahua NVR automatically recognizes it as a Dahua camera, and I don't have to integrate it via Onvif. The same applies to Dahua Smart PSS , the Dahua Config Tool and DMSS.

Your statement "to change the DNS and hostname." sounded to me like I could change the settings via Smart PSS or the Config Tool so that the Imou camera would then be recognized by the Dahua integration and the error message "Username, Password, or Address is wrong" would no longer occur.

Or maybe rroller has made some kind of adjustment over the years, since it seems to "only" be an issue with the auth.request. But I'm not a developer, so I can't judge how difficult it would be to fix the problem.

`Dieser Fehler stammt von einer benutzerdefinierten Integration

Logger: custom_components.dahua
Quelle: custom_components/dahua/config_flow.py:190
Integration: Dahua (Dokumentation, Probleme)
Erstmals aufgetreten: 12:39:48 (1 Vorkommnisse)
Zuletzt protokolliert: 12:39:48

Could not connect to Dahua device. For iMou devices see #6
Traceback (most recent call last):
File "/config/custom_components/dahua/client.py", line 794, in get
response = await auth.request("GET", url)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/dahua/digest.py", line 46, in request
response = await self.session.request(method, url, headers=headers, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiohttp/client.py", line 730, in _request
await resp.start(conn)
File "/usr/local/lib/python3.13/site-packages/aiohttp/client_reqrep.py", line 1059, in start
message, payload = await protocol.read() # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/aiohttp/streams.py", line 672, in read
await self._waiter
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/config/custom_components/dahua/config_flow.py", line 190, in _test_credentials
data = await client.get_machine_name()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/dahua/client.py", line 121, in get_machine_name
return await self.get("/cgi-bin/magicBox.cgi?action=getMachineName")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/dahua/client.py", line 806, in get
raise exception
File "/config/custom_components/dahua/client.py", line 790, in get
async with async_timeout.timeout(TIMEOUT_SECONDS):
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/async_timeout/init.py", line 141, in aexit
self._do_exit(exc_type)
~~~~~~~~~~~~~^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/async_timeout/init.py", line 228, in _do_exit
raise asyncio.TimeoutError
TimeoutError`

Dieser Fehler stammt von einer benutzerdefinierten Integration

Logger: custom_components.dahua
Quelle: custom_components/dahua/client.py:805
Integration: Dahua (Dokumentation, Probleme)
Erstmals aufgetreten: 12:39:48 (1 Vorkommnisse)
Zuletzt protokolliert: 12:39:48

TimeoutError fetching information from http://192.168.1.x:80/cgi-bin/magicBox.cgi?action=getMachineName

@jrb80
Copy link
Contributor

jrb80 commented Mar 14, 2025

@JimGermany

The RTSP video stream is on port 37777 and this is how the DVR is connecting, it doesn't mean the camera has a local API. They are completely different things.

You can easily test whether your camera has a local API by running a simple CURL. Just update the IP address and password

curl --user admin:xxxxxx --digest http://192.168.1.108:80/cgi-bin/magicBox.cgi?action=getSoftwareVersion

The DB61 should respond with

version=1.000.0000003.1.R,build:2023-08-19

Try the same command with other cameras.

@JimGermany
Copy link

JimGermany commented Mar 14, 2025

The issue is already resolved for me, as I've already packed the Imou camera up again after extensive testing, and it's going back to Amazon tomorrow. :-) There were simply too many things that bothered me. For example, a limited PTZ control under HA with Onvif Integration and no presets.

Since the Dahua integration apparently doesn't work with it, and cloud integration via https://open.imoulife.com/ is out of the question for me, I'll stick with the "real" Dahua cameras. I might also test the TP-Link Vigi models (e.g., Vigi C540), which I believe are also Dahua OEM models. The only difference is that the Vigi models don't seem to be as "slimmed down" as the Imou or Dahua Picoo models.

PS: It's a shame that rroller hasn't had the time to further develop its integration in recent years. Although I can certainly understand that. If you look at the development of the Reolink or TP-Link Tapo integration over the last one to two years and how extensively they've been maintained and developed, it's clear why more and more HA users are turning to Reolink or Tapo cameras, while Dahua cameras under HA are playing a less and less important role. Personally, I find that a real shame.

@jrb80
Copy link
Contributor

jrb80 commented Mar 14, 2025

Dahua manufacture cameras for a long list of companies, including Lorex, Honeywell and many other brands. I know for sure that not all implement the Dahua API and many have intentionally removed it to comply with US security regulations. Whilst others have modified it to a bespoke version.

Hikvision and Dahua are the global market leaders in "professional" security cameras. Choose either brand and you won't be disappointed. Axis is the best but very expensive.

Image

@JimGermany
Copy link

JimGermany commented Mar 14, 2025

I'm familiar with all of that, too. I used to use also Axis and Hikvision cameras and then switched to Dahua about seven years ago. If I want high-quality IP cameras, I already know what to choose, but here/for me, it's also about HA.

In other words: If I were to recommend high-quality IP cameras to someone, I would recommend Axis, Dahua, Hikvision, or possibly Hanwha. If I were to recommend IP cameras that work best with HA, I would currently recommend Reolink or TP-Link. Precisely because there is currently no such well-maintained and comprehensive integration for Axis, Dahua, Hikvision, or Hanwha for HA.

Perhaps in the future, a developer will be found who has the time and desire to develop and maintain a new Dahua integration for HA. Until then, I will continue to use my Dahua cameras and Dahua NVR via HA Onvif integration. Maybe I'll get a Hikvision or even a Reolink camera again to test them out, although I have a certain aversion to Reolink due to their aggressive marketing and, in my opinion, rather poor quality. :-))

But that's all rather off-topic here, and my question about the Imou camera has been resolved. It doesn't work with the Dahua integration, and that's it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests