kvj / hass_nuki_ng

Better support for Nuki devices in the Home Assistant
MIT License
185 stars 36 forks source link

[139698485440000] Error handling message: Unknown error (unknown_error) #113

Open MacVille opened 2 years ago

MacVille commented 2 years ago

I get serval times a day the following Error on the HA Log:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 648, in handle_execute_script await script_obj.async_run(msg.get("variables"), context=context) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run await asyncio.shield(run.async_run()) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step self._handle_exception( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception raise exception File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step await service_task File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 207, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 931, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call await result File "/config/custom_components/nuki_ng/lock.py", line 53, in async_lock await self.coordinator.action(self.device_id, "lock") File "/config/custom_components/nuki_ng/nuki.py", line 469, in action await self.api.web_lock_action(self.web_id(dev_id), action) File "/config/custom_components/nuki_ng/nuki.py", line 126, in web_lock_action await self.web_async_json( File "/config/custom_components/nuki_ng/nuki.py", line 184, in web_async_json return await self.async_json( File "/config/custom_components/nuki_ng/nuki.py", line 39, in async_json raise ConnectionError(f"Http response for {response.request.url}: {response.status_code} {response.reason}") ConnectionError: Http response for https://api.nuki.io/smartlock/ID/action: 423 Locked

This is the HA Version I use: image

Nuki HACS Integration Version: 0.3.11

jmcollin78 commented 2 years ago

Same for me since a few days. My Nuki 3 Pro don't work anymore with Home Assistant. I have reported this here: https://developer.nuki.io/t/api-error-423-locked/17896/2

Since 2022.11 HA release I've got another error:

2022-11-05 15:48:26.635 WARNING (MainThread) [custom_components.nuki_ng.nuki] Despite being configured, Web API request has failed
2022-11-05 15:48:26.637 ERROR (MainThread) [custom_components.nuki_ng.nuki] Error while fetching last log entry
Traceback (most recent call last):
  File "/config/custom_components/nuki_ng/nuki.py", line 423, in _update
    item["last_log"] = await self.api.web_get_last_unlock_log(web_id)
  File "/config/custom_components/nuki_ng/nuki.py", line 200, in web_get_last_unlock_log
    response = await self.web_async_json(
  File "/config/custom_components/nuki_ng/nuki.py", line 184, in web_async_json
    return await self.async_json(
  File "/config/custom_components/nuki_ng/nuki.py", line 39, in async_json
    raise ConnectionError(f"Http response for {response.request.url}: {response.status_code} {response.reason}")
ConnectionError: Http response for https://api.nuki.io/smartlock/17987331556/log: 500 Server Error
2022-11-05 15:48:26.640 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 151, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 348, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 586, in _async_write_ha_state
    attr.update(self.extra_state_attributes or {})
  File "/config/custom_components/nuki_ng/sensor.py", line 220, in extra_state_attributes
    "timestamp": datetime.fromisoformat(timestamp) if not None else None,
TypeError: fromisoformat: argument must be str
kvj commented 2 years ago

Hey,

Is the error persistent? Http response for https://api.nuki.io/smartlock/17987331556/log: 500 Server Error that rather looks like a temporal Web API failure and should be gone after some time.

Http response for https://api.nuki.io/smartlock/ID/action: 423 Locked This error is undocumented

jmcollin78 commented 2 years ago

See some explaination here: https://developer.nuki.io/t/api-error-423-locked/17896/14