dahua icon indicating copy to clipboard operation
dahua copied to clipboard

Add support for Lorex W452ASD Floodlight Camera

Open vittorio88 opened this issue 2 years ago • 6 comments

Using up-to-date Home Assistant, and latest trunk 7b038ee9b98be6756af5f827623eeb988113b114. I am unable to connect to a Lorex W452ASD Floodlight Camera. I am able to sucessfully connect to separate Lorex NVR N845A62 in the same network using the dahua custom component.

While adding the device, the connection times-out. I attempted bumping the timeout from 20 sec to 40 sec in https://github.com/rroller/dahua/blob/main/custom_components/dahua/client.py#L13, but this did not stop the Timeout from occuring. I believe the issue is that the Floodlight never responds to the requests from python, however it does respond when I access it locally using the Desktop application LorexCloud provided by Lorex on port 35000. Port 35000 and 554 TCP are the only ports found open on the device from a port scan.

Here is the Traceback that when it timesout. Any help appreciated!

2024-01-24 17:36:31.510 WARNING (MainThread) [custom_components.dahua] TimeoutError fetching information from http://192.168.33.32:35000/cgi-bin/magicBox.cgi?action=getMachineName
2024-01-24 17:36:31.511 ERROR (MainThread) [custom_components.dahua] Could not connect to Dahua device. For iMou devices see https://github.com/rroller/dahua/issues/6
Traceback (most recent call last):
  File "/config/custom_components/dahua/client.py", line 774, 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.11/site-packages/aiohttp/client.py", line 601, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 965, in start
    message, payload = await protocol.read()  # type: ignore[union-attr]
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 622, 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 188, 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 786, in get
    raise exception
  File "/config/custom_components/dahua/client.py", line 770, in get
    async with async_timeout.timeout(TIMEOUT_SECONDS):
  File "/usr/local/lib/python3.11/site-packages/async_timeout/__init__.py", line 141, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.11/site-packages/async_timeout/__init__.py", line 228, in _do_exit
    raise asyncio.TimeoutError
TimeoutError

vittorio88 avatar Jan 24 '24 23:01 vittorio88

go to a browser, goto this address:

http://camera-ip/cgi-bin/magicBox.cgi?action=getDeviceType

REPLACE camera-ip with your camera's IP

If that doesn't work change it from HTTP to HTTPS

Submit the response here!

davidew98 avatar May 28 '24 17:05 davidew98

FYI the W452ASD mainboard looks the same as the Dahua IPC-L46N mainboard when looking at pics from FCC website. If this is in fact a rebadged IPC-L46N then it's firmware might work on this cam!! try at your own risk.

davidew98 avatar May 30 '24 14:05 davidew98

Same issue here. I have my suite of cameras connected on my HA integration via my NVR, but I would love to connect to my W452ASD individually in order to have the floodlight control available.

I am able to tune into the RTSP of the camera individually via VLC using the RTSP port, (and my NVR has no issue connecting to it via TCP) but I have no such luck trying to connect to the camera via HTTP or HTTPS (using port 80 or trying to connect via the address listed above). Therefore, I can't connect the camera to the Dahua integration.

It looks like others have had success so I'm not sure if I'm missing something.

jbezugs avatar Sep 03 '24 18:09 jbezugs

go to a browser, goto this address:

http://camera-ip/cgi-bin/magicBox.cgi?action=getDeviceType

REPLACE camera-ip with your camera's IP

If that doesn't work change it from HTTP to HTTPS

Submit the response here!

@davidew98

I am unable to connect via browser with HTTP or HTTPS unfortunately.

This site can’t be reached 192.168.33.32 refused to connect. ERR_CONNECTION_REFUSED

vittorio88 avatar Oct 20 '24 03:10 vittorio88

go to a browser, goto this address: http://camera-ip/cgi-bin/magicBox.cgi?action=getDeviceType REPLACE camera-ip with your camera's IP If that doesn't work change it from HTTP to HTTPS Submit the response here!

@davidew98

I am unable to connect via browser with HTTP or HTTPS unfortunately.

This site can’t be reached 192.168.33.32 refused to connect. ERR_CONNECTION_REFUSED

@vittorio88 I’m having the same issue. I think the Lorex firmware on these cameras doesn’t actually have a web interface. I bet the Dahua firmware would bring it back, but I’m unsure of how to flash that onto the cam.

When I did a port scan on my cam, the only open port was the RTSP port (port 554)

jbezugs avatar Oct 20 '24 21:10 jbezugs

It does communicate locally successfully with the LorexCloud Desktop application over port 35000 TCP or 35001 UDP. I think this is the Dahua API port.

vittorio88 avatar Oct 27 '24 03:10 vittorio88