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

Error calling service dahua/vto_open_door: Bad request 400 #154

Open
alve89 opened this issue Jan 30, 2022 · 13 comments
Open

Error calling service dahua/vto_open_door: Bad request 400 #154

alve89 opened this issue Jan 30, 2022 · 13 comments

Comments

@alve89
Copy link

alve89 commented Jan 30, 2022

Version of the custom_component

0.5.0 from latest release

Configuration

I'm using an VTO2202F-P-S2, that's my configuration:
image

HA integration is added through GUI.

configuration.yaml:

button:
  - platform: mqtt
    unique_id: dahua_vto_open_door_btn
    name: "Haustür öffnen"
    command_topic: "DahuaVTO/ha/door/open"
    payload_press: "1"
    qos: 0
    retain: false

Describe the bug

It's about the button to open the door (dahua_vto_open_door_btn aka Haustür öffnen). Clicking this button sometimes (and sometimes not, I can't see any pattern) throws this error. The service is still called and the door is opened, but HA throws this error. Sometimes there's a voice feedback from the VTO, sometimes not. Sometimes the voice feedback is repeated multiple times (by now three times maximum). It's a very weird behavior.

I'd really like to give you a more precise description but I really can't see any pattern for this behavior.
I already reduced the "recognition time" in the VTO configuration (from default 15 seconds to 1 second) but still no change.

Debug log

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/dahua/client.py:657 
Integration: Home Assistant WebSocket API (documentation, issues) 
First occurred: 12:20:12 (1 occurrences) 
Last logged: 12:20:12

[2971219472] 400, message='Bad Request', url=URL('http://192.168.1.108:80/cgi-bin/accessControl.cgi?action=openDoor&UserID=101&Type=Remote&channel=1')
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 691, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call
    await result
  File "/config/custom_components/dahua/camera.py", line 325, in async_vto_open_door
    await self._coordinator.client.async_access_control_open_door(door_id)
  File "/config/custom_components/dahua/client.py", line 525, in async_access_control_open_door
    return await self.get(url)
  File "/config/custom_components/dahua/client.py", line 671, in get
    raise exception
  File "/config/custom_components/dahua/client.py", line 657, in get
    response.raise_for_status()
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('http://192.168.1.108:80/cgi-bin/accessControl.cgi?action=openDoor&UserID=101&Type=Remote&channel=1')
@mattclar
Copy link

I have this also

@Giotrumpet
Copy link

Same here with a VTO2101E-P-S1

@cabral92
Copy link

Same issue, any news ?

@alve89
Copy link
Author

alve89 commented Jan 22, 2023

Hi @rroller, did you solve this problem?

@Suxsem
Copy link

Suxsem commented Feb 16, 2023

Hi think I found the issue. The GET request should not contain the UserId parameter.
@rroller Any chance you can change it in client.py?
Do you prefer a PR?

@kiklhorn
Copy link

+1

@dudetryhard
Copy link

+1
Same with VTO2202

@Dieghito72
Copy link

Hi, can confirm same issue on a DHI-VTO2201F-P Firmware: 4.500.0000001.0.R,build:2021-07-13.

@rroller thank you very much for the great work, form me the integration works great apart this, since this issue has been opened long time ago, is there any chance that will be fixed?

As soon as possible I will try the suggested solution provide by @Suxsem and let you know

@Dieghito72
Copy link

Dieghito72 commented Sep 15, 2023

After some experiments, unfortunately the work around suggested by @Suxsem didn't work, anyway I have additional info.

The VTO manage two contacts , one for cars and one for pedestrians.

When I call the service with DoorID = 1, the first gate opens, but 404 is raised.
When I call the service with DoorID = 2, the second gate opens and no error is raised.

@LubikR
Copy link

LubikR commented Jan 28, 2024

+1

@infrat
Copy link

infrat commented Feb 14, 2024

+1 any updates regarding this issue?

@jcortizronda
Copy link

I have the same issue, any news about this?

@DAVIZINH0
Copy link

same error with a vto221g-WP
the door opens but report a error:
Error: 400, message='Bad Request', url='http://192.168.1.xxx/cgi-bin/accessControl.cgi?action=openDoor&UserID=101&Type=Remote&channel=1'

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