Closed lebretr closed 1 week ago
FYI, the error in HA logs:
Enregistreur: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:245
intégration: Home Assistant WebSocket API (documentation, problèmes)
S'est produit pour la première fois: 21:35:10 (3 occurrences)
Dernier enregistrement: 21:37:20
[547475435680] Unexpected exception
[547518984352] Unexpected exception
[547489595744] Unexpected exception
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/hikvision_next/switch.py", line 125, in async_turn_on
raise ex
File "/config/custom_components/hikvision_next/switch.py", line 123, in async_turn_on
await self.coordinator.isapi.set_port_state(self._port_no, True)
File "/config/custom_components/hikvision_next/isapi.py", line 703, in set_port_state
await self.request(PUT, f"System/IO/outputs/{port_no}/trigger", present="xml", data=xml)
File "/config/custom_components/hikvision_next/isapi.py", line 797, in request
response = await self.isapi.request(method, full_url, present, **data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/hikvision_next/isapi_client.py", line 80, in request
response.raise_for_status()
File "/usr/local/lib/python3.12/site-packages/httpx/_models.py", line 763, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '403 Forbidden' for url 'http://192.168.1.121:80/ISAPI/System/IO/outputs/1/trigger'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403
Add user permission "Remote: Notify Surveillance Center / Trigger Alarm Output" in Readme
This solves 403 error when we want to enable the Alarm Output in H.A. for Camera DS-2CD2T46G2-ISU/SL