dahua
dahua copied to clipboard
Error calling service dahua/vto_open_door: Bad request 400
Version of the custom_component
0.5.0 from latest release
Configuration
I'm using an VTO2202F-P-S2, that's my configuration:
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')
I have this also
Same here with a VTO2101E-P-S1
Same issue, any news ?
Hi @rroller, did you solve this problem?
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?
+1
+1 Same with VTO2202
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
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.
+1
+1 any updates regarding this issue?